Jump to content

Need Help login system Newbie here


saltpetre

Recommended Posts

hey

What am i doing wrong here.

I got this code from a site and i followed the instruction to the teeth. But it's not working. I had modified it but still not working.

The Problem is that after the user enters the user name and pass the user does not get redirect to main.php instead it just sits there with a blank page and the url reads http://localhost/re/userlogin.php (where userlogin.php is the page where the user types his user and pass.



This is the orginal code:
<?php
// we must never forget to start the session
session_start();

$errorMessage = '';
if (isset($_POST['txtUserId']) && isset($_POST['txtPassword'])) {
// first check if the number submitted is correct
$number = $_POST['txtNumber'];

if (md5($number) == $_SESSION['image_random_value']) {
include 'settings/config.php';
include 'settings/opendb.php';

$userId = $_POST['txtUserId'];
$password = $_POST['txtPassword'];


// check if the user id and password combination exist
$sql = "SELECT user_id
FROM tbl_auth_user
WHERE user_id = '$userId'
AND user_password = PASSWORD('$password')";

$result = mysql_query($sql) or
die('Query failed. ' . mysql_error());

if (mysql_num_rows($result) == 1) {
// the user id and password match,
// set the session
$_SESSION['image_is_logged_in'] = true;


// remove the random value from session
$_SESSION['image_random_value'] = '';

// after login we move to the main page
header('Location: http://qts-corp.com');

exit();
}
else {
$errorMessage = 'Sorry, wrong user id / password';
}

include 'settings/closedb.php';
}
else {
$errorMessage = 'Sorry, wrong number. Please try again';
}
}
?>

If anyone can help , it would be much appreciated.
Thanks
Link to comment
Share on other sites

here try looking at this.

find the php code and try and learn from it and you should be okay mate.

else if you cant try search php on pixel2life.com and search the member system options no the left side of the screen.

[attachment deleted by admin]
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.