PHP Code:
<?php
session_name("PHPSESSID");
session_start();
include("iconfig.php");
include("icore.php");
echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>";
echo "<!DOCTYPE html PUBLIC \"-//WAPFORUM//DTD XHTML Mobile 1.0//EN\"\"http://www.wapforum.org/DTD/xhtml-mobile10.dtd\">";
echo "<html xmlns=\"http://www.w3.org/1999/xhtml\">";
echo "<link rel=\"shortcut icon\" href=\"pgsm.ico\" type=\"image/x-icon\" />";
echo "<link rel=\"StyleSheet\" type=\"text/css\" href=\"whitestyle.css\" />";
echo "<meta http-equiv=\"Cache-Control\" content=\"must-revalidate\" />
<meta http-equiv=\"Cache-Control\" content=\"no-cache\"/>
<meta name=\"description\" content=\"PinoyTrix\"/>
<meta name=\"keywords\" content=\"free, community, forums, chat, wap, communicate\"/></head>";
echo "<body>";
connectdb();
$bcon = connectdb();
if (!$bcon)
{
echo "<div align=\"center\"><div class=\"t2\">Error.!</div><br/>";
echo "Cant connect to database<br/>";
echo "This error happens usually when backing up the database, please be patient, The site will be up any minute<br/>";
echo "Thank You Very Much<br/><a href=\"index.php\">Home</a><br/><div class=\"foot\">$mysite</div></div>";
echo "<br/>Page Took ";
$load = microtime();
print (number_format($load,2));
echo " Seconds";
echo "</div>";
echo "</body>";
echo "</html>";
exit();
}
$nick = safe(cleanInput($_GET["u"]));
$pwd = safe(cleanInput($_GET["p"]));
$myid = getuid_name($nick);
$whitestyle = mysql_fetch_array(mysql_query("SELECT mystyle FROM ibwf_users WHERE id='".$myid."'"));
$user = mysql_fetch_array(mysql_query("SELECT name FROM ibwf_users WHERE id='".$myid."'"));
$ubrowser = safe($_SERVER['HTTP_USER_AGENT']);
$uipadd = getip();
$tolog = false;
echo "<title>$user[0]-$toptitle*</title>";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"$whitestyle[0]\"/>";
echo "</head>";
echo "";
$uinf = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users WHERE myname='".$nick."'"));
if($uinf[0]==0)
{
$brws = explode(" ",$HTTP_USER_AGENT);
$ubr = $brws[0];
$ip = $_SERVER['REMOTE_ADDR'];
//Check for user ID
echo "<div class=\"notice\"><div class=\"mid\"><b>PinoyTrix</b></div><div class=\"error\">Error.!!<br/>User Does Not Exist Or Not Yet Registered<br/><a href=\"terms.php\">Register It Now</a><br/></div>";
}else{
//check for pwd
$epwd = md5($pwd);
$uinf = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users WHERE username='".$user."' AND password='".$epwd."'"));
if($uinf[0]==0)
{
echo "<div class=\"notice\"><div class=\"mid\"><b>PinoyTrix</b></div><div class=\"error\">Error.!!<br/>Are You Trying To Guess Your Password Or What?<br/>If you forgot your own password<br/>just retrieve it <a href=\"forgotpw.php\">HERE</a><br/></div>";
}else{
$logedin = mysql_fetch_array(mysql_query("SELECT uid FROM ibwf_ses WHERE uid='".$myid."'"));
//i altered the if statement here to //accomodate more login attempt and //by that you can access it always. //.Remod by escape_string
if($logedin[0]=='100')
{
mysql_query("DELETE FROM ibwf_ses WHERE uid='".$myid."'");
}else{
[B]header("location:index.php?do=main");[/B]
$rndsid = rand(111111111,999999999);
$tm = (time() - $timeadjust) ;
$xtm = $tm + (getsxtm()*60);
$did = $uid.$tm;
$res = mysql_query("INSERT INTOibwf_ses SET id='".md5($did)."', uid='".$myid."', expiretm='".$xtm."'");
if($res)
{
$tolog=true;
$New_Time = (time() + $timeadjust);
$show_date=date("l, d F Y",$New_Time);
$show_time=date("g:ia",$New_Time);
$Hour=date("G",$New_Time);
$_SESSION['sid'] = md5($did);
$lact = mysql_fetch_array(mysql_query("SELECT lastact FROM ibwf_users WHERE id='".$myid."'"));
$lst = $lact[0];
mysql_query("UPDATE ibwf_users SET lastvst='".$lst."', lastact='".time()."', browserm='".$ubrowser."', ipadd='".$uipadd."' WHERE id='".$myid."'");
}
}
}
}
if($tolog)
{
}else{
}
exit();
?>
</html>
PHP Code:
if($logedin[0]=='100')
{
mysql_query("DELETE FROM ibwf_ses WHERE uid='".$myid."'");
}else{
[B]header("location:index.php?do=main");[/B]
$rndsid = rand(111111111,999999999);
$tm = (time() - $timeadjust) ;
$xtm = $tm + (getsxtm()*60);
$did = $uid.$tm;
$res = mysql_query("INSERT INTOibwf_ses SET id='".md5($did)."', uid='".$myid."', expiretm='".$xtm."'");
if($res)
{
$tolog=true;
$New_Time = (time() + $timeadjust);
$show_date=date("l, d F Y",$New_Time);
$show_time=date("g:ia",$New_Time);
$Hour=date("G",$New_Time);
$_SESSION['sid'] = md5($did);
$lact = mysql_fetch_array(mysql_query("SELECT lastact FROM ibwf_users WHERE id='".$myid."'"));
$lst = $lact[0];
mysql_query("UPDATE ibwf_users SET lastvst='".$lst."', lastact='".time()."', browserm='".$ubrowser."', ipadd='".$uipadd."' WHERE id='".$myid."'");
}
}
}
}
Comment