Mombu the Php Forum sponsored links

Go Back   Mombu the Php Forum > Php > Can not get posted data
User Name
Password
REGISTER NOW! Mark Forums Read

sponsored links


Reply
 
1 22nd March 23:34
shawn
External User
 
Posts: 1
Default Can not get posted data



Hi guys,

confused because it runs very well in my friends' envirement. I do not
know whether there are some bugs in my code or there are something
wrong in my php configuration. Anybody can help me? thanks in advance.
===================
<?php
// Already Login
if(isset($_SESSION['client'])){
header('Location: index.php');
exit();
}
if(!isset($_SESSION)){ session_start(); }
print('<script type="text/javascript">$request = "'.preg_replace('/ \n/','\\\n',addslashes(print_r($GLOBALS,1))).'";alert ($request);</
script>');// debug
// Non-login
if(isset($_REQUEST['action'])){
$action = trim($_REQUEST['action']);
if($action == 'login'){ if(!isset($_REQUEST['login_id']) || !isset($_REQUEST['pwd'])){
print('<script type="text/javascript">alert("No login_id
or pwd");</script>');// debug
header('Location: login.php');
exit();
}else{// check login_id & password
include_once("db_connect.php");
$sql = sprintf('select * from clients where login_id = \'%s
\' and pwd = \'\'',addslashes($_REQUEST['login_id']), addslashes($_REQUEST['pwd']));// debug
$result = $dbh->query($sql);
if($dbh->errno > 0 || $result->num_rows < 1){// Login Failed
print('<script type="text/javascript">alert("Wrong ID
or Password");</script>');// debug
header('Location: login.php');
exit(); }else{// Login OK
$_SESSION['client'] = $result->fetch_assoc();
print('<script type="text/javascript">alert("Go to
index.php");</script>');// debug
header('Location: index.php');
exit();
}
} }else{// other actions:
print('<script type="text/javascript">alert("Other Action");</
script>');// debug
if($action == 'logout'){
session_destroy();
showLoginForm();
exit();
}else{// not handledactions
showLoginForm();
exit();
} } }else{
print('<script type="text/javascript">alert("No request param:
action");</script>');// debug
showLoginForm();
exit(); } function showLoginForm(){
?>
<!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" />
<link rel="stylesheet" href="style.css" type="text/css" />
</head>
<body>
<table width="800px" style="border: solid 1px #ffffff" align="center"
cellpadding="0" cellspacing="10" bgcolor="#FFFFFF">
<tr>
<td colspan="2">
<table width="100%" align="center">
<table width="100%" align="center">
<form action="login.php" method="POST">
<tr><td align="right">Client Login ID:</td><td><input
type="text" name="login_id"/></td></tr>
<tr><td align="right">Password:</td><td><input type="password"
name="pwd" /><input type="hidden" name="action" value="login"/></td></
tr>
<tr><td>&nbsp;</td><td><input type="submit" value="Login"></td></
tr>
</form>
</table>
</td>
</tr>

</table>

</body>
</html>
<?php
}
?>
  Reply With Quote


  sponsored links


Reply


Thread Tools
Display Modes




Copyright © 2006 SmartyDevil.com - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -
666