Jump to content

Recommended Posts

I know the code for the $username and $password are totally wrong but I can't find the correct code to use and I've gone over the chapter it's suppose to be in (I'm a college student) please please help. The part that is way wrong is bold and underlined but there are probably other errors. Thank you.

 

<?php

ob_start(); //research the use of this

session_start(); //needed to create sessions - maintaining state is discussed above.

ini_set('display_errors', 1); //turn on errors, use for debugging.

 

$username = \"".$UserName."\";"; //refer to the superglobal arrays section above

$password = \"".$Password."\";";

$authorized = false;

 

require ('$db');

 

$sql = 'SELECT * from Login';

 

$rs = $conn->Execute($sql);

 

//Using a While looping structure to check each record in the database

 

while (!$rs->EOF) {

if ($rs->Fields["UserName"]->Value=="$username" && $rs->Fields["Password"]->Value=="$password") {

$_SESSION['auth'] = $rs->Fields['Auth']->Value;

$_SESSION['username'] = $rs->Fields['UserName']->Value;

$authorized = true;


$rs->MoveNext();

}

# close the connection

$rs->Close();

$conn->Close();

 

$rs = null;

$conn = null;

 

if (!$authorized) {

header('Location: login.php'); // see pseudocode for authorize.php

exit();

} else {

header('Location: index.php');

exit();

}

 

?>

Link to comment
https://forums.phpfreaks.com/topic/295000-new-to-php-and-need-some-massive-help/
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.