'; if ($name == '') $errors .= '- You need to enter your name.
'; if ($email == '') $errors .= '- You need to enter your email address.
'; if (!validate_email($email)) $errors .= '- Your email address doesn\'t appear to be valid.
'; $any_bitches = false; $do_changes = true; if ($_POST['submit'] == ' Remove ') { if (($_POST['remove'] > 0) and ($_POST['remove'] < 31)) { $rem = safe('bitch' . $_POST['remove']); $_POST['bitch' . $_POST['remove']] = ''; mysql_query("DELETE FROM $Table WHERE name=\"$rem\" LIMIT 1"); $do_changes = false; } } elseif ((!$editid) and (!$errors)) { // check if user is trying to add a dupe group! $findit = mysql_query("SELECT grouping FROM $Database.$Group WHERE grouping=\"$group\""); if (mysql_num_rows($findit) > 0) $errors .= '- A group already exists with this name!
'; } $bitch_array = array(); $dupe_bitch = false; for ($i=1; $i<=30; $i++) { ${"bitch$i"} = safe("bitch$i"); if (${"bitch$i"} != '') { $any_bitches = true; if (in_array(${"bitch$i"}, $bitch_array)) $dupe_bitch = true; $bitch_array[] = ${"bitch$i"}; } } if (!$any_bitches) $errors .= '- You need to enter at least one brew drinker!
'; elseif ($dupe_bitch) $errors .= '- Each member\'s name needs to be unique!
'; if (($do_changes) and ($editid)) { // check pass if ($pass1 == '') $errors .= '- You need to enter a password!
'; elseif ($pass1 != $pass2) $errors .= '- Your passwords do not match.
'; if (!$errors) { // update $findit = mysql_query("SELECT b.id, b.name AS bname FROM $Table AS b WHERE b.grouping=\"$editid\""); $bitches = array(); if (mysql_num_rows($findit) > 0) { while ($r = mysql_fetch_assoc($findit)) $bitches[$r['bname']] = $r['bname']; } // upd $upd = mysql_query("UPDATE $Group SET name=\"$name\", email=\"$email\", pass=\"$pass1\", grouping=\"$group\" WHERE grouping=\"$editid\""); // update all bitches in group $upd = mysql_query("UPDATE $Table SET grouping=\"$group\" WHERE grouping=\"$editid\""); // now do dels/ insert for ($i=1; $i<=30; $i++) { $bitch = ${"bitch$i"}; if ($bitch != '') { if (!in_array($bitch, $bitches)) { $ins = mysql_query("INSERT INTO $Table (name, drank, made, grouping) VALUES (\"" . $bitch . "\", 0, 0, \"$group\")"); } else unset($bitches[$bitch]); } } /* // any to remove? if (count($bitches) > 0) { foreach ($bitches as $bitchremove) { if ($bitchremove != '') { $upd = mysql_query("DELETE FROM $Table WHERE name=\"$bitchremove\" LIMIT 1"); } } } */ // finally update login details and redirect! $_SESSION['cbgroup'] = $group; header ("Location: ?mode=success&type=update\n\n"); exit(); } } elseif (($do_changes) and (!$errors)) { // check the crapta! $br1 = $_POST['br1']; $br2 = $_POST['br2']; $botcheck = $_POST['botcheck']; if (($br1 + $br2 != $botcheck) or ($botcheck < 1)) { print '

Ah ah ah, you didn\'t say the magic word!

'; } else { // random password! $pass = generatePassword(6); // no errors, insert! $ins = mysql_query("INSERT INTO $Group (grouping, pass, email, name) VALUES (\"$group\", \"$pass\", \"$email\", \"$name\")"); // insert bitches for ($i=1; $i<=30; $i++) { if (${"bitch$i"} != '') $ins = mysql_query("INSERT INTO $Table (name, drank, made, grouping) VALUES (\"" . ${"bitch$i"} . "\", 0, 0, \"$group\")"); } mail ("$name <$email>", "'$group' coffee-bitch.co.uk account details", "Hi $name!\n\nThanks for setting up the '$group' coffee-bitch drinkers group.\n\nWe hope you enjoy the site and that it provides many hours of enjoyable democratically made beverage drinking!\n\nYour login information is as follows:\n\ngroup: $group\npassword: $pass\n\nYou can now log in and start to select who gets the kettle on!\n\nBest wishes,\n\nThe coffee-bitch team", "Coffee-bitch Team \n\r"); header ("Location: ?mode=success\n\n"); exit(); } } } else { if ($editid) { $findit = mysql_query("SELECT g.pass, g.email, g.name, b.name AS bname FROM $Group AS g, $Table AS b WHERE g.grouping=b.grouping AND g.grouping=\"$editid\""); // prepopulate $i = 1; if (mysql_num_rows($findit) > 0) { while ($r = mysql_fetch_assoc($findit)) { $group = $editid; $name = $r['name']; $pass1 = $r['pass']; $pass2 = $r['pass']; $email = $r['email']; if ($r['bname'] != '') { $_POST["bitch$i"] = $r['bname']; $i++; } } } else $editid = false; } } if ($_GET['mode'] == 'success') { if ($_GET['type'] == 'update') { print '

Thank you!

Your group has been amended successfully.

'; print '

Why not mosey on back to the Account page?

'; } else { print '

Thank you!

Your group has been set up, and you are ready to start democratically choosing who gets the kettle on!

We\'ve emailed your login information to the email address you provided when you signed up.

Once you receive this information, you can login and start to use the site. If you don\'t receive the email shortly then please let us know. You can also use the "remind me" function on the login page to send a reminder of your details if you delete the welcome email and forget your details.

'; print '

Why not mosey on down to the coffee selector login page?

'; } footer(); exit; } ?>

Sign Up to Coffee Bitch!

Just fill in a few simple details and the days of one poor sod having to make the brews each time will finally be over!

Your group name is visible on the hencam website so please don't abuse this. Your group members will NOT appear on the site - your privacy is important to us. Coffee Bitch is fun to use and completely free forever!

The following errors were detected:
$errors"; ?>

Step 1: choose a 'group' name

The 'group' is the name of your office team which your colleagues will be added to.



Step 2: Enter your name

We'll use this to say hello to you.



Step 3: Enter your email address

We send your password to this address when you sign up and if you request a reminder.

We hate spam as much as you do: we won't sell or pass on your details or email you anything.


Step 4: Enter your team members

We just need names so we can show you who got picked! First names or full names, it's up to you. You can enter up to 30 drinkers!

1) $pbitch = $bitch; $bitch = preg_replace('/"/', '"', $_POST['bitch' . $i]); ?>
'> Team member :
value="" /> '; ?>

Do you want to change your password?

Enter your new password in the space provided and confirm it and we'll update it for you. Don't touch it if you don't want to change it!

Password
Confirm


Step 5: Prove you are human!

Annoyingly we sometimes get bots trying to sign up - it's not like they can send emails or post things on here, but we kill them anyway! Please answer this question to prove you are a real human.



"; } ?>