jsucupira Posted August 30, 2007 Share Posted August 30, 2007 I was having problems with my login script could someone help me. <? include "library/session.php"; $dbservertype='mysql'; $servername='localhost'; $dbusername='root'; $dbpassword='ace'; $dbname='tallynightlife'; connecttodb($servername,$dbname,$dbusername,$dbpassword); function connecttodb($servername,$dbname,$dbuser,$dbpassword) { global $link; $link=mysql_connect ("$servername","$dbuser","$dbpassword"); if(!$link){die("Could not connect to MySQL");} mysql_select_db("$dbname",$link) or die ("could not open db".mysql_error()); } ////////////////////////////// ?> <!doctype html public "-//w3c//dtd html 3.2//en"> <html> <head> <title>Loginck</title> <meta name="GENERATOR" content="Arachnophilia 4.0"> <meta name="FORMATTER" content="Arachnophilia 4.0"> </head> <body bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#800080" alink="#ff0000"> <? $userid=mysql_real_escape_string($userid); $password=mysql_real_escape_string($password); if($rec=mysql_fetch_array(mysql_query("SELECT * FROM userid WHERE userid='$userid' AND password = '$password'"))){ if(($rec['userid']==$userid)&&($rec['password']==$password)){ include "include/newsession.php"; echo "<p class=data> <center>Successfully,Logged in<br><br><a href='logout.php'> Log OUT </a><br><br><a href=welcome.php>Click here if your browser is not redirecting automatically or you don't want to wait.</a><br></center>"; print "<script>"; print " self.location='welcome.php';"; print "</script>"; } } else { session_unset(); echo "<font face='Verdana' size='2' color=red>Wrong Login. Use your correct Userid and Password and Try <br><center><input type='button' value='Retry' onClick='history.go(-1)'></center>"; } ?> ---------------------------------------------------- <?php session_start(); session_register("session"); ?> ------------------------------------- <? include "library/session.php"; session_unset(); session_destroy(); ?> <!doctype html public "-//w3c//dtd html 3.2//en"> <html> <head> <title>(Type a title for your page here)</title> <meta name="GENERATOR" content="Arachnophilia 4.0"> <meta name="FORMATTER" content="Arachnophilia 4.0"> </head> <body bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#800080" alink="#ff0000"> <? echo "<center><font face='Verdana' size='2' >Successfully logged out. <br><br> <a href=login.php>Login</a></font></center>"; ?> ------------------------------ <?php //error_reporting(E_ERROR | E_PARSE | E_CORE_ERROR); $session['id']=session_id(); $session['userid']=$userid; //echo $session['userid']; ?> I appreciate any help. Quote Link to comment Share on other sites More sharing options...
Jessica Posted August 30, 2007 Share Posted August 30, 2007 What is the problem? What are all these bits of code? Quote Link to comment Share on other sites More sharing options...
jsucupira Posted August 30, 2007 Author Share Posted August 30, 2007 they do not work, they are not accessing mysql to get the usernames. also part of the code is showing up in the brower like this one for loginck.php :Successfully,Logged in Log OUT Click here if your browser is not redirecting automatically or you don't want to wait. "; print ""; } } else { session_unset(); echo "Wrong Login. Use your correct Userid and Password and Try "; } ?> these bits of codes are what my login script is calling: when I have includes "library/session.php": Quote Link to comment Share on other sites More sharing options...
jsucupira Posted August 31, 2007 Author Share Posted August 31, 2007 can anyone help me with this one? Quote Link to comment Share on other sites More sharing options...
phpSensei Posted August 31, 2007 Share Posted August 31, 2007 edit: nvm. Quote Link to comment Share on other sites More sharing options...
phpSensei Posted August 31, 2007 Share Posted August 31, 2007 SELECT * FROM userid WHERE userid='$userid' AND password = '$password' why is both table name and userid the same? 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.