Jump to content

data missing


optiplex

Recommended Posts

im trying to do a login page..

 

my login handler coding is (checklogin.php)

<?php

ob_start();
$host="localhost"; // Host name 
$username="admin"; // Mysql username xx
$password="123"; // Mysql password 
$db_name="account"; // Database name 
$tbl_name="members"; // 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 $t_nick and $t_password 
$t_nick=$_POST['t_nick']; 
$t_password=$_POST['t_password'];

// To protect MySQL injection (more detail about MySQL injection)
$t_nick = stripslashes($t_nick);
$t_password = stripslashes($t_password);
$t_nick = mysql_real_escape_string($t_nick);
$t_password = mysql_real_escape_string($t_password);

$sql="SELECT * FROM $tbl_name WHERE t_nick='$t_nick' and t_password='$t_password'";
$result=mysql_query($sql);
// Mysql_num_row is counting table row
$count=mysql_num_rows($result);
// If result matched $t_nick and $t_password, table row must be 1 row

if($count==1){
// Register $t_nick, $t_password and redirect to file "list_details.php"
session_register("t_nick");
session_register("t_password"); 
//echo $t_nick;
//exit;
header("location:list_details.php");
}
else {
echo "Wrong Username or Password";
}

ob_end_flush();
?>

 

if the username and password correct, this page will display

<?
session_start();
//$_SESSION['t_nick']=$t_nick;
if(!session_is_registered(t_nick)){
header("location:login.php");
}
include "config.inc";
include "connect.inc";

//$t_nick = $_POST['t_nick'];


?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>AlgebraForex</title>
<link href="../style.css" rel="stylesheet" type="text/css" />
</head>
<?

if ($t_nick) {
          		$sql = "select *  from
                     trader_details where t_nick='$t_nick' ";

                   $res = mysql_query($sql);
               echo mysql_error();
             
  	           	$row 			= mysql_fetch_row($res);
				$id				= $row[0];
				$t_nick			= $row[1];
				$t_name			= $row[2];
				$t_telefon		= $row[3]; 
				$t_email		= $row[4];
				$t_alamat		= $row[5];
				$t_ic  			= $row[6];
             	$intro 			= $row[7];
             	$no_akaun		= $row[8];
				$bank			= $row[9];
             	$w_nama  		= $row[10];
             	$w_telefon 		= $row[11];
				$w_alamat		= $row[12];
				$w_ic			= $row[13];
				$p_status		= $row[14];
				$acc_no			= $row[15];
				$acc_status		= $row[16];
				$reg_date		= $row[17];
				$trade_cat		= $row[18];


			}

			//echo $sql;
			//exit;
	?>
  
<body>
<table width="90%" border="0" align="center">
  <tr>
    <td><h1>algebraforex.com</h1></td>
  </tr>
  <tr>
    <td> </td>
  </tr>
  <tr>
    <td><div align="center">| My Profile |
      <? 

$semakdeposit = mysql_query ("SELECT * from deposit where t_nick ='$t_nick'");
if (mysql_num_rows($semakdeposit) == 0) 
{

echo "<a href=deposit.php?t_nick=$row[1]>Deposit</a> |"; 

}
else
{
echo "Add Account |"; 
}

      echo " <a href=withdraw.php?t_nick=$row[1]>Withdrawal</a>
|  Msg To Admin | <a href=aff_report.php?t_nick=$row[1]>Affiliate Report</a>";?>
      | </div></td>
  </tr>
  <tr>
    <td> </td>
  </tr>
  <tr>
    <td><div align="center"></div></td>
  </tr>
  <tr>
    <td><table width="80%" border="0" align="center">
      <tr>
        <td colspan="2" bgcolor="#E4E4E4"><h2>Maklumat : <strong><?php echo htmlentities ($t_nick);?></strong></h2></td>
      </tr>
      <tr>
        <td colspan="2"> </td>
      </tr>
      <tr>
        <td width="26%"><div align="right">Status Akaun : </div></td>
        <td width="74%"><strong><?php echo htmlentities ($acc_status);?>
          <input name="id" type="hidden" value="<?php echo $id ?>" />
        </strong></td>
      </tr>
      <tr>
        <td><div align="right"></div></td>
        <td> </td>
      </tr>
      <tr>
        <td><div align="right"></div></td>
        <td><strong><?php echo htmlentities ($t_name);?></strong></td>
      </tr>
      <tr>
        <td> </td>
        <td><strong><?php echo htmlentities ($t_alamat);?></strong></td>
      </tr>
      <tr>
        <td> </td>
        <td><strong><?php echo htmlentities ($t_email);?></strong></td>
      </tr>
      <tr>
        <td> </td>
        <td><strong><?php echo htmlentities ($t_telefon);?></strong></td>
      </tr>
      <tr>
        <td> </td>
        <td> </td>
      </tr>
      <tr>
        <td colspan="2" bgcolor="#E4E4E4"><h2>Maklumat Akaun </h2></td>
        </tr>
      <tr>
        <td><div align="right">Kategori Akaun : </div></td>
        <td><strong><?php echo htmlentities ($trade_cat);?></strong></td>
      </tr>
  <tr>
    <td><div align=right>Introducer : </div></td>
    <td><strong><?php echo htmlentities ($intro) ;?></strong></td>
    </tr> 
      

    </table></td>
  </tr>
</table>
</body>
</html>

 

the problem is, at list_details.php, its contain no data..  pls help me

Link to comment
https://forums.phpfreaks.com/topic/167091-data-missing/
Share on other sites

checklogin.php:

 

<?php

ob_start();
$host="localhost"; // Host name 
$username="admin"; // Mysql username xx
$password="123"; // Mysql password 
$db_name="account"; // Database name 
$tbl_name="members"; // 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 $t_nick and $t_password 
$t_nick=$_POST['t_nick']; 
$t_password=$_POST['t_password'];

// To protect MySQL injection (more detail about MySQL injection)
$t_nick = stripslashes($t_nick);
$t_password = stripslashes($t_password);
$t_nick = mysql_real_escape_string($t_nick);
$t_password = mysql_real_escape_string($t_password);

$sql="SELECT * FROM $tbl_name WHERE t_nick='$t_nick' and t_password='$t_password'";
$result=mysql_query($sql);
// Mysql_num_row is counting table row
$count=mysql_num_rows($result);
// If result matched $t_nick and $t_password, table row must be 1 row

if($count==1){
// Register $t_nick, $t_password and redirect to file "list_details.php"
$_SESSION["t_nick"] = $t_nick;
$_SESSION["t_password"] = $t_password;
//echo $t_nick;
//exit;
header("location:list_details.php");
}
else {
echo "Wrong Username or Password";
}

ob_end_flush();
?>

 

Just so you know, I redefined session_register with $_SESSION[''], as session_register is depreciated according to the PHP Manual.

Link to comment
https://forums.phpfreaks.com/topic/167091-data-missing/#findComment-881129
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.