Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [root@forgetful compsoc_man_ac_uk]# cat newmember-new.php
- <?php
- $memberuser = $_REQUEST['username'];
- $memberemail = $_REQUEST['email'];
- // no email posted, error out
- if(!isset($_REQUEST['email']))
- $state=3;
- else {
- // this is when the user has submitted the form
- if(isset($_REQUEST['username'])){
- $state=1;
- $to = "coopted@compsoc.man.ac.uk";
- $subject = "New sign up";
- $body = "We just had a new user sign up with the following details:\n\nEmail address: $memberemail\nDesired username: $memberuser\n\nRegards,\n\nQuiet\n";
- if(!mail($to, $subject, $body))
- $state=2;
- }
- else
- $state=0;
- }
- // There are four possible states for this page:
- // (a) the user has been sent here by the union website with an email
- // variable in the address line. Need to ask them for a compsoc username.
- // (b) the user has just submitted a username, so email this information to
- // admin@compsoc. TODO: automated LDAP?
- // (c) php mail sending fails, get the user to email admin@compsoc.
- // (d) user loads the page without email variable, either union sucks or user
- // is trying to break things.
- // These correspond to states 0,1,2,3.
- ?>
- <html>
- <head>
- <title>COMPSOC - Member</title>
- <link rel="stylesheet" href="local.css" type="text/css" />
- </style>
- </head>
- <body>
- <?php include 'navigation.html';?>
- <div class=content>
- <h1>The University of Manchester Computer Society</h1>
- <h2>Thanks for joining</h2>
- <?php
- if($state==0) {
- ?>
- <p>You are now a registered member of compsoc. To sign in to any of our services you will need a username. Please provide your desired username in the box below and click submit. At the moment we still need to enter your details manually, but we will aim to have your account set up in 24 hours.</p>
- <form method=post>
- <input type=text name=username />
- <input type=hidden value="<?php echo $memberemail; ?>" name=email />
- <input type=submit />
- </form>
- <?php } else if($state==1) { ?>
- <p>Great! We'll try and have your account active in 24 hours. We'll email you when it's done. If you have any questions in the meantime, don't hesitate to mail us (<a href="mailto:admin@compsoc.man.ac.uk">admin@compsoc.man.ac.uk</a>).</p>
- <?php } else if($state==2) { ?>
- <p>Sorry, but our automated system isn't working at the moment. Please email <a href="mailto:admin@compsoc.man.ac.uk">admin@compsoc.man.ac.uk</a> to request a username and we'll sort your account out as soon as possible.</p>
- <?php } else if($state==3) { ?>
- <p>Hmm, we can't sign you up without an email. If you've reached this page through the union then they've broken something. Please email <a href="mailto:admin@compsoc.man.ac.uk">admin@compsoc.man.ac.uk</a> with your desired compsoc username and let us know this is broken so we can get it fixed.</p>
- <?php } else { ?>
- <p>Some idiot has broken this form. Please email <a href="mailto:admin@compsoc.man.ac.uk">admin@compsoc.man.ac.uk</a>.</p>
- <?php } ?>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement