Mailinglisten-Archive |
>Message: 14
>From: "Robert Breker" <breker_(at)_garagestudios.de>
>To: <php_(at)_solix.wiso.uni-koeln.de>
>Subject: Re: [php] Bekomme 500er Error beim Form versenden...
>Date: Thu, 11 Nov 1999 21:30:58 +0100
>charset="iso-8859-1"
>Reply-To: php_(at)_infosoc.uni-koeln.de
>
>wie wärs den mal wenn du das script mitschickst? raten kann jeder!
>cu
Ok, ich dachte es würde mit der Server Config zusammen hängen, deshalb
wollte ich nicht gleich die Liste mit einem SuperPosting voll pumpen.
Hier nun das besagte Script:
<form method="post" action="<?php echo $PHP_SELF; ?>">
<input type="text" name="username" maxlength="80">
<input type="text" name="email" maxlength="120">
<input type="password" name="password" maxlength="80">
<input type="password" name="password2" maxlength="80">
<input type="reset" name="Reset" value="Reset">
<input type="submit" name="Submit" value="Submit">
</form>
<?php
function db_connect () {
//globale $db_hostname;
//globale $db_username;
//globale $db_password;
//globale $db_dbname;
mysql_pconnect("$db_hostname","$db_username","$db_password"
mysql_pconnect("$db_hostname","$db_username","$db_password"); //
verbinden (dauerhaft)
mysql_select_db("$db_dbname");
// datenbank wählen
if (mysql_errno() != 0)
{ // fehlerabfrage
echo mysql_errno().": ".mysql_error();
}
}
function db_write_user ($username,$password,$email) {
//globale $db_user_table;
$query = "INSERT INTO $db_user_table
(Username,Password,Email) VALUES (\'$username\',\'$password\',\'$email\'";
mysql_query($query); // in db schreiben
if (mysql_errno() != 0)
{ // fehlerabfrage
echo mysql_errno().": ".mysql_error();
}
}
// Variablen:
// $username
// $password
// $password2
// $email
// $submit
if (isset($submit)) {
if (isset($username)) {
if (isset($password)) {
if (isset($password2)) {
if (isset($email)) {
if ($password == $password2) {
// Daten in die DB schreiben
$db_return = db_connect();
if ($db_return == true) {
$db_wreturn =
db_write_user($username,$password,$email);
if ($db_wreturn == true) { echo
"Submission Added successfully."; }
}
if ($db_return == false) {
echo "An Error occured.";
}
}
else {
echo "Your passwords are invalid.\n";
echo "This happens when the two passwords
you entered are not the same.\n";
echo "Use the back-button of your browser
to change the submission.";
}
} } } }
else {
echo "Your submission was incomplete.\n";
echo "You must fill out ALL fields!\n";
echo "Use the back-button of your browser and
submit again.";
}
}
?>
php::bar PHP Wiki - Listenarchive