the apprentice webmaster Posted April 3, 2006 Share Posted April 3, 2006 guy i have a members database like that first_name varchar(50) NO last_name varchar(50) NO email_address varchar(50) NO signup_date datetime NO verified enum('0','1') NO 0 last_login datetime NO bio tinytext NO admin_access enum('0','1') NO 0 username varchar(50) NO passwordok guys , now i wanna create the admistrator username and password so that i can sign in as a administrator , how can i insert the username n passwors in the members tab , so can anyone tell me how to do this , i am a newbie with lots of interest in php n mysql , thx i'll be waiting for your reply thx Quote Link to comment Share on other sites More sharing options...
the apprentice webmaster Posted April 3, 2006 Author Share Posted April 3, 2006 [!--quoteo(post=361119:date=Apr 3 2006, 01:27 AM:name=apprentice webmaster)--][div class=\'quotetop\']QUOTE(apprentice webmaster @ Apr 3 2006, 01:27 AM) [snapback]361119[/snapback][/div][div class=\'quotemain\'][!--quotec--]guy i have a members database like that first_name varchar(50) NO last_name varchar(50) NO email_address varchar(50) NO signup_date datetime NO verified enum('0','1') NO 0 last_login datetime NO bio tinytext NO admin_access enum('0','1') NO 0 username varchar(50) NO passwordok guys , now i wanna create the admistrator username and password so that i can sign in as a administrator , how can i insert the username n passwors in the members tab , so can anyone tell me how to do this , i am a newbie with lots of interest in php n mysql , thx i'll be waiting for your reply thx[/quote]no one can help me on that subject ?.......... Quote Link to comment Share on other sites More sharing options...
Desdinova Posted April 3, 2006 Share Posted April 3, 2006 do you have a login script?and do you want this query to be for PHP? Quote Link to comment Share on other sites More sharing options...
the apprentice webmaster Posted April 3, 2006 Author Share Posted April 3, 2006 [!--quoteo(post=361124:date=Apr 3 2006, 02:16 AM:name=Desdinova)--][div class=\'quotetop\']QUOTE(Desdinova @ Apr 3 2006, 02:16 AM) [snapback]361124[/snapback][/div][div class=\'quotemain\'][!--quotec--]do you have a login script?and do you want this query to be for PHP?[/quote]here's the login script <?phpinclude $_SERVER['DOCUMENT_ROOT']. '/bpo/layout.php';switch($_REQUEST['req']){ case "validate": $validate = mysql_query("SELECT * FROM members WHERE username='{$_POST['username']}' AND password = md5('{$_POST['password']}') AND verified='1' ") or die (mysql_error()); if(mysql_num_rows($validate) == 1){ while($row = mysql_fetch_assoc($validate)){ $_SESSION['login'] = true; $_SESSION['userid'] = $row['id']; $_SESSION['first_name'] = $row['first_name']; $_SESSION['last_name'] = $row['last_name']; $_SESSION['email_address'] = $row['email_address']; $_SESSION['cid'] = $row['cart_id']; setcookie('cid', $unique_cid, time()+24*3600*60); if($row['admin_access'] == 1){ $_SESSION['admin'] = true; } $login_time = mysql_query("UPDATE members SET last_login=now() WHERE id='{$row['id']}'"); } header("Location: /bpo/login.php"); } else { myheader("Login Failed!"); echo '<p align="center">Login Failed</p>'; echo '<p align="center">If you have already joined '. 'our website, you may need to validate your email '. 'address. Please check your email for instructions.'; footer(); }break;default: myheader("Login!"); include $_SERVER['DOCUMENT_ROOT']. '/bpo/html/forms/login_form.html'; footer();break;}?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.