Reply
Login - how do i do it???
Old 01-30-2005, 08:18 AM Login - how do i do it???
Skilled Talker

Posts: 58
Hello,

I want to have a client log in on my site, so that new clients can see the websites i am making for them.

I know how to set it up so that i can password protect a folder (using cPanel)

But i want it so that depending on the username / pass you enter in the login box, it will take to to the specific location.

Like = user: 1 pass: hi, would take you to see the website i am making for "1"
and = user: 2 pass: yo, would tke you to see the site i am making for "2"

i dont just want a redirect though, i want the site for "1" & "2" to be secure behind a password.

I would prefer a proper log in box on one of my pages, but i would settle for one of the internet browsers password box.

If i have not explained it well, please say so

But, i really need this, if you can, please help

Thank you,

KGB-911
__________________
San Andreas (UK)
KGB-911 is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
Old 01-30-2005, 11:15 AM
Skilled Talker

Posts: 58
If you cannot, please post me a link where i can get info on how to do this?
__________________
San Andreas (UK)
KGB-911 is offline
Reply With Quote
View Public Profile
 
Old 01-30-2005, 12:21 PM
Unknown.

Posts: 1,693
These links should point you in the right direction...

http://www.devscripts.net/browse/86.php
http://www.phpfreaks.com/tutorials/40/0.php
Dark-Skys99 is offline
Reply With Quote
View Public Profile
 
Old 01-30-2005, 12:39 PM
Logical Program's Avatar
Super Talker

Posts: 130
Location: Atlanta, Georgia
Here, I'll write you a little something out of the kindness of my heart. I'm assuming your knowledge is limited in programming, so I'm just writing it for to different passwords, plaintext, and no mysql functions for logging in.

PHP Code:

<?
session_start
();
$client1username 'username1HERE';
$client2username 'username2HERE';
$client1pass 'password1HERE';
$client2pass 'password2HERE';

if (
$logout == 'true'){
    
session_destroy();    
    die(
"You have successfully logged out.");
}
if (
$submit == 'Login'){
    if (
$username == $client1username){
        if (
strcmp($passw$client1pass) !== '0'){
            echo 
'<font color=red><b>Invalid Password.</b></font><br><br>';
        } else {
            
session_register("username");session_register("passw");session_register("submit");
            echo 
'<A href='.$PHP_SELF.'?logout=true><b>Log Out?</b></a><br><Br>';
            echo 
'Hi! Would you like to see the website I\'m working on for 
            you, '
.$username.'? (Client #2)';
        }
    } elseif (
$username == $client2username){
        if (
strcmp($passw$client2pass) !== '0'){
            echo 
'<font color=red><b>Invalid Password.</b></font><br><br>';
        } else {
            
session_register("username");session_register("passw");session_register("submit");
            echo 
'<A href='.$PHP_SELF.'?logout=true><b>Log Out?</b></a><br><Br>';
            echo 
'Hi! Would you like to see the website I\'m working on for 
            you, '
.$username.'? (Client #2)';
        }
    } else {
        echo 
'<font color=red><b>That username does not exist.</b></font><br><br>';
    }
} else {
    echo 
'<form action="'.$PHP_SELF.'" method="post">
    <b>Username</b>: <input type=text name=username><br>
    <b>Password</b>: <input type=password name=passw><center>
    <input type=submit value="Login"></form>'
;
}
?>
IT has not been tested at ALL. I just wrote it on the forum to help you out, and it's to give you the idea of how it works. If you are knowledgable in PHP, you can fix the minor errors, and use multiple pages in the framework.
__________________
Logical Programming - For all of your website programming and design needs, make the logical choice. Logical Assistance For Real-World Clients.

Last edited by Logical Program : 01-30-2005 at 12:44 PM.
Logical Program is offline
Reply With Quote
View Public Profile Visit Logical Program's homepage!
 
Old 01-30-2005, 01:10 PM
Skilled Talker

Posts: 58
Thanks very much, both of you, i am trying yours out now :P

KGB
__________________
San Andreas (UK)
KGB-911 is offline
Reply With Quote
View Public Profile
 
Old 01-30-2005, 01:39 PM
Skilled Talker

Posts: 58
i am very now to this kind of thing, and not done prfessional coding before. is there a program that will do it for me?

I dont want people to register them selves though

Anything?

Thanks
__________________
San Andreas (UK)
KGB-911 is offline
Reply With Quote
View Public Profile
 
Old 01-30-2005, 02:58 PM
Skilled Talker

Posts: 58
or another sugestion, can i edit a htaccess file so that it will take the logged in user to there destination?

Like, if i password protected the /clients/ and if you typed in the user "hello" it would take you to /clients/hello/

Is that possible?

Sorry for posting 3 times in a row

KGB
__________________
San Andreas (UK)
KGB-911 is offline
Reply With Quote
View Public Profile
 
Old 01-30-2005, 04:33 PM
Extreme Talker

Posts: 219
Location: UK, East Anglia
logical program's one should work for you, just change these to the usernames and passwords you want people to enter:

PHP Code:
$client1username 'username1HERE'
$client2username 'username2HERE'
$client1pass 'password1HERE'
$client2pass 'password2HERE'
timsquash5 is offline
Reply With Quote
View Public Profile
 
Old 01-31-2005, 01:30 AM
Skilled Talker

Posts: 58
I did that, but when i tried loading it on to the weboage, i got a loat of error's saying could not do things. with that script, what is supposed to happen after you type the correct username and password? are you supposed to be redirected to a page, or what?

Thanks,

KGB
__________________
San Andreas (UK)
KGB-911 is offline
Reply With Quote
View Public Profile
 
Old 01-31-2005, 01:59 AM
Logical Program's Avatar
Super Talker

Posts: 130
Location: Atlanta, Georgia
The script wasn't tested at all, it was just a mockup very close to what it should be. I assumed that you were able to correct minor errors.
__________________
Logical Programming - For all of your website programming and design needs, make the logical choice. Logical Assistance For Real-World Clients.
Logical Program is offline
Reply With Quote
View Public Profile Visit Logical Program's homepage!
 
Old 02-01-2005, 03:03 AM
Skilled Talker

Posts: 58
thanks everyone, i have sorted the problem using code of my own, a bit more advanced that your suggestion, i tought my self how to do it

Thanks,

KGB
__________________
San Andreas (UK)
KGB-911 is offline
Reply With Quote
View Public Profile
 
Old 02-01-2005, 12:27 PM
Logical Program's Avatar
Super Talker

Posts: 130
Location: Atlanta, Georgia
Sorry, but you can't just TEACH YOURSELF such a complex code in only 2 days when you can't even fix a minor parse error in the code I posted, much less be able to work with the code.
__________________
Logical Programming - For all of your website programming and design needs, make the logical choice. Logical Assistance For Real-World Clients.
Logical Program is offline
Reply With Quote
View Public Profile Visit Logical Program's homepage!
 
Reply     « Reply to Login - how do i do it???
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.17545 seconds with 12 queries