Here is the code, i am trying to make it so when someone does a / then a name the error php actually looks at this script and i am going to save whatever they put as / name as a session variable. I run the script and i get the error
Fatal error: Call to a member function query_column() on a non-object in /home/maxgxl/public_html/r
eplicate.p
hp on line 28
I marked line 28 in the code
<?PHP
session_start();
$username_lookup = rtrim($_SERVER['REDIRECT_U
RL'],'/');
preg_match('/\/[A-Za-z0-9_
\- ]+$/', $_SERVER['REDIRECT_URL'], $matches);
$username_lookup = substr(trim($matches[0]),1
);
if($username_lookup){
$ho = '';
$us = '';
$pa = '';
$dbName = '';
// connect and select the database
$conn = mysql_connect($ho, $us, $pa) or die(mysql_error());
$db = mysql_select_db($dbName, $conn) or die(mysql_error());
unset($_SESSION["user"]);
28. if($db->query_column("sele
ct user2 from username2 where user2='" . $username_lookup . "'")){
$_SESSION["user"]["usernam
e"] = strtolower($username_looku
p);
}else{
if($db->query_column("sele
ct user2 from distributors where username='" . $username_lookup . "' and active=1")){
$_SESSION["user"]["usernam
e"] = strtolower($username_looku
p);
}
}
if($username_lookup == 'clearsession'){
unset($_SESSION["user"]);
}
}
if(!$_SESSION["user"]["use
rname"]){
header("Location: /real404.php");
}else{
//header("Location: /index.php");
include('index.php');
}
echo "<!--" . @$_SESSION["user"]["userna
me"] . "-->";
?>
Looking for any advice on the coding.
Start Free Trial