Hi all, I am trying output the following 1 user after validating data from a database and I have no output to the screen.
I am not sure what is missing from query?
Any help would be appreciated
Thanks in advance
David
------- Index.php ------
<?php
session_start();
ob_start();
include_once ("includes/settings.php");
include("includes/functions/functions.php");
$Errors = "";
$_SESSION['LoggedIn'] = false;
$_SESSION['UserID'] = "";
$_SESSION['UserAdmin'] = false;
if ($_POST['Submitted'] == "true") {
// process submitted data
$userSQL = $Database->Execute("SELECT UserID, UserFullname, UserEmail, UserLastPassword
FROM Users WHERE UserName = '" . mysql_real_escape_string($Text->ValidSQLString($_POST['Username'])) . "'
AND UserPassword = '" . md5($_POST['Password']) . "'
AND UserActive = 1 AND UserListingOnly = 0
AND UserID NOT IN (61)");
$UserCount = $Database->RecordCount($userSQL);
if ($UserCount == 1) {
// user found
$rowUser = $Database->Records($userSQL);
}//end if
}//end if
else {
// valid log in
$_SESSION['LoggedIn'] = true;
$_SESSION['UserID'] = $rowUser['UserID'];
// do what I need to display
}// end else if
------ settings.php -----
<?php
require_once("includes/functions/sitesettings.php");
require_once("includes/functions/database.php");
$SiteSettings = new SiteSettings();
$Database = new Database();
$Settings = $SiteSettings->SettingValues();
?>
----sitesetting.php----
<?php
/*-----------------------------------------------------
This class contains generic the setting for the website
-----------------------------------------------------*/
ini_set('display_errors','off');
error_reporting(E_ALL);
class SiteSettings {
var $Settings;
/*-------------------------------------------------------------------------------
Function to retrieve the site setting of the website
You must fill in all of the settings below
$Settings['WS-Filepath'] is the Linux file path of the websites root folder
$Settings['WS-HTTPpath'] is the full web path to the websites root folder
$Settings['DB-Hostname'] is the hostname or the IP address of the database server
$Settings['DB-Username'] is the username to access the database
$Settings['DB-Password'] is the password to access the database
$Settings['DB-Database'] is the name of the database you wish to access
-------------------------------------------------------------------------------*/
function SettingValues() {
$Settings['WS-Filepath'] = "http://localhost/admin/";
$Settings['WS-HTTPpath'] = "http://localhost/admin/";
$Settings['DB-Hostname'] = "localhost";
$Settings['DB-Username'] = "xxxxx";
$Settings['DB-Password'] = "";
$Settings['DB-Database'] = "xxxxxxx";
return $Settings;
}
}
?>
------ database.php -----------
<?php
/*-------------------------------------------------
This class contains generic database functions to
view, add, edit and delete all facets of a database
-------------------------------------------------*/
require_once ("sitesettings.php");
class Database extends SiteSettings {
var $Query;
var $Connection;
function Database() {
$Settings = SiteSettings::SettingValues();
$Hostname = $Settings['DB-Hostname'];
$Username = $Settings['DB-Username'];
$Password = $Settings['DB-Password'];
$Database = $Settings['DB-Database'];
$this->Connection = mysql_connect($Hostname, $Username, $Password);
mysql_select_db($Database);
register_shutdown_function(array(&$this, "close"));
}
function Execute($SQL) {
$this->Query = $SQL;
return mysql_query($SQL, $this->Connection);
}
function Records($SQL) {
return mysql_fetch_array($SQL);
}
function RecordCount($SQL) {
return mysql_num_rows($SQL);
}
function Close() {
mysql_close($this->Connection);
}
}
?>