[thelist] Include function in CODE doesn't work (blank output)

HP Thniah heanpeng at gmail.com
Thu Feb 12 05:07:08 CST 2009


hi there

I have an issue with running this PHP script on PHP Triad ver 2.2.

The issue is that the following sub-code (using INVOLVE function) below
produces a blank output.

SUB-CODE
{  include("include/newsession.php");
         echo "<p class=data> <center>Successfully,Logged in<br><br><a
href='logout.php'> Log OUT </a><br><br><a href=welcome.php>Click here if
your browser
is not redirecting automatically or you don't want to
wait.</a><br></center>";

print "<script>";
print " self.location='welcome.php';"

//////////////////////////////////////////////////////////////////////////////////////////////////////////

FULL CODE
<?
include "include/session.php";
$dbservertype='mysql';
$servername='localhost';
// username and password to log onto db server
$dbusername='';
$dbpassword='';
// name of database
$dbname='test';
////////////////////////////////////////
////// DONOT EDIT BELOW  /////////
///////////////////////////////////////
connecttodb($servername,$dbname,$dbusername,$dbpassword);
function connecttodb($servername,$dbname,$dbuser,$dbpassword)
{
global $link;
$link=mysql_connect ("$servername","$dbuser","$dbpassword");
if(!$link){die("Could not connect to MySQL");}
mysql_select_db("$dbname",$link) or die ("could not open db".mysql_error());
}
//////////////////////////////
?>
<html>
<head>
<title>(Type a title for your page here)</title>
<meta name="GENERATOR" content="Arachnophilia 4.0">
<meta name="FORMATTER" content="Arachnophilia 4.0">
</head>
<body bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#800080"
alink="#ff0000">
<?
$userid=mysql_escape_string($userid);
$password=mysql_escape_string($password);
if($rec=mysql_fetch_array(mysql_query("SELECT * FROM cus_info WHERE
login='$userid' AND password = '$password'")))
{
if(($rec['userid']==$userid)&&($rec['password']==$password))
{  include("include/newsession.php");
         echo "<p class=data> <center>Successfully,Logged in<br><br><a
href='logout.php'> Log OUT </a><br><br><a href=welcome.php>Click here if
your browser
is not redirecting automatically or you don't want to
wait.</a><br></center>";

print "<script>";
print " self.location='welcome.php';";
// Comment this line if you don't want to redirect
print "</script>";
}
}
else {
  session_unset();
echo "<font face='Verdana' size='2' color=red>Wrong Login. Use your correct
Userid and Password and Try <br><center><input type='button' value='Retry'
onClick='history.go(-1)'></center>";

 }
?>
<center>
</body>
</html>



More information about the thelist mailing list