Jump to content

Stupid string.


matthew798

Recommended Posts

Hey guys.

 

Error check:

"SELECT password FROM users WHERE username = '$_POST['username']'"

 

heres the error btw

 

Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in C:\Program Files\EasyPHP 2.0b1\www\admin\loginprocess.php on line 13

Link to comment
https://forums.phpfreaks.com/topic/123682-stupid-string/
Share on other sites

<?php
session_start();
$_SESSION['username'] = $_POST['username'];
$_SESSION['password'] = $_POST['password'];

if (!empty($_SESSION['username']) || !empty($_SESSION['password'])){
echo 'Please us the back button to enter a valid username/password';
exit();
}

include 'dbconnect.php';

$q = "SELECT password FROM users WHERE username = '$_POST['username']'";
$datapass = mysql_query($q);
or die(mysql_error()); 

if($_SESSION['password'] == $datapass){
echo 'Logging in!';
}else{
echo 'Invalid password';
and die();
} 
?>

 

And yes its secure with mysql_real_escape_string on every input

Link to comment
https://forums.phpfreaks.com/topic/123682-stupid-string/#findComment-638675
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.