Page 1 of 1
_POST help
Posted: Sat Jul 31, 2004 2:28 am
by lparnau
I have created a login page in Dreamweaver which logs you into a privite site. Dreamweaver uses Java or PhP to check for password and username. I need to find out what vars are being passed in the $_POST . The form uses the names username and password. I have used 2 different peices of code to try to find the username. It just does not seem to be there but it has to be??? Not knowing what is being passed can I just capture all the var and echo them to the screen?
Code: Select all
<?php global $HTTP_POST_VARS;echo $HTTP_POST_VARS['username']; echo $username; ?>
I also tried
<?php echo $_POST['username']; echo $_REQUEST['username']; import_request_variables('p', 'p_'); echo $p_username; ?>
?>
[/php_man]
Posted: Sat Jul 31, 2004 2:32 am
by feyd
does the username show if you run this as the form's action?
Code: Select all
<?php
session_start();
var_dump(array($_POST,$_GET,$_COOKIE,$_SESSION,$_SERVER));
?>
Posted: Sat Jul 31, 2004 3:04 am
by lparnau
Boy did that give me a lot of errors. I have inclosed the code this time I Think I put it in the right place. I changed
Code: Select all
<?php
(<form action= "<?php echo $loginFormAction; ?>")
?>
to
Code: Select all
<?php
(<form action= "<?php
session_start();
var_dump(array($_POST,$_GET,$_COOKIE,$_SESSION,$_SERVER));
?>
?>
Code: Select all
<?php
<?php require_once('../Connections/xxxxxxx.php'); ?>
<?php
// *** Validate request to login to this site.
session_start();
$loginFormAction = $_SERVER['PHP_SELF'];
if (isset($accesscheck)) {
$GLOBALS['PrevUrl'] = $accesscheck;
session_register('PrevUrl');
}
if (isset($_POST['username'])) {
$loginUsername=$_POST['username'];
$password=$_POST['password'];
$MM_fldUserAuthorization = "";
$MM_redirectLoginSuccess = "members_home.php";
$MM_redirectLoginFailed = "log-in_error.htm";
$MM_redirecttoReferrer = false;
mysql_select_db($database_dreamteam, $dreamteam);
$LoginRS__query=sprintf("SELECT username, password FROM dreamteam_db WHERE username='%s' AND password='%s'",
get_magic_quotes_gpc() ? $loginUsername : addslashes($loginUsername), get_magic_quotes_gpc() ? $password : addslashes($password));
$LoginRS = mysql_query($LoginRS__query, $dreamteam) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);
if ($loginFoundUser) {
$loginStrGroup = "";
//declare two session variables and assign them
$GLOBALS['MM_Username'] = $loginUsername;
$GLOBALS['MM_UserGroup'] = $loginStrGroup;
//register the session variables
session_register("MM_Username");
session_register("MM_UserGroup");
if (isset($_SESSION['PrevUrl']) && false) {
$MM_redirectLoginSuccess = $_SESSION['PrevUrl'];
}
header("Location: " . $MM_redirectLoginSuccess );
}
else {
header("Location: ". $MM_redirectLoginFailed );
}
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
<style type="text/css">
<!--
body {
background-color: #D9EFFF;
}
.style1 {
font-size: 24px;
font-style: italic;
font-weight: bold;
}
-->
</style></head>
<body>
<p> </p>
<table width="80%" border="1" align="center" cellpadding="4" cellspacing="0">
<tr>
<td align="center" bgcolor="#EFEFEF"><span class="style1">Welcome To The Dream Teams Login Page. </span></td>
</tr>
<tr>
<td align="center" valign="middle" bgcolor="#D4D0C8"><form action= "<?php echo $loginFormAction; ?>"
method="POST" name="dt_login" id="dt_login">
<p align="center">
<br>
Username:
<input name="username" type="text" size="35">
<br>
Password:
<input name="password" type="password" id="password" size="12">
<br>
<br>
<input type="submit" name="Submit" value="Submit">
</p>
</form></td>
</tr>
</table>
</body>
</html>
?>
Posted: Sat Jul 31, 2004 3:13 am
by feyd
I was actually intending it to be more like
form:
Code: Select all
//your form setup
... action="passeddata.php" method="POST" ......
passeddata.php would be a file with the code I asked you to run.
That showed me but
Posted: Sat Jul 31, 2004 3:43 am
by lparnau
Thank you this clearly showes both the "username" and "password" being passed.
Code: Select all
<?php
array(5) { [0]=> array(3) { ["username"]=> string(9) "webmaster" ["password"]=> string(8) "81510148" ["Submit"]=> string(6) "Submit" } [1]=> array(0) { } [2]=> array(1) { ["PHPSESSID"]=> string(32) "c4bc66d685341d0cd5df3b570fa009d9" }
?>
I do not understand why this does not work?
Code: Select all
<?php
echo $_POST['username'];
echo $_REQUEST['username'];
import_request_variables('p', 'p_');
echo $p_username;
?>