Go Back   Novahq.net Forum > Computers > Web design and Programming

Web design and Programming Discuss website creation and other programming topics.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 05-26-2004, 09:39 AM
BlimpQuick is offline BlimpQuick
Registered User

Join Date: Jan 2004
Posts: 73

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
Reply With Quote
  #2  
Old 05-26-2004, 03:37 PM
Scott is offline Scott
Scott's Avatar
AKA. Panther

Join Date: Sep 2001
Location: Minneapolis, MN
Posts: 10,920

<?
$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
Reply With Quote
  #3  
Old 05-28-2004, 10:37 AM
BlimpQuick is offline BlimpQuick
Registered User

Join Date: Jan 2004
Posts: 73

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
Reply With Quote
  #4  
Old 05-28-2004, 10:49 AM
atholon is offline atholon
"ath-hole"

Join Date: Jan 2003
Location: Failville.
Posts: 11,357

Send a message via MSN to atholon
He learns crap fast. He'd be a good asset if he did this for a corperation
__________________
Reply With Quote
  #5  
Old 05-28-2004, 10:51 AM
BlimpQuick is offline BlimpQuick
Registered User

Join Date: Jan 2004
Posts: 73

lol heck ya
__________________
"Keep up the fire"
9th Infantry Regiment




BlimpQuick AkA AntiCheatMan
Reply With Quote
  #6  
Old 06-01-2004, 10:09 AM
SilentTrigger is offline SilentTrigger
-1PARA-

Join Date: Sep 2002
Location: Sweden
Posts: 3,972

Very limiting though, would be better to use a database with thatr script.
__________________
-1PARA-AlexKall

My photography website



Reply With Quote
  #7  
Old 06-02-2004, 01:52 PM
BlimpQuick is offline BlimpQuick
Registered User

Join Date: Jan 2004
Posts: 73

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
Reply With Quote
  #8  
Old 06-02-2004, 02:20 PM
SilentTrigger is offline SilentTrigger
-1PARA-

Join Date: Sep 2002
Location: Sweden
Posts: 3,972

www.php.net search for mysql (need it installed on server), be sure to search in function list.
__________________
-1PARA-AlexKall

My photography website



Reply With Quote
  #9  
Old 06-09-2004, 01:33 AM
BlimpQuick is offline BlimpQuick
Registered User

Join Date: Jan 2004
Posts: 73

Wink

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
Reply With Quote
  #10  
Old 06-09-2004, 08:21 AM
SilentTrigger is offline SilentTrigger
-1PARA-

Join Date: Sep 2002
Location: Sweden
Posts: 3,972

Quote:
Originally posted by BlimpQuick
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
Its indeed a very good script and that might be a very good for administration. It just hard if you get many members to have to write all in to the script file. Other then that theres no need for a database
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
__________________
-1PARA-AlexKall

My photography website




Last edited by SilentTrigger; 06-09-2004 at 08:28 AM.
Reply With Quote
  #11  
Old 06-10-2004, 03:51 AM
King is offline King
Registered User

Join Date: Jun 2004
Posts: 111

Never write usernames and passwords in your code. Use a database
__________________
www.sourcefreaks.com




Reply With Quote
  #12  
Old 06-10-2004, 03:58 AM
SilentTrigger is offline SilentTrigger
-1PARA-

Join Date: Sep 2002
Location: Sweden
Posts: 3,972

Quote:
Originally posted by King*NI*
Never write usernames and passwords in your code. Use a database
It doesnt really matter, you could MD5 the user and pass and there would be no problem.
__________________
-1PARA-AlexKall

My photography website



Reply With Quote
  #13  
Old 06-10-2004, 06:08 AM
King is offline King
Registered User

Join Date: Jun 2004
Posts: 111

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']).'"';
__________________
www.sourcefreaks.com




Reply With Quote
  #14  
Old 06-10-2004, 07:29 AM
SilentTrigger is offline SilentTrigger
-1PARA-

Join Date: Sep 2002
Location: Sweden
Posts: 3,972

Quote:
Originally posted by King*NI*
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']).'"';
Thats using a database, im talking not using a database but using a md5 hash.

$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
__________________
-1PARA-AlexKall

My photography website



Reply With Quote
  #15  
Old 06-10-2004, 08:20 AM
King is offline King
Registered User

Join Date: Jun 2004
Posts: 111

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.
__________________
www.sourcefreaks.com




Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

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


All times are GMT -5. The time now is 02:11 PM.




Powered by vBulletin®