|
Web design and Programming Discuss website creation and other programming topics. |
|
Thread Tools | Search this Thread | Display Modes |
#1
|
||
|
User login using cookies pls...
Can some one help me do that? I need to create a User Login that uses cookies (obviously php for those who are new) . I'm learning Php and after all the tutorials i got i just got more confused. Lol. Thanks for future help.
__________________
"Keep up the fire" 9th Infantry Regiment BlimpQuick AkA AntiCheatMan |
#2
|
||
|
<?
$username="BlimpQuick"; $password="123abc"; If($_POST['submit']) { If($_POST['username']=="$username" AND $_POST['password']=="$password") { setcookie("loggedin","Yes",time()); } Else { echo"loggin failed"; } } ?> <form method="POST" action="<?=$_SERVER['PHP_SELF'];?>"> Username: <input type="text" name="username"><br /> Password: <input type="password" name="password"><br /> <input type="submit" name="submit" value=" Login "> </form>
__________________
04' Dodge SRT-4, Mopar Stage 3, 406whp/436wtq |
#3
|
||
|
thx panther, i was actually about to post at ur site and ask the same question , but u answered it here ! Ur pretty smart.
__________________
"Keep up the fire" 9th Infantry Regiment BlimpQuick AkA AntiCheatMan |
#4
|
||
|
He learns crap fast. He'd be a good asset if he did this for a corperation
__________________
|
#5
|
||
|
lol heck ya
__________________
"Keep up the fire" 9th Infantry Regiment BlimpQuick AkA AntiCheatMan |
#6
|
||
|
Very limiting though, would be better to use a database with thatr script.
|
#7
|
||
|
cool , how would i program a data base? That will b some hard work...I'll go read some tutorials.
__________________
"Keep up the fire" 9th Infantry Regiment BlimpQuick AkA AntiCheatMan |
#8
|
||
|
www.php.net search for mysql (need it installed on server), be sure to search in function list.
|
#9
|
||
|
huh...okay m8...but wut panther told me could be useful for Administration ... right? anyways how would I make a page only allow people with certain cookies to access them? Is there a way? I'm new to this but like I said before, the tutorials I recieve so far have confused me more. Thanks for future help
__________________
"Keep up the fire" 9th Infantry Regiment BlimpQuick AkA AntiCheatMan |
#10
|
|||
|
Quote:
And yes that is possible, one way is to store md5 hashes in the cookie thats compared to the hash in the Database, if its a match they are granted access, if not they get a message asking them to login. Md5 is a encryption that very secure Only bad thing when using Md5 is that it cant be decrypted, not that i know of atleast. go to www.webmonkey.com for tutorials on mysql and php. http://hotwired.lycos.com/webmonkey/...tutorial4.html Last edited by SilentTrigger; 06-09-2004 at 08:28 AM. |
#11
|
||
|
Never write usernames and passwords in your code. Use a database
|
#12
|
|||
|
Quote:
|
#13
|
||
|
But then you dont write:
$username="BlimpQuick"; $password="123abc"; But something like": $sql='SELECT userID FROM users WHERE username="'.$_POST['username'].'" AND password="'.md5($_POST['password']).'"'; |
#14
|
|||
|
Quote:
$username="md5hash"; //md5 hash that coresponds to the username $password="md5hash"; //md5 hash that cresponds to the password Then you have a form to write in the username and password which is md5'ed and compared to the username hash and password hash above. If its the same on both, your logedin. If not, you're not logged in |
#15
|
||
|
But then the md5 hash is in your code. easy to hack.
Got a nice tool for it which can get the right username & pass. But if you cant use a database... ok, then its a sollution. But i wouldnt use it though. |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
phUploader db instead of cookies | kripso | phphq.Net Forums | 1 | 05-27-2008 12:58 PM |
No more Cookies for me | bigsmellyfart | Humor & Jokes | 2 | 01-04-2006 01:27 PM |
user button? | -Tigger- | Sigs and Graphics | 1 | 12-30-2005 02:32 PM |
Cookies!!!!!!!! | atholon | Web design and Programming | 8 | 06-26-2004 06:17 PM |
new user | spang | Delta Force | 9 | 02-11-2003 04:20 PM |