I have no idea why this doesn't work, but it just doesn't!
$usern = mysql_real_escape_string($_POST['usern']);
$passw = hash('sha512', mysql_real_escape_string($_POST['passw']));
$query = "SELECT id FROM user_list WHERE usern='$usern' AND passw='$passw'";
$r = @mysql_query($query, $dbc);
if (mysql_num_rows($r)) {
$_SESSION['loggedin'] = true;
$_SESSION['usern'] = $usern;
}
if ($_SESSION['loggedin']) {
header('Location: index.php');
die;
} else {
die('The entered username or password did not match those on file!');
}Somebody please help!!!!!
Offline
What error are you getting?
Edit: Pff 3 seconds after W.E.
Last edited by Magnie (2011-11-04 15:41:24)
Offline
I'm not getting any error message, I'm just getting the message that says that my username and password are incorrect, even though I know they are correct.
Offline
Well, for $r drop the ', $dbc' part and see what happens.
Offline
Magnie wrote:
Well, for $r drop the ', $dbc' part and see what happens.
Nope. That's not it.
Offline
Okay, echo the $usern, $passw, and mysql_num_rows($r)
Offline
I don't think you can use that header() function in the code.
Offline
I've got a problem too:
<link rel="stylesheet" type="text/css" href="global.css" />
<?php
session_start();
if ($_SESSION['loggedin']) {
include "demo.html";
include "connect.php";
$username = $_SESSION['username'];
if ($_POST['sendmessage']) {
$to = $_POST['to'];
$message = strip_tags($_POST['message']);
mysql_query("INSERT INTO messages (From:, Message:, reciever)
VALUES ('$username', '$message', '$to')");
header('Location: http://plaxon.comyr.com/index32.php');
}
} else {
header('Location: http://plaxon.comyr.com/error2.php');
}
?>It never seems to run the MYSQL UPDATE code, with of without the , $con at the end
Offline
Magnie wrote:
Okay, echo the $usern, $passw, and mysql_num_rows($r)
The mysql_num_rows($r) echo said "0"
Offline
WindowsExplorer wrote:
I've got a problem too:
Code:
<link rel="stylesheet" type="text/css" href="global.css" /> <?php session_start(); if ($_SESSION['loggedin']) { include "demo.html"; include "connect.php"; $username = $_SESSION['username']; if ($_POST['sendmessage']) { $to = $_POST['to']; $message = strip_tags($_POST['message']); mysql_query("INSERT INTO messages (From:, Message:, reciever) VALUES ('$username', '$message', '$to')"); header('Location: http://plaxon.comyr.com/index32.php'); } } else { header('Location: http://plaxon.comyr.com/error2.php'); } ?>It never seems to run the MYSQL UPDATE code, with of without the , $con at the end
![]()
Don't use colons for columns.
ohaiderstudios: Echo the $usern and make sure $passw has data in it.
Last edited by Magnie (2011-11-04 17:25:25)
Offline
Magnie wrote:
WindowsExplorer wrote:
I've got a problem too:
Code:
<link rel="stylesheet" type="text/css" href="global.css" /> <?php session_start(); if ($_SESSION['loggedin']) { include "demo.html"; include "connect.php"; $username = $_SESSION['username']; if ($_POST['sendmessage']) { $to = $_POST['to']; $message = strip_tags($_POST['message']); mysql_query("INSERT INTO messages (From:, Message:, reciever) VALUES ('$username', '$message', '$to')"); header('Location: http://plaxon.comyr.com/index32.php'); } } else { header('Location: http://plaxon.comyr.com/error2.php'); } ?>It never seems to run the MYSQL UPDATE code, with of without the , $con at the end
![]()
Don't use colons for columns.
ProgrammingFreak: Echo the $usern and make sure $passw has data in it.
Me?
Offline
ProgrammingFreak wrote:
Magnie wrote:
WindowsExplorer wrote:
I've got a problem too:
Code:
<link rel="stylesheet" type="text/css" href="global.css" /> <?php session_start(); if ($_SESSION['loggedin']) { include "demo.html"; include "connect.php"; $username = $_SESSION['username']; if ($_POST['sendmessage']) { $to = $_POST['to']; $message = strip_tags($_POST['message']); mysql_query("INSERT INTO messages (From:, Message:, reciever) VALUES ('$username', '$message', '$to')"); header('Location: http://plaxon.comyr.com/index32.php'); } } else { header('Location: http://plaxon.comyr.com/error2.php'); } ?>It never seems to run the MYSQL UPDATE code, with of without the , $con at the end
![]()
Don't use colons for columns.
ProgrammingFreak: Echo the $usern and make sure $passw has data in it.Me?
Sorry meant ohaiderstudios
Offline
Magnie wrote:
ProgrammingFreak wrote:
Magnie wrote:
Don't use colons for columns.
ProgrammingFreak: Echo the $usern and make sure $passw has data in it.Me?
Sorry meant ohaiderstudios
![]()
Okay,
Offline
ohaiderstudios wrote:
both $usern and $passw have values
Have you opened the database ( with phpMyAdmin or something ) and checked the values manually ( with your eyes )?
Try changing SELECT id to SELECT *
Offline
I've figured it out! The SHA512 hash produced more characters than the database stored. The field was marked VARCHAR(50), but the hash produced a larger number of characters! Problem solved!
Offline
ohaiderstudios wrote:
I've figured it out! The SHA512 hash produced more characters than the database stored. The field was marked VARCHAR(50), but the hash produced a larger number of characters! Problem solved!
Cheers!
Offline
no one answered my question, so don't close this yet
I still didn't get mine fixed
Offline
WindowsExplorer wrote:
no one answered my question, so don't close this yet
I still didn't get mine fixed
Actually, Magnie wrote:
Magnie wrote:
Don't use colons for columns.
Offline
ohaiderstudios wrote:
WindowsExplorer wrote:
no one answered my question, so don't close this yet
I still didn't get mine fixed
Actually, Magnie wrote:
Magnie wrote:
Don't use colons for columns.
still not working
Offline
WindowsExplorer wrote:
ohaiderstudios wrote:
WindowsExplorer wrote:
no one answered my question, so don't close this yet
I still didn't get mine fixed
Actually, Magnie wrote:
Magnie wrote:
Don't use colons for columns.
still not working
![]()
Change the actual column and the code, when I look at your database it has "From:" and "Content:" also, make sure the first letter is lowercase.
Offline
Magnie wrote:
WindowsExplorer wrote:
ohaiderstudios wrote:
WindowsExplorer wrote:
no one answered my question, so don't close this yet
I still didn't get mine fixed
Actually, Magnie wrote:
still not working
![]()
Change the actual column and the code, when I look at your database it has "From:" and "Content:" also, make sure the first letter is lowercase.
stop looking at my database already!
Offline
WindowsExplorer wrote:
Magnie wrote:
WindowsExplorer wrote:
still not working![]()
Change the actual column and the code, when I look at your database it has "From:" and "Content:" also, make sure the first letter is lowercase.
stop looking at my database already!
![]()
Okay, sorry, but did you get it working?
Offline