You are here: Re: POST, GET and variables ? « PHP Programming Language « IT news, forums, messages
Re: POST, GET and variables ?

Posted by dirk on 02/15/07 19:19

Kimmo Laine wrote:

>
> Please post some code. The form itself would be quite helpful. What is
> the output of <?php print_r($_POST); ?>
>
Thanks for your reply. If both input-text-fields were filled in, the
output of print_r($_POST) is : Array ( )
If only one input-text-field is filled in, output is : Array ( [email] =>
mail [pass] => ) or Array ( [email] => [pass] => password )
Here is the code :

<?php
$dbh=mysql_connect("localhost","user","pass") or die("Can't connect to
db!");
mysql_select_db("calendar") or die("Can't select db!");
session_start();
if (!$_SESSION["Login"]) {
if ($_POST['email'] AND $_POST['pass']) {
$Email=$_POST['email'];
$Pass=$_POST['pass'];
$mydb=mysql_query("SELECT ID from admin WHERE Email='$Email'
and Pass= MD5('$Pass') LIMIT 1");
if ($data=mysql_fetch_array($mydb)) {
$_SESSION["Login"]=$data["ID"];
}
$me=$_SERVER['PHP_SELF'];
header("Location: $me");
exit;
}
print <<<EOL
<head>
<title>Admin Console</title>
</head>
<body>

<h1>admin system</h1>
<form action=
EOL;
echo $_SERVER["PHP_SELF"];
print <<<EOL
method=post>
<p>Email<input type=text name=email></p>
<p> Pass<input type=password name=pass></p>
<input type=submit>
</form></body></html>
EOL;
die();

}
?>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация