Jump to content

New to Php and need some massive help!


bsteele11

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

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.