Jump to content

[SOLVED] php not executing code: error?


snowman15

Recommended Posts

My code isnt doing anything. It should at least get to either one of the forwards to the other pages but it doesnt get to them. does my code have an error in it?

I'm using all php and Mysql 5.0+

Does mysqli have to be turned on to use it or does php mysql 5.0+ have mysqli already active?

 

 

<?php
session_start();
include('db.php');
$user=$_POST['user'];
$pass=$_POST['pass'];
$sql = 'SELECT * FROM `users` WHERE `user` LIKE CONVERT(_utf8 \''.$user.'\' USING latin1) COLLATE latin1_swedish_ci AND `pass` LIKE CONVERT(_utf8 \''.$pass.'\' USING latin1) COLLATE latin1_swedish_ci';
$result = $db->query($sql);
$row = mysqli_fetch_assoc($result);
$todaysdate=floor((((time()/60)/60)/24));
if (mysqli_num_rows($result)==0){$_SESSION['error']="Username/Password Not Found   "; header('Location: /index.php'); exit;}
elseif($row['approved']=="n"){$_SESSION['error']="Your account is not activated. To Reactivate your account, <br>contact me by submitting a question <a href='question.php'>here.</a>"; $_SESSION['question']="Example: Hey I need my account activated. Please send me more information with the email I entered or give me a call at 555-555-5555. Thanks!";header('Location: /index.php'); exit;}
elseif(($row['exday']-$todaysdate)<0){$_SESSION['error']="Your account has expired. To add more time, <br>submit a question by clicking on the link below.";header('Location: /index.php'); }
else{ //START LOGIN PROCESS
$_SESSION['user']="$user"; 
$_SESSION['name']=$row['fname'].' '.$row['lname'];
header('Location: /home.php');
}
?>

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.