CheckLogin.php
LoginOK.php
I'm not able to see the value of Username in LoginOK.php. Please help me with this.
Is there any IDE or debugger which will help me trace the values of variables?
<?php
ob_start();
$host="localhos t"; // Host name
$username="root "; // Mysql username
$password="secr et"; // Mysql password
$db_name="game" ; // Database name
$tbl_name="memb ers"; // Table name
// Connect to server and select databse.
mysql_connect(" $host", "$username" , "$password" )or die("cannot connect");
mysql_select_db ("$db_name") or die("cannot select DB");
// Define $myusername and $mypassword
$myusername=$_P OST['Username'];
$mypassword=$_P OST['Password'];
$sql="SELECT * FROM $tbl_name WHERE username='$myus ername' and password='$mypa ssword'";
$result=mysql_q uery($sql);
// Mysql_num_row is counting table row
$count=mysql_nu m_rows($result) ;
// If result matched $myusername and $mypassword, table row must be 1 row
if($count==1){
// Register $myusername, $mypassword and redirect to file "LoginOK.ph p"
$_session['username']=$myusername;
$_session['password']=$mypassword;
session_registe r("Username") ;
session_registe r("Password") ;
header("locatio n:LoginOK.php") ;
}
else {
echo "Wrong Username or Password";
}
ob_end_flush();
?>
ob_start();
$host="localhos t"; // Host name
$username="root "; // Mysql username
$password="secr et"; // Mysql password
$db_name="game" ; // Database name
$tbl_name="memb ers"; // Table name
// Connect to server and select databse.
mysql_connect(" $host", "$username" , "$password" )or die("cannot connect");
mysql_select_db ("$db_name") or die("cannot select DB");
// Define $myusername and $mypassword
$myusername=$_P OST['Username'];
$mypassword=$_P OST['Password'];
$sql="SELECT * FROM $tbl_name WHERE username='$myus ername' and password='$mypa ssword'";
$result=mysql_q uery($sql);
// Mysql_num_row is counting table row
$count=mysql_nu m_rows($result) ;
// If result matched $myusername and $mypassword, table row must be 1 row
if($count==1){
// Register $myusername, $mypassword and redirect to file "LoginOK.ph p"
$_session['username']=$myusername;
$_session['password']=$mypassword;
session_registe r("Username") ;
session_registe r("Password") ;
header("locatio n:LoginOK.php") ;
}
else {
echo "Wrong Username or Password";
}
ob_end_flush();
?>
<?
session_start() ;
echo "hello";
$Username=$_GET['Username'];
echo $Username;
if(!session_is_ registered('use rname')){
header("locatio n:index.php");
}
?>
session_start() ;
echo "hello";
$Username=$_GET['Username'];
echo $Username;
if(!session_is_ registered('use rname')){
header("locatio n:index.php");
}
?>
Is there any IDE or debugger which will help me trace the values of variables?
Comment