Hello All,
I am totally new to php and really to any code writing so please be gentle =-)
I am trying to write a simple login script to password protect a site we are working on, I have used the tutorial in this forum for creating a simple login and I continue to get errors.
So this is what I have written ...
<?php mysql_connect('h41mysql63.secureserver.net', 'monkeyJin', 'xxxxxxx') or die(mysql_error()); mysql_select_db('monkeyJin') or die(mysql_error()); if(isset($_COOKIE['ID_my_site'])){ $username = $_COOKIE['ID_my_site']; $pass = $_COOKIE['Key_my_site']; $check = mysql_query("SELECT * FROM users WHERE username = '$username'")or die(mysql_error()); while($info = mysql_fetch_array( $check )) { if ($pass != $info['password']) { } else { header("Location: members.php"); } }}if (isset($_POST['submit'])) { if(!$_POST['username'] | !$_POST['pass']) {die('You did not fill in a required field.');}if(!get_magic_quotes_gpc()) {$_POST['email'] = addslashes($_POST['email']);}$check = mysql_query("SELECT * FROM users WHERE username = '".$_POST['username']."'")or die(mysql_error());$check2 = mysql_num_rows($check);if ($check2 == 0) { die('That user does not exist in our database. <a href=add.php>Click Here to Register</a>'); }while($info = mysql_fetch_array( $check )){$_POST['pass'] = stripslashes($_POST['pass']);$info['password'] = stripslashes($info['password']);$_POST['pass'] = md5($_POST['pass']);}if ($_POST['pass'] != $info['password']) {die('Incorrect password, please try again.');}else { $_POST['username'] = stripslashes($_POST['username']); $hour = time() + 3600; setcookie(ID_my_site, $_POST['username'], $hour); setcookie(Key_my_site, $_POST['pass'], $hour); header("Location: members.php"); } } else { ?>And the error I get is - Any help would be so appreciated!!!! Thanks in advance!