Jump to content

SilverNova

Members
  • Posts

    23
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

SilverNova's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. WOOOO Thanks guys, very very much appreciated  ;D ;D
  2. Argh omw, was filling it in automatically for a while using FF... but now that it's resolved - what script can i finally use?! :D Many thanks for all your help - i'll be sure to link back to you from all my sites in future!!  ;D
  3. [code] login failed DEBUG INFO: Username: test Password: tets Password Hash: 45edd741812abf42a7b799a6fc558d9c MD5 Hash of 'test': 098f6bcd4621d373cade4e832627b4f6 MD5 Hash TEST: failed Query: SELECT * FROM users WHERE username='test' AND `password`='45edd741812abf42a7b799a6fc558d9c' [/code] TETS?! this means..?
  4. Nope. sorry  :-\ [code] <?php session_start(); $username = $_POST["username"]; //get the username from the form, as $username $password = md5($_POST["password"]); //get the password from the form in md5 $users = mysql_connect("localhost", "lov3dco_users", "test");     if(!$users) {           echo "<p>Sorry! We could not log you in at this time. Please Try again later!</p>";           exit();         } mysql_select_db("lov3dco_users");  //select what database to use $username = mysql_real_escape_string($username); $password = mysql_real_escape_string($password); $recieve = "SELECT * FROM users WHERE username =  '$username' AND password = '$password';"; $query = mysql_query($recieve) or die("Unable to peform query - " . mysql_error()); //do the query if(mysql_num_rows($query) == '1'){     echo "login successful"; }else {     echo "login failed"; } ?> [/code] gives login failed
  5. try again - i got parse error = the echo, login successful I know you mean "if" obviously.. :P
  6. Yeah, "login failed" Here's my table just in case.. [img]http://www.lov3d.com/testdb.png[/img]
  7. Ok, test.php now looks exactly like the above and returns a blank page.. Think businessman just put them in earlier to differentiate what was going on
  8. changed php.ini [code] ; Lifetime in seconds of cookie or, if 0, until browser is restarted. session.cookie_lifetime = 0 [/code] to [code] ; Lifetime in seconds of cookie or, if 0, until browser is restarted. session.cookie_lifetime = 2400 [/code] and test.php now looks like this after taking out the echo: [code] <?php session_start(); ?> <?php $username = $_POST["username"]; //get the username from the form, as $username $password = md5($_POST["password"]); //get the password from the form in md5 $users = mysql_connect("localhost", "lov3dco_users", "test");     if(!$users) {           echo "<p>Sorry! We could not log you in at this time. Please Try again later!</p>";           exit();         } echo "test3"; mysql_select_db("lov3dco_users");  //select what database to use $username = mysql_real_escape_string($username); $password = mysql_real_escape_string($password); $recieve = "SELECT * FROM users WHERE username =  '$username' AND password = '$password';"; $query = mysql_query($recieve) or die("Unable to peform query - " . mysql_error()); //do the query echo "test4"; if($rows = mysql_num_rows($query)){     $_SESSION['password'] = $password; //store the users password in a sesions var     $_SESSION['username'] = $username; //store the username in a session var $page = "index.php";    header('Location: ' . $page); }else { echo "test6";     session_destroy(); } ?>[/code] Still blank, apart from the echo's - http://lov3d.com/test.htm
  9. I changed it to: [code] <?php session_start(); ?> <?php echo "test1"; $username = $_POST["username"]; //get the username from the form, as $username $password = md5($_POST["password"]); //get the password from the form in md5 [/code] ..etc. Still nothing..
  10. I've never had to use php.ini before, all I know is that it's a global set of events etc You're welcome to have a look - http://lov3d.com/php.ini I presume it's in the right place, I took it from php.net after being told I should use (well, open) it. I don't seem to have a php.ini file elsewhere on my server unless i'm not looking in the right places. It's not the .htaccess :\ - it's blank at the moment
  11. [img]http://www.lov3d.com/test.png[/img] That's what I have. Also, why can't i see this warning message?!!!? I'm using FF, all I get after login is: "test1test3test4test6" on the test.php page :\ ???
  12. yeah it is encoded with md5 in the table the password field for the row is 098f6bcd4621d373cade4e832627b4f6.. which = "test" there are other fields which just have blank entries so this shouldn't matter? like "email" for their email address etc.
  13. http://lov3d.com/test.htm They all show.. :\ I thought test 2 didnt but realised you went 1,3,4.. :P See your sig - I had a brief look around  :)
  14. Well, i'm expecting to be logged in and thus redirected to the main page - index.php But nothing is happening - just a blank page. Try it if you like, i'm using the script businessman has last posted. http://www.lov3d.com/test.htm Username = test Password = test Any ideas? Many thanks for the help so far guys Form page: (test.htm) [code] <html> <form action="test.php" method="post"> Username: <input type="text" name="username" size="30"><br><br> Password: <input type="password" name="password" size="30"><br><br> <input type="submit" value="Login!"> </form> </html> [/code] Processor Page: (test.php) [code] <?php session_start(); //start a sessions :D $username = $_POST["username"]; //get the username from the form, as $username $password = md5($_POST["password"]); //get the password from the form in md5 $users = mysql_connect("localhost", "lov3dco_users", "test");     if(!$users) {           echo "<p>Sorry! We could not log you in at this time. Please Try again later!</p>";           exit();         } mysql_select_db("lov3dco_users");  //select what database to use $username = mysql_real_escape_string($username); $password = mysql_real_escape_string($password); $recieve = "SELECT * FROM users WHERE username =  '$username' AND password = '$password';"; $query = mysql_query($recieve) or die("Unable to peform query - " . mysql_error()); //do the query if($rows = mysql_num_rows($query)){     $_SESSION['password'] = $password; //store the users password in a sesions var     $_SESSION['username'] = $username; //store the username in a session var $page = "index.php";    header('Location: ' . $page); }else {     session_destroy(); } ?> [/code]
  15. [quote author=businessman332211 link=topic=102574.msg407287#msg407287 date=1154445340] I found the problem [code]<?php session_start(); //start a sessions :D $username = $_POST["username"]; //get the username from the form, as $username $password = md5($_POST["password"]); //get the password from the form in md5 $users = mysql_connect("localhost", "lov3dco_users", "test");     if(!$users) {           echo "<p>Sorry! We could not log you in at this time. Please Try again later!</p>";           exit();         } mysql_select_db("lov3dco_users");  //select what database to use $username = mysql_real_escape_string($username); $password = mysql_real_escape_string($password); $recieve = "SELECT * FROM users WHERE username =  '$username' AND password = '$password';"; $query = mysql_query($recieve) or die("Unable to peform query - " . mysql_error()); //do the query if($rows = mysql_fetch_array($query)){     $_SESSION['password'] = $password; //store the users password in a sesions var     $_SESSION['username'] = $username; //store the username in a session var $page = "index.php";    header('Location: ' . $page); }else {     session_destroy(); } ?>[/code] Use exactly what I show above, I changed mysql_num_rows to mysql_fetch_array that should make it run smoothly.  don't forget to upload the php.ini file, ti's not showing your errors.  Either that or your host doesn't support it. [/quote] I tried the exact code you used above and the one previous, businessman. It's STILL not showing anything wrong!!! My php.ini file is in the same directory as test.php and all files are in the main directory anyway. This is what test.htm looks like [code] <html> <form action="test.php" method="post"> Username: <input type="text" name="username" size="30"><br><br> Password: <input type="password" name="password" size="30"><br><br> <input type="submit" value="Login!"> </form> </html> [/code] Nothing wrong there, right? But yeah, still blank :\ This is getting very frustrating now ???
×
×
  • 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.