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