Jump to content

jigsawsoul

Members
  • Posts

    137
  • Joined

  • Last visited

Everything posted by jigsawsoul

  1. thanks guys but i got it to work now thanks alot
  2. yeah errors are turn on, as it always coming up with errors unless it works, yeah i have done echo $eventid exit; and it displays the id just fine. so isit writte right or just a weird problem ?
  3. hey thanks for all the help first off, this a easy question for you guys i know but i thought it was right bu its not working, this this the right way to write this? as its not work but no errors just don't carry the id. $eventid = $row['event_id']; $form .= ' <div id="form_accountinfo" class="mb"> <form action="buy2.php?id='.$eventid.'" method="post">
  4. Hey fella, check out this have a go and if you come across any problems just posted up the problems you have. http://net.tutsplus.com/tutorials/php/how-to-paginate-data-with-php/ do this !
  5. fixed it thanks so much i had to change =! 'active' to == 'disabled' if you want to check the code its below thanks. function authenticateUser ($username, $password) { $result = "SELECT * FROM gb_login WHERE username = '$username' AND password = '$password'"; $result = mysql_query ($result) or die (mysql_error()); $row = mysql_fetch_assoc ($result); if ($row['userstatus']=='active'){ if (mysql_num_rows($result) == 1){ switch ($row['userlevel']) { case "1": // The username and password match, // Set the session as ADMIN. $_SESSION['admin_logged_in'] = true; $_SESSION['username'] = $username; // After login move logged in page header ('Location: ../admin/index.php'); break; case "2": // The username and password match, // Set the session as USER. $_SESSION['user_logged_in'] = true; $_SESSION['username'] = $username; // After login move loged in page header ('Location: ../public/index.php'); break; } } } else { $sql = "SELECT `userstatus` FROM `gb_login` WHERE `username`='$username' AND `password`= '$password' LIMIT 1;"; $result = mysql_query($sql); $row = mysql_fetch_assoc($result); $userstatus = $row['userstatus']; if ($userstatus == 'disabled'){ // Set error message $_SESSION["message"] = '<div class="error mb">Login failed, your account has been disabled, contact admin.</div>'; // After error message move to login.php header ('Location: ../login/login.php'); } else { // The username and password doesn't match // Set error message $_SESSION["message"] = '<div class="error mb">Login failed. Please try again or <a href="recover.php">reset your password</a>.</div>'; // After error message move to login.php header ('Location: ../login/login.php'); } } }
  6. Ahh i don't know whats happening thanks for the help but it seems like even there is no user in the database with that username and password i still get (Login failed, your account has been disabled, contact admin.) i don't seem to understand why this is happening, im no master at php like most you guys but i just can't see the answer to solve this problem. thanks alot. where the code stands right now. function authenticateUser ($username, $password) { $result = "SELECT * FROM gb_login WHERE username = '$username' AND password = '$password'"; $result = mysql_query ($result) or die (mysql_error()); $row = mysql_fetch_assoc ($result); if ($row['userstatus']=='active'){ if (mysql_num_rows($result) == 1){ switch ($row['userlevel']) { case "1": // The username and password match, // Set the session as ADMIN. $_SESSION['admin_logged_in'] = true; $_SESSION['username'] = $username; // After login move logged in page header ('Location: ../admin/index.php'); break; case "2": // The username and password match, // Set the session as USER. $_SESSION['user_logged_in'] = true; $_SESSION['username'] = $username; // After login move loged in page header ('Location: ../public/index.php'); break; } } } else { $sql = "SELECT `userstatus` FROM `gb_login` WHERE `username`='$username' AND `password`= '$password' LIMIT 1;"; $result = mysql_query($sql); $row = mysql_fetch_assoc($result); $userstatus = $row['userstatus']; if ($userstatus != 'active'){ // Set error message $_SESSION["message"] = '<div class="error mb">Login failed, your account has been disabled, contact admin.</div>'; // After error message move to login.php header ('Location: ../login/login.php'); } else { // The username and password doesn't match // Set error message $_SESSION["message"] = '<div class="error mb">Login failed. Please try again or <a href="recover.php">reset your password</a>.</div>'; // After error message move to login.php header ('Location: ../login/login.php'); } } }
  7. AHH thanks alot, but i have a problem even if the account is not disabled and i only get the password wrong or username i stil get the message saying your account has been disabled. but if you enter a username and password that is active it lets you in, but im not getting the last else to seem to work right. any help
  8. Hey, im new to php and studying it for my uni coursework, i having some touble with with my code i have a error saying: Parse error: syntax error, unexpected T_ELSE in ../library/functions/f_login.php on line 38 function authenticateUser ($username, $password) { $result = "SELECT userlevel FROM gb_login WHERE username = '$username' AND password = '$password'"; $result = mysql_query ($result) or die (mysql_error()); $row = mysql_fetch_assoc ($result); if ($row['userstatus']=='active'){ if (mysql_num_rows($result) == 1){ switch ($row['userlevel']) { case "1": // The username and password match, // Set the session as ADMIN. $_SESSION['admin_logged_in'] = true; $_SESSION['username'] = $username; // After login move logged in page header ('Location: ../admin/index.php'); break; case "2": // The username and password match, // Set the session as USER. $_SESSION['user_logged_in'] = true; $_SESSION['username'] = $username; // After login move loged in page header ('Location: ../public/index.php'); break; } } else { // The username and password doesn't match // Set error message $_SESSION["message"] = '<div class="error mb">Login failed. Please try again or <a href="recover.php">reset your password</a>.</div>'; // After error message move to login.php header ('Location: ../login/login.php'); } else { // Set error message $_SESSION["message"] = '<div class="error mb">Login failed, your account has been disabled, contact admin.</div>'; // After error message move to login.php header ('Location: ../login/login.php'); }
×
×
  • 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.