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\"""
help me with this code
Collapse
X
-
<?php header("Location: http://www.yoursite.com"); ?>
Free Mobile Web Scripts by me: Free Youtube Downloader, Tweets Reader, Facebook Wall Posts Reader
PHP Tutorials: How to Secure Your PHP Script (PHP SECURITY)
Want to Develop/Edit your WAP/Web Site? Add me to Gtalk (gmail) 'lakshan1989' or PM me.
-
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&?bro wse\">";
plssss help me with my problem thankz alot
PHP Code:<?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>
Comment
-
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:
Code:$idn = getuid_nick($uid); $sid = md5($did); $redirect = header("Location: index.php?action=main&sid=$sid&?browse"); echo "$redirect";
Last edited by andyjay33; 27.07.10, 01:14.
Comment
Comment