PDA

View Full Version : Help!Login Problem in my Script using Bluehost



pangarap
07-23-2012, 05:24 PM
Im having problems in my
login my authentication
system worked fine on my
xampp server and byeth0st, and now im
having problems since i
moved over to bluehost..

When I login in my site, the
session is not register and
the header function not
work...Because of this kind of Problem I cant use my new buy hosting in blueh0st..Pls. Anyone can
help me to fix this
problem...Thanks in Advance...

here is the code of my
login...

pangarap
07-23-2012, 05:32 PM
<?php

include("iconfig.php");
include("icore.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 "<html>";
echo "<head>";

echo "<meta http-equiv=
\"Cache-Control\"
content=\"must-revalidate
\" />
<meta http-equiv=\"Cache-
Control\" content=\"no- cache\"/>
<meta name=\"description
\" content=\"mobile
interactive community that
can be access wherever
you are in the world. It is made to connect people
and to establish unity with
tones of new exciting
features like Scrembox,
Forums, Articles,
Chatrooms, Downloads, Clubs, Photo Gallery, Blogs,
Polls, Chappel, Rpg Game,
Lucky9, Jack En Poy, Spin
The Wheel, Virtual Pets,
Wap Jueteng And More
Options That Entertain You And Makes You Busy\"/>
<meta name=\"keywords
\" content=\"rhagzCHAT,
free,
community, forums, chat,
wap, communicate, free sms, mp3, scandals, videos,
games, downloads, scripts,
ringtones, porn, xxx, hot,
new, latest\"/>
<link rel=\"shortcut icon\"
href=\"rhagz.ico\" type= \"image/x-icon\"/>
<link rel=\"stylesheet\"
type=\"text/css\" href=
\"rhagzstyle.css\"/>";
echo "</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/>";

echo "<br/><div class=
\"foot\">";
echo "$mysite</div>";
echo "Page Took ";
$load = microtime();
print (number_format ($load,2));
echo " Seconds ";
echo "</div>";
echo "</body>";
echo "</html>";
exit(); }

$ubr = addslashes
($_SERVER
['HTTP_USER_AGENT']);
$uid = sanitize(cleanInput
($_GET["u"])); $lname = getnick_lick
($uid);
$pwd = sanitize(cleanInput
($_GET["p"]));
$myid = getuid_lick($uid);
$rhagzstyle = mysql_fetch_array
(mysql_query("SELECT
mystyle FROM
shawap_users WHERE id='".
$myid."'"));

$tolog = false;
echo "<head>";
echo "<title>$lname@
$mysite</title>";
echo "<link rel=
\"stylesheet\" type= \"text/css\" href=
\"$rhagzstyle[0]\"/>";
echo "</head>";
echo "<div align=\"center
\">";

$uinf = mysql_fetch_array
(mysql_query("SELECT
COUNT(*) FROM
shawap_users WHERE
lognamez='".$uid."'"));
if($uinf[0]==0) {
//Check for user ID
echo "<div class=
\"t2\">Error.!!</div><br/
>User Does Not Exist Or
Error Login Name<br/><a href=\"terms.php
\">Register It Now</
a><br/>";
echo "<div class=\"foot
\">";
echo "$mysite</div>"; echo "Page Took ";
$load = microtime();
print (number_format
($load,2));
echo " Seconds";
echo "</div>"; echo "</body>";
exit();

}else{
//check for pwd
$epwd = md5($pwd);
$uinf = mysql_fetch_array
(mysql_query("SELECT
COUNT(*) FROM shawap_users WHERE
lognamez='".$uid."' AND
pass='".$epwd."'"));
if($uinf[0]==0)
{
echo "<div class=
\"t2\">Error.!!</div><br/
>Are You Trying To Guess
Your Password Or What?
<br/>Please Type It
Correctly<br/>"; echo "<div class=\"foot
\">";
echo "$mysite</div>";
echo "Page Took ";
$load = microtime();
print (number_format ($load,2));
echo " Seconds";
echo "</div>";
echo "</body>";
exit();
}else{
//is user already logged in? $logedin =
mysql_fetch_array
(mysql_query("SELECT uid
FROM shawap_ses WHERE
uid='".getuid_lick
($uid)."'")); mysql_query("DELETE FROM
shawap_ses WHERE uid='".
$uid."'");
mysql_query("DELETE FROM
shawap_online WHERE
userid='".$uid."'"); $rndsid = rand(111,999);
$tm = time();
$xtm = $tm + (getsxtm
()*50);
$did = $tm.$rndsid;
$res = mysql_query ("INSERT INTO shawap_ses
SET id='".safe(cleanInput
(md5($did)))."',
uid='".getuid_lick($uid)."',
expiretm='".$xtm."'");

echo "<head>";
echo "<title>$uid@
$toptitle</title>";
echo "<link rel=
\"stylesheet\" type=
\"text/css\" href= \"$rhagzstyle[0]\"/>";
echo "</head>";
echo "<div class=\"head
\">Welcome $lname!</
div><br/>";

$idn = getuid_lick($uid);
$sid = safe(cleanInput
(md5($did)));

setcookie("sid",$sid);
header
('location:main.php'); }
}
echo "<div class=\"foot
\">";
echo "$mysite</div>";
echo "Page Took "; $load = microtime();
print (number_format
($load,2));
echo " Seconds";
echo "</div>";
echo "</body>"; exit();
?>
</html>

pangarap
07-23-2012, 05:56 PM
aww..i cant post my c0de..why oh why?hum..forbidden

Bob Barr
07-25-2012, 12:51 PM
aww..i cant post my c0de..why oh why?hum..forbidden
As a new member, your posts are being placed in a moderation queue automatically. After a few posts (5, I believe), that function will disable itself. I missed the fact that your posts were in the queue.

alemcherry
07-27-2012, 04:57 AM
Headers - redirection or for setting cookie, should be done before you echo anything. You are echoing all <head><html> etc first and then trying to set cookie, which will not work. Even worse you are trying to echo so many information just before the header redirect!

This code is all wrong, even though it looks good with all precautions taken with user input. Only reason it should have worked on your dev. environment would because of the output buffering enabled. You have the option to enable output buffering using PHP to get this working, but I would recommend getting the fundamentals right and coding properly.