Thanks ErnieAlex for the reply. Now that I think it through there are only so many tasks/commands involved - opening, reading, and writing to the database. I am guessing the SQL statement is the same. Knowing what commands are removed and what commands to replace them with, I can go through the code and swap them myself. The login script would have the open and read, maybe even a write if it updates something like a “last login date” field.
Here is the login.php code. How do I insert code so the lines are preserved.
<?php
session_start();
//* Jan3118 EdA01 - session_register deprecated, "replacement" $_SESSION['...']
//* - Replace <? with <?php
//* EdA01 session_register("user");
//* EdA01 session_register("uname");
$_SESSION = ['user', 'uname'];
//***************************************************************************
//* ASP Football Pool *
//* Do not remove this notice. *
//* Copyright 1999-2004 by Mike Hall *
//* Please see http://www.brainjar.com for documentation and terms of use. *
//* *
//* PHP Football Pool *
//* PHP Port of ASP Football pool *
//* Copyright 2005 by Brian Paulson and George Garcia *
//* Please see http://lvbash.com/phpBB2 for more support on PHPFootball *
//* version *
//* *
//* Allows a user to login. *
//***************************************************************************
$subtitle="Login";
ob_start();
require("header.php");
//Get any form data.
$football->WhoOnlineDelete;
$username=$_POST['username'];
$password=$_POST['password'];
if ($_POST)
{
//Check input.
if ($username=="") {
$football->ErrorMessage("Please enter a username.");
} elseif ($password=="") {
$football->ErrorMessage("Please enter your password.");
} else {
//Verify the password and redirect to default page if correct.
$sql="select * from ".$football->prefix."users where user = '".$username."'";
$rs = $football->dbQuery($sql,$football->database);
$row = mysql_fetch_object($rs);
$rows = mysql_num_rows($rs);
if($rows == 0) {
$football->ErrorMessage("User '".$username."' not found.");
} elseif (md5($password) != $row->password) {
$football->ErrorMessage("Incorrect password, please reenter.");
} else {
$user=$row->user;
if ($row->name =="") {
$uname=$row->user;
} else {
$uname=$row->name;
}
header("Location: index.php");
}
}
} else {
//Set test cookie.
setcookie("football","peanutbutter",0,"/",$football->domain,0);
}
?>
<form action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="post">
<table class="main" cellpadding="0" cellspacing="0">
<tr><th align="left">User Login</th></tr>
<tr>
<td>
<div class="freeForm">
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td><strong>Username:</strong></td>
<td><input name="username" value="" size="12" /></td>
</tr>
<tr>
<td><strong>Password:</strong></td>
<td><input name="password" type="password" value="" size="12" /></td>
</tr>
</table>
<p>Enter your username and password and click 'Login'.</p>
</div>
</td></tr>
</table>
<p><input class="button" type="submit" value="Login" />
<input class="button" type="reset" value="Clear" onclick="this.form.elements['username'].selectedIndex = 0; this.form.elements['password'].value = ''; return false;" />
</p>
</form>
<?php require("footer.php"); ?>
EDIT by Benanamen : Added code formatting.