/src/activate/content.php

https://bitbucket.org/paullik/dotophp · PHP · 55 lines · 44 code · 3 blank · 8 comment · 3 complexity · a57c28d99201ac4504cc416f37c57400 MD5 · raw file

  1. <?php
  2. /**
  3. * @file src/activate/content.php
  4. * @brief HTML for the activate module
  5. * @author Paul Barbu
  6. *
  7. * @ingroup activateFiles
  8. */
  9. if($feedback['activate']){
  10. ?>
  11. <form method="post" action="" >
  12. <table border="0" cellspacing="5">
  13. <tr><td>
  14. <label for="code">Activation code:</label></td><td><input type="text" maxlength="10"
  15. name="code" id="code" <?php isset($_GET['code']) ? list($_GET['code']) = filterInput($_GET['code']) : NULL;
  16. echo isset($_GET['code']) && !empty($_GET['code']) ? 'value="' . $_GET['code'] . '" disabled' : 'tabindex="1"' ?> />
  17. </td></tr><tr><td>
  18. <label for="pass">Password:</label></td><td><input tabindex="2" type="password" maxlength="30" id="pass" name="pass" />
  19. </td></tr><tr><td>
  20. <label for="passconfirm">Confirm password:</label></td><td><input tabindex="3" type="password" maxlength="30" id="passconfirm" name="passconfirm" />
  21. </td></tr><tr><td>
  22. <label for="question">Security question:</label></td><td><input tabindex="4" type="text" maxlength="255" id="question" name="security_q" />
  23. </td></tr><tr><td>
  24. <label for="answer">Security answer:</label></td><td><input tabindex="5" type="text" maxlength="255" id="answer" name="security_a" />
  25. </td></tr><tr><td colspan="2"><center>
  26. <input tabindex="6" type="submit" value="Activate!" name="activate" />
  27. <input tabindex="7" type="reset" name="reset" value="Reset" />
  28. </center></td></tr>
  29. </table>
  30. </form>
  31. <?php
  32. if(is_numeric($feedback['activate'])){
  33. echo '<h3>';
  34. switch($feedback['activate']){
  35. case A_ERR_PASS: printf('Passwords don\'t match or aren\'t between 6 and 30 valid characters! (#%d)', A_ERR_PASS);
  36. break;
  37. case A_ERR_CODE: printf('Invalid activation code! (#%d)', A_ERR_CODE);
  38. break;
  39. case A_ERR_DB_CONNECTION: printf('Error connecting to the database! (#%d)', A_ERR_DB_CONNECTION);
  40. break;
  41. case A_ERR_SECURITY_DATA: printf('The question and the answer bust be between 8 and 255 valid characters long! (#%d)', A_ERR_SECURITY_DATA);
  42. break;
  43. case A_ERR_DB: printf('A database related error occured, please contact the administrator! (#%d)', A_ERR_DB);
  44. break;
  45. }
  46. echo '</h3>';
  47. }
  48. }
  49. elseif(!$feedback['activate']){
  50. echo '<h3>Account activated!</h3>';
  51. }
  52. /* vim: set ts=4 sw=4 tw=80 sts=4 fdm=marker nowrap et :*/