Guest User

Untitled

a guest
May 24th, 2013
225
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.87 KB | None | 0 0
  1. <?php
  2. session_start();
  3. include_once 'includes/db.php'; // database connection PDO
  4. include_once 'includes/Wall_Updates.php'; // Public Functions PDO
  5.  
  6. if(!empty($_SESSION['_iD'])) {
  7. header("location:index.php");
  8. }
  9. $Wall = new Wall_Updates( $db );
  10.  
  11. //Registration
  12. $reg_error = '';
  13. if(isset($_POST['password']) && isset($_POST['email']) && isset($_POST['username'])) {
  14. if (strlen($_POST['password']) > 0 && strlen($_POST['email']) > 0 && strlen($_POST['username']) > 0 ) {
  15. $reg = $Wall->User_Registration($_POST['password'],$_POST['email'],$_POST['username']);
  16. if($reg) {
  17. $_SESSION['_iD'] = $reg;
  18. header("location:index.php");
  19. } else {
  20. $reg_error="<span class='error'>Email already exists.</span>";
  21. }
  22. }
  23. }
  24. ?>
  25. <!DOCTYPE html>
  26. <html>
  27. <head>
  28. <script type="text/javascript" src="ajaximage/scripts/jquery.form.js"></script>
  29. <script type="text/javascript" >
  30. $(document).ready(function() {
  31.  
  32. $('#photoimg').live('change', function() {
  33. $("#preview").html('');
  34. $("#preview").html('<img src="loader.gif" alt="Uploading...."/>');
  35. $("#imageform").ajaxForm({
  36. target: '#preview'
  37. }).submit();
  38.  
  39. });
  40. });
  41. </script>
  42. </head>
  43.  
  44. <body>
  45. <form id="imageform" method="post" enctype="multipart/form-data" action='register_image_upload.php'>
  46. Upload your image <input type="file" name="photoimg" id="photoimg" />
  47. </form>
  48. <div id='preview'></div>
  49.  
  50. <form method="POST" action="" name="reg">
  51. <div id="label">Email:</div>
  52. <input type="text" name="email" id="email">
  53. <div id="label">User Name:</div>
  54. <input type="text" name="username" id="username">
  55. <div id="label">Password:</div>
  56. <input type="password" name="password" id="password">
  57. <input type="submit" class="reg" name="submit" value="CREATE">
  58. </form>
  59. </body>
  60. </html>
Advertisement
Add Comment
Please, Sign In to add comment