...

View Full Version : Need Help!



Phantom
02-13-2003, 01:05 AM
I'm getting ready to make a site where people have to log in, but it's been so long that I don't remember squat about it.

Basically, all I remember is that it stores login information in a cookie from page to page, and the cookie is set in login.php (or whatever)...but I don't remember how...if someone could help me out here...

- Have it select the user (defined by the login page) from the db and set it to a global variable
- Set a cookie with session information, user information, and database information

That's about all I remember...if someone could be so kind as to help me out I'd appreciate it :)

Email: phantom@ionic-rebellion.net
MSN: phantasmagoria@l33ad.com

Thanks :D

chinni
02-15-2003, 06:16 PM
well, you can do the user authentication in so many ways.

http://www.zend.com/zend/tut/authentication.php

Take a look at this tutorial, it helps you.

cheers

Jesh
02-15-2003, 10:21 PM
Pat User "http://www.php-tools.de" uses sessions to log users in.

just need MySQL

Jesh

Phantom
02-17-2003, 03:14 PM
Chinni - I can do that, it's about the same as using a .htaccess file to protect directories. What I want is a PHP script that uses an HTML form so that when they type in their username and password it logs them in.

Jesh - I'll check that out :)

chinni
02-17-2003, 04:29 PM
Yes, thats simple.you do have an example in that tutorial where it uses an html form to enter the user details.

Well, you can do it in so many ways:

1.do you want to check the user name and password using a flat file or through a table.

2.Advanced checks using sessions or cookies.

So, if you want me to write you the simple script, no problem i can do it for you.
There are scripts in many of the PHP forums, if you cant find it, lemme know so that i can write it for you.

cheers

Phantom
02-17-2003, 05:51 PM
If you could write me one to work off of it'd be great :)

If you could include everything with the cookies/sessions/all that crap, it'd be greatly appreciated :D

chinni
02-17-2003, 06:24 PM
well, phantom i made a simple script for you.I'm sorry as i could'nt have much time to write it using sessions and cookies.I hope somebody over here could help you.

Anyways, you can try this now.

Ps:the following code works for single user.If you need for multi-users, make a user table and check for user name and password and that would work out.It should not be a problem.




<?php

$myuser = "admin";
$mypass = "password";

if ($user == $myuser && $pass == $mypass)

{
//Replace the file name main.php with your file name so that it displays you the file after successfully logged in

header ('location: main.php');

}

else
{
echo"<form action=\"$PHP_SELF\" method=\"POST\">\n";

}

?>

<body bgcolor="white" text="black">
<form name="form1">
<p>&nbsp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&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</p>
<table align="center" border="1" width="324" bgcolor="#CCCCCC" bordercolordark="black" bordercolorlight="black">
<tr>
<td width="314" height="37">
<p align="center"><span style="font-size:9pt;"><font face="Verdana">Please enter the user name and the password</font></span></p>
<p>&nbsp;&nbsp;<span style="font-size:11pt;">&nbsp;</span><font face="Verdana"><span style="font-size:11pt;">User
name </span>&nbsp;&nbsp;&nbsp;&nbsp;</font>&nbsp;<input type="text" name="user">&nbsp;</p>
<p>&nbsp;&nbsp;&nbsp;<span style="font-size:11pt;"><font face="Verdana">Password</font></span>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="password" name="pass"></p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="submit" name="formbutton1" value="Log in" style="font-family:Verdana;"></p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</p>
</td>
</tr>
</table>
</form>
<p>&nbsp;</p>
</body>

Spookster
02-17-2003, 06:41 PM
And by the way "Need Help" is not an appropriate subject/title for your topic.

Please review our Posting Guidelines before creating any more topics:

http://www.codingforums.com/postguide.htm

Phantom
02-17-2003, 08:26 PM
:p

And by the way, "fork?", "Help! I need a PHP Expert!", "File". How much different is "Need Help"?

Spookster
02-17-2003, 08:40 PM
Originally posted by Phantom
:p

And by the way, "fork?", "Help! I need a PHP Expert!", "File". How much different is "Need Help"?

Those other subjects/titles are not appropriate either. If you have a problem with our policies you can contact the Administrator WA as he is who instittuted them. Otherwise abide by the policies and you won't have any problems.

Phantom
02-17-2003, 08:42 PM
Well, I'm not going against the policy - very good one to enforce actually. But what I am going against is you singling me out - I didn't see you post in any of the other topics I just pointed out.

Spookster
02-17-2003, 08:52 PM
Originally posted by Phantom
Well, I'm not going against the policy - very good one to enforce actually. But what I am going against is you singling me out - I didn't see you post in any of the other topics I just pointed out.

I do not single people out. I catch most violations of policies and rules. I don't always have time to respond to every single violation immediately I do not always enforce policies outside the PHP forum as the other forums have their own moderators in charge.

If you feel you have been wronged you are more than welcome to discuss it with the Administrator. As of right now you are violating our rules:

http://www.codingforums.com/rules.htm

Rules 1.1 and 1.5 to be exact.

Phantom
02-17-2003, 11:55 PM
1.1 - How?
1.5 - Yes, I apologize. I'm done with this topic. Lock it, delete it, whatever.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum