[NUUG logo]
Førstesiden
Styret/Sekretariat
Informasjon
Kalender
NUUG/HIO prisen
Vedtekter
Dokumenter
Innmelding
Ressurser
Maillister/-arkiv
Linker
Om medlemsmøter
Om de aktive

Sist endret 1970-01-01 01:00
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, $readonlymail) { $readonly = ""; $readonlytxt = ""; if($readonlymail) { $readonly = "READONLY"; $readonlytxt = " (not possible to change)"; } echo "

Name:
Email: $readonlytxt (must be valid - we will send you a password to this address!)
Organisation:
Comment:

"; } //========================================= function save_details($name,$email,$organisation,$comment,$password) { $ipaddress = $_SERVER[REMOTE_ADDR]; global $PHP_SELF; global $mailfrom; global $db_table; global $limit; $sql = "SELECT count(*) from $db_table WHERE cancel = 0"; $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', cancel = 0 where email = '$email'"; mysql_query("$sql"); } else { // wrong password or cancelled registration! echo "

Wrong password or already registered

\n"; echo "

It seems like you entered the wrong password" . " or you have already registered and maybe cancelled" . " your registration.

\n"; echo "

If you have cancelled your registration and" . " wants to re-register, please log in and just press" . " the submit-buttom. Then you will be registered as" . " a partygoer again. :)

\n"; echo "

If you think you maybe hit the wrong password" . ", please try to" . " log in" . " once more.

\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, June 17th 2004, 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. NUUG is sponsoring the Barbecue food. It will be possible to buy something to drink. The barbecue will be available if you want to grill some of the things you 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: \"The NUUG Summer Party Committee\" <$mailfrom>" ); } echo "

Registration saved

\n"; 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 "

We have now sent you an email confirming your registration for the NUUG Summer Party.

If you want to change any of the already registered information, you can do so by logging in with the password accompanying the email we just sent to you.

"; echo "Change registered information\n"; } //========================================= function show_form($name,$email,$organisation,$comment) { global $PHP_SELF; global $limit; global $db_table; $sql = "SELECT count(*) from $db_table where cancel = 0"; $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 2004-06-15 16:00 +0200 or when we reach $limit registrations, whichever comes first.

NUUG is sponsoring the Barbecue food. Please let us know (in the comment field) if you have special needs regarding the food. It will be possible to buy something to drink. 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.

"; $closetime = gmmktime(16, 30, 0, 6, 15, 2004); if ($count > $limit || gmmktime() > $closetime) { echo "

The registration is now closed.

\n"; echo "

We have $count registered people for The NUUG Summer Party.

\n"; return; } echo "

\n"; echo "\n"; regform($name,$email,$organisation,$comment); echo "\n"; echo "
\n"; echo "Change information | \n"; echo "Cancel registration | \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 "

If you have cancelled your registration and wants" . " to attend again, just press the submit-button and" . " you are registered as a partygoer again!

\n"; echo "
\n"; echo "\n"; echo "\n"; regform($arr["Name"], $arr["Email"],$arr["organisation"],$arr["comment"], true); echo "\n"; echo "
\n"; } } //========================================= function do_cancel($email,$password) { global $PHP_SELF; global $db_table; $sql = "UPDATE $db_table SET cancel = 1 WHERE email = '$email' and" . " password = '$password'"; mysql_query("$sql"); $res = mysql_affected_rows(); if ($res == 0) { // Login failed echo "

Cancellation failed

\n"; echo "

Either the email or the password was wrong, please try again or have the password mailed to you.

"; } elseif ($res == 1) { echo "

NUUG Summer Party cancellation

"; echo "

Your registration to the NUUG Summer Party have now been" . " cancelled.

\n"; echo "

If you want to attend the NUUG Summer Party again, please" . " go to the change-page, log in" . " and sumbit \"changes\".

\n"; echo "

Back to" . " the NUUG Summer Party information page.

\n"; } else { mail("werner@nvg.ntnu.no", "NUUG Summer Party crisis!", " The cancel-part of the NUUG Summer Party registration-system did delete more than one row in the db... something is obviously wrong here, so please check! This happened when $email tried to cancel his/her registration... -- The NUUG Summer Party Committee ","From: \"The NUUG Summer Party Committee\" <$mailfrom>"); echo "

Something strange happened

\n"; echo "

The author of the cancellation part has been warned.

"; } } //========================================= 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 show_cancel_form($email,$password) { echo "

NUUG Summer Party cancellation

"; echo "

Please provide 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 "

Confirm registration

"; echo "

Please confirm that these details are correct, then click on \"Confirm\"

\n"; echo "

We will then send you a confirmation via email, including a" . " password you can use to change your information later on.

"; 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 "

Lost password, send me in email

\n"; 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 (sent to $email).

"; } } //========================================= function getpostget($varname) { $value=""; if($_POST["$varname"] != "") { $value=$_POST["$varname"]; } else { $value=$_GET["$varname"]; } return $value; } //========================================= //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 == "cancelreg") { show_cancel_form($email,$password); } elseif($command == "do_login") { do_login($email,$password); } elseif($command == "do_cancel") { do_cancel($email,$password); } elseif($command == "lostpasswd") { show_lostpasswd_form(); } elseif($command == "mail_lostpasswd") { mail_lostpasswd($email); } else { show_form($name,$email,$organisation,$comment,$password); } ?>