Jump to content

Login


PhotonicCoder

Recommended Posts

Here is the Code:

 

<?php  
include_once("functions/databaseconnect.php"); // Include Database File
/*

****** CREATED BY Photonic ********* 
****** 1/8/2012 ***************************

*/

// Start Login Script

if(!empty($_POST['user001'])){ // If something is sent thru user input

$user = cleanQuery($_POST['user001']); // Clean Sent Info


if(!empty($_POST['pass001'])){ // If something is sent thru pass input

	$pass = cleanQuery($_POST['pass001']); // Clean Sent Info


	$q = "SELECT * FROM `Colonies001` WHERE `Username001` = '$user'"; // Select All Info from Database Where username is the one sent in user input

    $res = mysql_query($q) or die(mysql_error()); // Get SQL Resulting Information
    
    $row = mysql_fetch_array($res); // Add Information to Variable.
    
    
    
    if(!empty($res)){ // If information comes back from SQL Result
    
    $passEnc = md5($pass); // Encrypt Password for Database Usage.
  
    if($row['Passsword001']==$passEnc){ // If Database password is Equal to Encrypted Password 

		$_SESSION['account'] = $row['id']; // Set Session to Account ID for Info Retrieval.

		header("Location: ingame.php?error=Welcome Back ".$user."!"); // Send Ingame Welcome Back User!


	}else{ // Else Wrong Pass

	header("Location: index.php?error=Incorrect Account Information!"); // Send Error 

	}
	}else{ // Else Query 
		header("Location: index.php?error=Account does not Exist with that Information!"); // Send to Login Page with Error
	}
}else{
header("Location: index.php?error=You must enter a Valid Password!");
}



}else{
header("Location: index.php?error=You must enter a Valid Username!");
}
?>

Ok even tho the $row['Passsword001'] and $passEnc is the same (I have died both of them out and they ARE the same) it keeps throwing me back to line 43:

this keeps running When I know it should not be header("Location: index.php?error=Incorrect Account Information!"); // Send Error 

 

Please Help

Pho.

 

Link to comment
https://forums.phpfreaks.com/topic/254632-login/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.