Jump to content

Login problem


hank__22

Recommended Posts

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
Share on other sites

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
Share on other sites

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
Share on other sites

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
Share on other sites

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
Share on other sites

 

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.