[NUUG logo]
Førstesiden
Informasjon
Kalender
NUUG/HIO prisen
Vedtekter
Dokumenter
Innmelding
Ressurser
Kontakt
Linker
Om medlemsmøter
Om de aktive

Sist endret 2003.07.07 17:21
webmaster@nuug.no
[0,9] else if ($randomNumber < 37) $password .= Chr($randomNumber + 65 - 10); // [11,36] => [A,Z] else $password .= Chr($randomNumber + 97 - 36); // [37,62] => [a,z] } return $password; } //========================================= function regform($name,$email,$organisation,$comment) { echo "
Name:
Email:
Organisation:
Comment:
"; } //========================================= function save_details($name,$email,$organisation,$comment) { $ipaddress = $_SERVER[REMOTE_ADDR]; global $PHP_SELF; global $mailfrom; global $db_table; global $limit; $sql = "SELECT count(*) from $db_table"; $res = mysql_query($sql); $count = 0; if (mysql_num_rows($res) > 0) { $count = mysql_result($res, 0); } if (!isset($password)) { $password = RandomPassword(8); } $sql = "SELECT password from $db_table where email = '$email'"; $res = mysql_query($sql); if (mysql_num_rows($res) > 0) { // check password and update if (mysql_result($res, 0) == $password) { // same password, save. $sql = "UPDATE $db_table SET IpAddress = '$ipaddress', Name = '$name', organisation = '$organisation', comment = '$comment' where email = '$email'"; mysql_query("$sql"); } else { // wrong password! echo "

Wrong password

\n"; echo "It seems like you entered the wrong password, please log \n"; echo "in again and try again, or you have tried to register \n"; echo "multiple times with the same address. Please \n"; echo "log in instead.\n"; exit(); } } else { if ($count > $limit) { echo "

We have reached the registration limit of $limit people.\n"; echo "The registration is now closed.

\n"; return; } // just save $sql = "INSERT INTO $db_table (IpAddress,Name,Email,organisation, comment, password) VALUES ('$ipaddress','$name','$email', '$organisation', '$comment', '$password')"; mysql_query("$sql"); mail("$email", "NUUG Summer Party registration", " Thanks for your registration for the NUUG Summer Party! Just to give you a reminder, the party will be held on... Thursday, July 17th 2003, from 18:30 in the Chemistry Building Atrium, Blindern See the map at for further directions. The Chemistry building is number 23 on the map, and the main entrance is from Apalveien. IBM and HP are sponsoring the Barbecue food and the first drink! Beyond that, you'll have to bring your own. If you want to change your registry information, please go to <$PHP_SELF?command=login> and log in using your email address and the following password: $password Welcome to the NUUG Summer Party. Kind regards, - The NUUG Summer Party Committee (This subscription request was recieved from IP address $ipaddress) ","From: \"NUUG Summer Party Committee\" <$mailfrom>" ); } echo "Thanks, your registration has been saved with the following details:\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "
Name: $name
Email: $email
Organisation: $organisation
Comment:$comment
Ip Address: $ipaddress
\n"; echo "Change information\n"; } //========================================= function show_form($name,$email,$organisation,$comment) { global $PHP_SELF; global $limit; global $db_table; $sql = "SELECT count(*) from $db_table"; $res = mysql_query($sql); $count = 0; if (mysql_num_rows($res) > 0) { $count = mysql_result($res, 0); } echo "

NUUG Summer Party registration

We need to know how many people will attend to know how much food we need to buy. The registration will be closed 2003-07-15 16:00 +0200 or when we reach $limit registrations, whichever comes first.

NUUG will provide marinated chicken, chops, potato salad, baguettes, mixed salad, butter, mayonnaise and dressing. We will also provide something to drink. If you want something else, you will have to bring your own. The barbecue will be available if you want to grill some of the things you bring.

Currently there are $count (out of max $limit) registered partygoers.

"; if ($count > $limit) { echo "

We have reached the registration limit of $limit people.\n"; echo "The registration is now closed.

\n"; return; } echo "

\n"; echo "\n"; regform($name,$email,$organisation,$comment); echo "\n"; echo "
\n"; echo "Change information | \n"; echo "Lost password

\n"; } //========================================= function do_login($email,$password) { global $PHP_SELF; global $db_table; $sql = "SELECT * from $db_table where email = '$email' and password = '$password'"; $res = mysql_query("$sql"); $arr = mysql_fetch_array($res); if ($arr == FALSE) { // Login failed echo "

Login failed

\n"; echo "

Either the email or the password was wrong, please log in again or have it mailed to you.

"; } else { echo "

NUUG Summer Party registration

"; echo "
\n"; echo "\n"; echo "\n"; regform($arr["Name"], $arr["Email"],$arr["organisation"],$arr["comment"]); echo "\n"; echo "
\n"; } } //========================================= function show_login_form($email,$password) { echo "

NUUG Summer Party registration

"; echo "

Please log in using the email and password mailed to you" . " earlier

"; echo "
\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "
Email:
Password:
"; echo "\n"; echo "
\n"; } //========================================= function confirm_form($name,$email,$organisation,$comment) { echo "Please confirm that these details are correct:\n"; echo "
\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "
Name: $name
Email: $email
Organisation: $organisation
Comment: $comment
\n"; echo "\n"; echo "\n"; echo "
"; } //========================================= function show_lostpasswd_form() { global $PHP_SELF; echo "Please enter the email address you used when registering for the NUUG Summer Party:\n"; echo "
\n"; echo "\n"; echo "\n"; echo "\n"; echo "
"; } //========================================= function mail_lostpasswd($email) { $ipaddress = $_SERVER[REMOTE_ADDR]; global $PHP_SELF; global $mailfrom; global $db_table; $sql = "SELECT * from $db_table where email = '$email'"; $res = mysql_query("$sql"); $arr = mysql_fetch_array($res); if ($arr == FALSE) { // No such mail echo "

No such email

Sorry, but it seems like $email has not signed up for the NUUG Summer Party. Perhaps you used a different mail address?

"; } else { $password = $arr["password"]; mail("$email", "NUUG Summer Party lost password reminder", " Your password on the NUUG Summer Party site is $password . Please go to $PHP_SELF?command=login to change your information. (This subscription request was recieved from IP address $ipaddress) -- The NUUG Summer Party Committee ","From: \"The NUUG Summer Party Committee\" <$mailfrom>"); echo "

Password mailed

Your password has been mailed to you.

"; } } //========================================= //echo "co: $command

"; if($command == "check_details") { confirm_form($name,$email,$organisation,$comment,$password); } elseif($command == "confirm") { save_details($name,$email,$organisation,$comment,$password); } elseif($command == "login") { show_login_form($email,$password); } elseif($command == "do_login") { do_login($email,$password); } elseif($command == "lostpasswd") { show_lostpasswd_form(); } elseif($command == "mail_lostpasswd") { mail_lostpasswd($email); } else { show_form($name,$email,$organisation,$comment,$password); } ?>