![]() |
|
Welcome to the Computer Webmaster Gaming Console Graphics Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact us. |
| |||||||
| PHP PHP for some can be one of the hardest website programming codes, so do you need help on your PHP script, if it is php4, php5 or lower this is the place for you for any PHP help. |
![]() |
| | LinkBack | Thread Tools | Display Modes |
| | #1 | ||
| Can someone help me it really has been a while since I have done any sort of PHP and even back then I was still learning. So anyway my problem is that I have the following script which I am trying to get to work to authorize a username and password then if it's correct write a cookie. The script is as follows: //Start of script// <?php require("vars.php"); require("functions.php"); mysql_connect($db_host, $db_username, $db_pwd) or die("couldnt connect");; mysql_select_db($db_name) or die("nah could select"); $query="SELECT * FROM wkd_members WHERE username='$uid'"; mysql_query($query); if($md5_pwd == $query[1]){ setcookie("admin[0]", $uid, time()+3600);; setcookie("admin[1]", $md5_pwd, time()+3600);; header("Location: in.php"); } else { echo('un and pwd incorrect'); } mysql_close(); ?> //End of script// The database is structures as follows: Table: wkd_members username | password Any help would be greatly appreciated. -- -- > The_Jester <-- ------------------------------------------- "Laying a carpet is... very much like making love to a beautiful woman. You check the dimensions, lay her out on the floor, pin her down, walk all over her. If you're adventurous - like me - you might like to try an underlay." - Swiss Tony | |||
|
| | #2 | ||
| In article <_UXTa.6917$T77.744820@newsfep2-win.server.ntli.net>, The_Jester <The_Jester@ntlworld.com> wrote: > Any help would be greatly appreciated. I used the method as explained on: http://www.sitepoint.com/article/319/5 It's nice because you can replace the html code with includes. But beware that as is, this code requires register_globals to be set to ON. It handles sessions well but it can be adapted to use cookies if you wish. Oh ya, you'll have to change it to use mySQL but no big deal. | |||
|
| Featured Websites | ||||
|
![]() |
| Tags: authorizing, database, mysql |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| php mysql database structure | Johnny Bagadonuts | PHP | 1 | 07-01-2007 3:32 PM |
| Connecting to MySQL database | Marco | Database | 0 | 06-26-2007 12:08 AM |
| Connecting to MySQL database | Marco | Database | 0 | 06-26-2007 12:08 AM |
| Dumping MySQl Database | Capn' Crunch | Database | 2 | 05-31-2007 8:41 PM |
| Featured Websites | ||||
|