|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
User Login - url redirection?
if i create a db table that has: USER, PASSWORD, URL
how can i make each user go to their specific url when they login. user 1 goes to user1.htm user 2 goes to user2.htm and so on i have no code to post because i have not started yet i am looking more for the pseudo code or theory. but i guess an exaple would help. Thanks Dave www.fs3d.com |
|
#2
|
|||
|
|||
|
The function you are looking for is header(). An example:
PHP Code:
Be careful with this function. It sends raw HTTP headers, wich means you musn't print out any other chars, even a space is not allowed, wich is usually the common mistake. If you find it difficult using it this way (if you keep getting errors) try using it with the ob_start() and ob_end_flush() functions to make your way around your errors. Hope it helps a bit. |
|
#3
|
|||
|
|||
|
i want user user1.htm to be a from the data base how do i tell PHP that user1.htm correspondes to the user1 data base field or is there a way to tell PHP to look with in the same row for the URL.
i hope this is clear, Thanks Dave |
|
#4
|
|||
|
|||
|
Well in that case, you have to get the users name from the database (I trust you know how to do that), then lets say you save that name in the variable $user. The line looks like this:
PHP Code:
This will take each user to their site. But why are you doing this like this? Imagine that you have a large number of users, why bother making a site for each and every one of them. Make a template page and just change what you need for each user with a script. On the other hand if you have only a few users, could prove usefull. Anywayz, hope you explain a bit further why you need this to begin with. |
|
#5
|
|||
|
|||
|
i am a small web designer and i want to create a place where my clients can log in and see their site before it is published and some other information that they may not want to be public. and lastly if it works out how i want it to it might be cool.
Thanks for the help, i think that will work perfect. i am new to PHP Dave Last edited by dfano : July 12th, 2003 at 05:06 PM. |
|
#6
|
|||
|
|||
|
Cheers. Glad to have helped.
|
|
#7
|
|||
|
|||
|
what if the user name is differnt from url
real example: Username : jason url : chandlerarchitecture.com the way you posted before will work fine, im just curious. Dave |
|
#8
|
|||
|
|||
|
Well make another field in the database (lets say lates_site or something). Well all you have to do is to save the addres in there. In this case you could save the whole addres in there (with the extension .htm or .php) and use a simpler line:
PHP Code:
Well I would do it like that... |
|
#9
|
|||
|
|||
|
it would look in the same row that user is in?
|
|
#10
|
||||
|
||||
|
What you could do, is in your database where you have your client information stored, for example if you have it setup like this
Quote:
then you could pull the customers url out of the database and send that information to the header, ie: PHP Code:
That would pull the information you would need to redirect to the customers website, otherwise it would justecho "No results returned." or something similar. Of course you would need to make sure that the customer would put their url in propper format when they sign up, or whatever you are doing.. ![]() Hope this helps. |
|
#11
|
|||
|
|||
|
justin i was hoping you would read this, i was going to send you a private message actually, but i didnt want to bother.
_rainbow_ had some really good info though Thanks Dave hey check out the site and give me some feed back www.fs3d.com i just finished it today |
|
#12
|
||||
|
||||
|
No worries, let me know if you need any more help
|
|
#13
|
|||
|
|||
|
AHHHHH
okay i thought i could do, I was wrong, dead wrong.
this what i have that works (i got with the help of Dreamweaver) __________________________________________________ __ <html> <head> <title>Untitled Document</title> <?php $hostname_fs3d = "localhost"; $database_fs3d = "*"; $username_fs3d = "*****"; $password_fs3d = "****"; $fs3d = mysql_pconnect($hostname_fs3d, $username_fs3d, $password_fs3d) or die(mysql_error()); ?> <body> <form name="form1" method="POST" action="<?php echo $loginFormAction; ?>"> <p> <input name="Username" type="text" id="Username"> user name</p> <p> <input name="Password" type="password" id="Password"> password</p> <p> <input type="submit" name="Submit" value="login"> </p> </form> </body> </html> __________________________________________________ _ where the heck do i go from here. thanks Dave Last edited by dfano : July 15th, 2003 at 03:12 PM. |
|
#14
|
|||
|
|||
|
Hey there,
It looks like you need to define the $loginFormAction. If you like, you can simply replace that <?php ?> block with the name of the php script that will process your login (e.g. "login.php"). That login script should contain the code you were given a few posts back by nicat23. What about the database itself? have you built your table and put some rows into it? Also, you don't need the database connection block on this form page. It's simply a form for collecting the info. Your second script (login.php) will handle the checking of the info. It's technically possible to have the same script check the form input, but to cut the confusion, skip that method for now--at least until you get it working. |
|
#15
|
||||
|
||||
|
For what it's worth, if you do plan to use localized pages in some cases, you probably ought to design one such page that checks the username and password and displays custom info rather than maintaining a separate page for each user. This is of course assuming that there are common elements to all such pages.
|
|
#16
|
||
|