hank__22 Posted May 21, 2007 Share Posted May 21, 2007 Hi there, I'm using a pre-made login script from http://www.phpeasystep.com/phptu/6.html. I've filled in all the places I need to change but when I try and login I get this message: Warning: mysql_connect(): Access denied for user: 'mike401c@df53' (Using password: YES) in /home/mike401c/public_html/access/checklogin.php on line 19 cannot connect I'm not too sure what it means? Could someone explain to me whats going wrong? Link to comment https://forums.phpfreaks.com/topic/52327-login-problem/ Share on other sites More sharing options...
base836ball Posted May 21, 2007 Share Posted May 21, 2007 Sounds like your being able to connect to your database. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); I'm guessing you have $host = "localhost" $username = "mike401c@df53" $password = "whatever your sql password is" Im just making sure thats all. Logically without looking at your code it sounds like your doing it right. Can you paste in your checklogin.php code? Link to comment https://forums.phpfreaks.com/topic/52327-login-problem/#findComment-258197 Share on other sites More sharing options...
hank__22 Posted May 21, 2007 Author Share Posted May 21, 2007 the code is: <?php $host="mike401.com"; // Host name $username="mike401c"; // Mysql username $password="password"; // Mysql password $db_name="mike401c_members"; // Database name $tbl_name="members"; // Table name // Connect to server and select databse. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); // username and password sent from signup form $myusername=$_POST['myusername']; $mypassword=$_POST['mypassword']; $sql="SELECT * FROM $tbl_name WHERE username='$myusername' and password='$mypassword'"; $result=mysql_query($sql); // Mysql_num_row is counting table row $count=mysql_num_rows($result); // If result matched $myusername and $mypassword, table row must be 1 row if($count==1){ // Register $myusername, $mypassword and redirect to file "login_success.php" session_register("myusername"); session_register("mypassword"); header("location:login_success.php"); } else { echo "Wrong Username or Password"; } ?> obviously password is not actually 'password'. Link to comment https://forums.phpfreaks.com/topic/52327-login-problem/#findComment-258226 Share on other sites More sharing options...
base836ball Posted May 21, 2007 Share Posted May 21, 2007 hmmm well i just dont know lol....its clearly not connecting though. a value in one of these has to be wrong $host="mike401.com"; // Host name $username="mike401c"; // Mysql username $password="password"; // Mysql password $db_name="mike401c_members"; // Database name $tbl_name="members"; // Table name if you are uploading to someone server you might want to make the host = localhost Link to comment https://forums.phpfreaks.com/topic/52327-login-problem/#findComment-258255 Share on other sites More sharing options...
hank__22 Posted May 21, 2007 Author Share Posted May 21, 2007 seems local host is "localhost" But now I get this error: Warning: session_register(): Cannot send session cookie - headers already sent by (output started at .... etc What does this mean? Or is there a better place where I can get php login scripts? Link to comment https://forums.phpfreaks.com/topic/52327-login-problem/#findComment-258629 Share on other sites More sharing options...
spode Posted May 22, 2007 Share Posted May 22, 2007 There's a really good one at www.pscode.com Just do a search for it. It's more complex than that one though. Link to comment https://forums.phpfreaks.com/topic/52327-login-problem/#findComment-259451 Share on other sites More sharing options...
farkewie Posted May 29, 2007 Share Posted May 29, 2007 Warning: session_register(): Cannot send session cookie - headers already sent by (output started at .... etc What does this mean? in my experiance the above error means you have a trailing spaceafter your closing php tag ?> just backspace all the back make sure there are no space there. Link to comment https://forums.phpfreaks.com/topic/52327-login-problem/#findComment-263714 Share on other sites More sharing options...
thegod Posted May 30, 2007 Share Posted May 30, 2007 or that could mean they is code before the session regiter only the <?php tag should be before it Link to comment https://forums.phpfreaks.com/topic/52327-login-problem/#findComment-264635 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.