login.php

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    login.php

    i have a code that must come on the login page but dnt know where to add it to make it work

    Code:
    <?php
    session_name("PHPSESSID");
    session_start();
    include("config.php");
    include("core.php");
    connectdb();
    $bcon = connectdb();
    $theme = mysql_fetch_array(mysql_query("SELECT theme FROM ibwf_users WHERE id='".$uid."'"));
    $uid = mysql_real_escape_string( $_GET["loguid"] );
    $pwd = mysql_real_escape_string( $_GET["logpwd"] );
    
    $tolog = false;
    
    header("Content-type: text/html; charset=ISO-8859-1");
    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 "<head><title>$uid@Adult.co.za</title>";
    echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"themes/red.css\">";
    
    echo "<meta http-equiv=\"Cache-Control\" content=\"must-revalidate\" />";
    echo "<meta http-equiv=\"Cache-Control\" content=\"no-cache\"/>";
    echo "<body>";
    
    if (!$bcon)
    {
    
    
    
    
        echo "<img src=\"images/exit.gif\" alt=\"*\"/><br/>";
    
    
    
    echo "<table border=\"0\" width=\"99%\" cellspacing=\"0\" cellpadding=\"0\" class=\"boxed\" align=\"center\">";
    echo "<tr>";
    echo "<td class=\"boxedTitle\" height=\"20\">";
    
    echo "<h1 align=\"center\" class=\"boxedTitleText\">";
    
    echo "ERROR! cannot connect to database<br/><br/>";
    
    echo "</h1>";
    echo "</td>";
    echo "</tr>";
    
    echo "<tr>";
    echo "<td class=\"boxedContent\">";
    
        echo "<center>This error happens usually when backing up the database, please be patient, The site will be up any
    
    minute</center><br/><br/>";
              echo "<a href=\"http://Adult.co.za/>Adult</a><br/>";
    echo "<br/>";
        echo "<center><b>THANK YOU VERY MUCH</center></b>";
        echo "</td>";
    echo "</tr>";
    echo "</table>";
    
    
    
        echo "</body>";
        echo "</html>";
        exit();
    }
    
    $uid = mysql_real_escape_string( $_GET["loguid"] );
    $pwd = mysql_real_escape_string( $_GET["logpwd"] );
    
    $tolog = false;
    
    
    
    
    
    
    
    
    
    echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" height=\"60\" width=\"159\">";
    echo "<tr>";
    echo "<td id=\"logo\" width=\"159\">";
    echo "</td>";
    echo "</tr>";
    echo "</table>";
    
    
    
    //GET TIP
        $sql = "SELECT tips FROM ibwf_logintips ORDER BY RAND() LIMIT 1";
        $items = mysql_query($sql);
        if(mysql_num_rows($items)>0)
        {
        while ($item = mysql_fetch_array($items))
          {
            $tip = "$item[0]";
          }
        }
    
    
    
    
    
      $uinf = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users WHERE name='".$uid."'"));
      if($uinf[0]==0)
      {
        //Check for user ID
    
    
      }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)
        {
    
        }else{
          $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(isset($_COOKIE['ibwf_ses'])) //wa kry jy die COOKIE? Hy word nerens gecreate nie.
    {
            session_start();
            $_SESSION['ses_id'] = $_COOKIE['ibwf_ses'];
            $sid = $_SESSION['ses_id'];
            $mwsid = "?";
            $sessionyesno = "no";
    }
    
    
          if($res)
          {
            $tolog=true;
    echo "<table border=\"0\" width=\"99%\" cellspacing=\"0\" cellpadding=\"0\" class=\"boxed\" align=\"center\">";
    echo "<tr>";
    echo "<td class=\"boxedTitle\" height=\"20\">";
    echo "<h1 align=\"center\" class=\"boxedTitleText\">Logged In</h1></td>";
    echo "</tr>";
    
    echo "<td class=\"boxedContent\">";
    
    
            echo "<center>Welcome <b>$uid</b></center>";
    
    echo "<center><small>[Bookmark <b>This Page</b> to Auto-Login</small></center>";
    
    echo "</td>";
    echo "</tr>";
    echo "</table>";
      
    echo "<table border=\"0\" width=\"99%\" cellspacing=\"0\" cellpadding=\"0\" class=\"boxed\" align=\"center\">";
    echo "<tr>";
    echo "<td class=\"boxedTitle\" height=\"20\">";
    echo "<h1 align=\"center\" class=\"boxedTitleText\">Loggin Tip</h1></td>";
    echo "</tr>";
    
    echo "<td class=\"boxedContent\">";
    
    
            echo "<center><small>$tip</small></center>";
    
    echo "</td>";
    echo "</tr>";
    echo "</table>";
    
    
            $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 "<table border=\"0\" width=\"99%\" cellspacing=\"0\" cellpadding=\"0\" class=\"boxed\" align=\"center\">";
    echo "<tr>";
    echo "<td class=\"boxedTitle\" height=\"20\">";
    echo "<h1 align=\"center\" class=\"boxedTitleText\">Logged In</h1></td>";
    echo "</tr>";
    
    echo "<td class=\"boxedContent\">";
    
    
    
            echo "Welcome <b>$uid</b><br/>";
    echo "<small>[Bookmark <b>This Page</b> to Auto-Login]</small><br/>";
    
    echo "</td>";
    echo "</tr>";
    echo "</table>";
    
    echo "<table border=\"0\" width=\"99%\" cellspacing=\"0\" cellpadding=\"0\" class=\"boxed\" align=\"center\">";
    echo "<tr>";
    echo "<td class=\"boxedTitle\" height=\"20\">";
    echo "<h1 align=\"center\" class=\"boxedTitleText\">Loggin Tip</h1></td>";
    echo "</tr>";
     echo "<p align=\"center\">";
    echo "<td class=\"boxedContent\">";
    
    
    
    
    
          echo "<center><small>$tip</small></center>";
    
    
    
    
    echo "</td>";
    echo "</tr>";
    echo "</table>";
    echo "</p>";
                              $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()."' WHERE id='".$idn."'");
                            }else{
    
    echo "<table border=\"0\" width=\"99%\" cellspacing=\"0\" cellpadding=\"0\" class=\"boxed\" align=\"center\">";
    echo "<tr>";
    echo "<td class=\"boxedTitle\" height=\"20\">";
    echo "<h1 align=\"center\" class=\"boxedTitleText\">Error</h1></td>";
    echo "</tr>";
    
    echo "<td class=\"boxedContent\">";
    
    
           echo "<p align=\"center\">";
    
    
          echo "Can't loggin at this time";
    
    echo "</p>";
    echo "</td>";
    echo "</tr>";
    echo "</table>";
    
              }
    
            }
    
          }
    
        }
      }
    
    echo "<table border=\"0\" width=\"99%\" cellspacing=\"0\" cellpadding=\"0\" class=\"boxed\" align=\"center\">";
    echo "<tr>";
    echo "<td class=\"boxedTitle\" height=\"20\">";
    echo "<h1 align=\"center\" class=\"boxedTitleText\">Enter Adult</h1></td>";
    echo "</tr>";
    
    echo "<td class=\"boxedContent\">";
    
    
           echo "<p align=\"center\">";
    
      if($tolog)
    {
      $_SESSION['sid'] = md5($did);
    
    echo "<a href=\"index.php?action=main\">";
    echo "<small>ENTER</small></a><br/><br/>";
    
           echo "<small>Tell every one about this site, make it the best place to hang out</small>";
           echo "</p>";
    
    }
    
    else
    {
    
    
    
           echo "<p align=\"center\">";
           echo "Incorrect password or username!";
    
    
                    echo  "<center><form action=\"login.php\" method=\"get\"><br/>";
    
    
                                            echo "Username:<br/>";
                                            echo "<input id=\"inputText\" type=\"text\" name=\"loguid\" maxlength=\"30\" size=\"20\"/><br/>";
                                            echo "Password:<br/>";
                                            echo "<input id=\"inputText\" type=\"password\" name=\"logpwd\" maxlength=\"30\" size=\"20\"/><br/><br/>";
                                           echo "<input id=\"inputButton\" type=\"submit\" value=\"Sign In\"/><br/>";
    
                                   echo  "</form></center>";
    
    
    
    
    echo "<br/><a href=\"index.php\"><img src=\"images/home.gif\" alt=\"*\"/>";
    echo "Home</a><br/>";
    
               echo "</td>";
    echo "</tr>";
    echo "</table>";
    
    
          }
    
    
    
    
    
    
    
    
    echo "<table border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"0\">";
    
    echo "<tr>";
    
    echo "<td align=\"left\" valign=\"baseline\">";
    
    
    echo "</td>";
    
    echo "</tr>";
    
    
    echo "<tr>";
    
    echo "<td id=\"footer\">";
    
    echo "<p id=\"legal\">&#169; Adult 2009</p>";
    
    echo "<p id=\"legal\">";
    
    
    echo "</p>";
    echo "<br/>";
    
    echo "</td>";
    
    echo "</tr>";
    
    
    
    
    echo "</table>";
    
    
    
    
    
      echo "</body>";
    
    ?>
    </html>
    the code i must add
    Code:
      $ip = $_SERVER['REMOTE_ADDR'];
    
    $brws = explode(" ",$_SERVER[HTTP_USER_AGENT] );
    
    $ubr = $brws[0];
    
          $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."', ip='".$ip."', brwsr='".$ubr."'");
    
    ////////////////////////////////////////////

    #2
    should be after

    //GET TIP
    $sql = "SELECT tips FROM ibwf_logintips ORDER BY RAND() LIMIT 1";
    $items = mysql_query($sql);
    if(mysql_num_rows($items)>0)
    {
    while ($item = mysql_fetch_array($items))
    {
    $tip = "$item[0]";
    }
    }
    and before
    //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)."'");
    i think, not too sure though

    Comment


      #3
      it replaces your second quote amy

      Comment

      Working...
      X