help me with this code

Started on the old forum in July 2010 · view the original in the archive · old links redirect here

3 replies · 664 views · started 16 years ago · 1 min read

3 participants
icen01 Developer · 72 posts #1

how can i make my site in login.php, redirect to the main page, and will not enter in login.php and redirect to main page but not this code """meta http-equiv="refresh"""

pin0y likes wap

icen01 Developer · 72 posts #3

here's my login.php where to put that code so that it will redirect to the main page of my index.php or this is my main page

echo "<a href="index.php?action=main&sid=$sid&?browse">";

plssss help me with my problem thankz alot

<?php

include("config.php");
include("core.php");
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 "<link rel=\"StyleSheet\" type=\"text/css\" href=\"style/style.css\" />";
echo "<meta http-equiv=\"Cache-Control\" content=\"must-revalidate\" />
<meta http-equiv=\"Cache-Control\" content=\"no-cache\"/>
<meta name=\"description\" content=\"Chatheaven :)\"> 
<meta name=\"keywords\" content=\"free, community, forums, chat, wap, communicate\"></head>";
echo "<body>";

connectdb();
$bcon = connectdb();
if (!$bcon)
{
 
    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 "</p>";
    echo "</body>";
    echo "</html>";
    exit();
}
$uid = $_GET["loguid"];
$pwd = $_GET["logpwd"];

$tolog = false;
echo "<head><title>$uid@pinoyaztig.net</title>";
 echo "<p align=\"center\">";
 
  
  $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/>";
    }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($res)
      {
        $tolog=true;
        echo "Welcome $uid!<br/>";
        $idn = getuid_nick($uid);
         $sid = md5($did);
        echo "<a href=\"index.php?action=main&sid=$sid&?browse\">";
          echo "[enter]</a><br/>";
           
          $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{
        //is user already logged in?
        $logedin = mysql_fetch_array(mysql_query("SELECT uid FROM ibwf_ses WHERE uid='".getuid_nick($uid)."'"));
        if($logedin[0]>0)
        {
        
              if($res)
          {
            $tolog=true;
            echo "Welcome $uid!<br/>";
            

           
            
          }else{

 $nopl = mysql_fetch_array(mysql_query("SELECT id FROM ibwf_ses WHERE uid='".getuid_nick($uid)."'"));
mysql_query("DELETE FROM ibwf_ses WHERE id='".$nopl[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."'");
      
      
echo "<br/>Welcome $uid!<br/>";
        $idn = getuid_nick($uid);
         $sid = md5($did);
        echo "<a href=\"index.php?action=main&sid=$sid&?browse\">";
          echo "[enter]</a><br/>";
          

echo "Add Bookmark Now!
And dont forget to tell your friends about this site ;) ";

}
          
        }
        
      } 
       
      
    }
  }

  
  if($tolog)
{
 $sid = md5($did);

echo "Add Bookmark Now!
And dont forget to tell your friends about this site ;)<br/> ";

echo "<a href=\"index.php\">";
echo "Home</a>";
}else{
echo "<a href=\"index.php\">";
echo "Home</a></center>";
}
echo "</p>";
  echo "</body>";
?>
</html>

pin0y likes wap

andyjay33 Developer · 75 posts #4

header("Location: mainpage.php");

try that if that dont work then make sure in ya php settings you got output buffering set to on as ive found having this setting off it does not allow redirecting

Added after 5 minutes:

         $idn = getuid_nick($uid);
         $sid = md5($did);
        $redirect = header("Location: index.php?action=main&sid=$sid&?browse");
        echo "$redirect";
       

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close