Changeset 244


Ignore:
Timestamp:
02/07/12 18:07:38 (13 years ago)
Author:
hendrikvanantwerpen
Message:

Inlogscherm werkt met jQuery UI! Woot!

Location:
Dev/branches/jQueryUI
Files:
383 added
1 edited

Legend:

Unmodified
Added
Removed
  • Dev/branches/jQueryUI/index.php

    r235 r244  
    11<?php
    22require 'classes/master.php'; //should be at top of every page
    3 
    4 /*  Page still has ambiguous design. Login and Register buttons are at same hierarchy level, makes user suspect the register button works based on input given here.
    5  *  Instead redirects to anoter page.
    6  *   
    7  */
    8 
    9 $errorMessage[] = "";
    10 
    11 if (isset($_POST['register'])) {
    12     if (isset($_POST['username']) && isset($_POST['password'])) {
    13         $user_results = User::get(array("name" => $_POST['username']));
    14         if (count($user_results) == 0 || !$user_results) {
    15             if (strlen($_POST['password']) > 6) {
    16                 $user = new User(null, $_POST['username'], $_POST['password']);
    17                 $user->save();
    18                 $_SESSION['userUid'] = $user->uid;
    19             } else {
    20                 $errorMessage[] = "Password is too short";
    21             }
    22         }
    23         else
    24             $errorMessage[] = "Username already exists, try something else!";
    25     }
    26     else
    27         $errorMessage[] = "Please fill in a username and password";
    28 }
    29 
    30 if (isset($_POST['login'])) {   // User clicked the login button
    31     $user_results = User::get(array("name" => $_POST['username']));
    32     if (isset($user_results[0])) {
    33         if ($user_results[0]->password == $_POST['password']) {
    34            
    35             $_SESSION['userUid'] = $user_results[0]->uid;
    36             var_dump($user_results[0]);
    37         } else {
    38             $errorMessage[] = "Incorrect password!";
    39         }
    40     } else {
    41         $errorMessage[] = "Username doesn't exist!";
    42     }
    43 }
    44 
    45 if (isset($_SESSION['userUid'])) {  // User just registered a new account
    46     redirect('mainmenu.php');
    47 }
    483?>
    494
     
    538        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    549        <title>Facilitator</title>
     10
     11        <link type="text/css" href="js/jquery/themes/ui-lightness/jquery-ui-1.8.17.custom.css" rel="stylesheet" />     
     12        <script type="text/javascript" src="js/jquery/jquery-1.7.1.js"></script>
     13        <script type="text/javascript" src="js/jquery/ui/jquery-ui-1.8.17.custom.js"></script>
     14        <script type="text/javascript" src="js/main.js"></script>
    5515        <?php new StyleSheet("visualeditors"); ?>
    56         <script type="text/javascript" src="js/menu.js"></script>
    57         <script type="text/javascript">
    58        
    59    
    60 
    61         </script>
    6216    </head>
    6317    <body>
     
    6620        </div>
    6721
     22        <div id="loginForm" class="ui-dialog">
     23            <form>
     24                <fieldset>
     25                    <label for="username">Name</label><input id="username" type="text" />
     26                    <label for="password">Password</label><input id="password" type="text" />
     27                </fieldset>
     28            </form>
     29        </div>
     30
    6831        <div id="wrapper">
    6932
    7033            <div id="content">
    71                 <div class="largeFrame">
    72                     <div class="largeTitle">Log in</div>
    73                     <div class="content">
    74                         <form action="index.php" method="POST">
    75                             <h3>Username</h3>
    76                             <input type="text" name="username"><br />
    77                             <h3>Password</h3>
    78                             <input type="password" name="password"><br/><br />
    79                             <div id="errorDisplay">
    80                                 <?php
    81                                 foreach ($errorMessage as $message) {
    82                                     echo "<h3 style='color: #FF0000;'>$message</h3>";
    83                                 }
    84                                 ?>
    85                             </div>
    86                             <br/>
    87                             <input type="submit" name="login" class="bigButton vertical" value="Log in">
    88                         </form>
    89                         <form action="register.php" method="POST">
    90                             <input type="submit" name="register" class="bigButton vertical" value="Register" style="margin-bottom: 0.25em;">
    91                         </form>
    92                     </div>
    9334
     35
     36                <div id="info" class="largeFrame">
    9437                </div>
     38               
    9539            </div>
    9640        </div>
Note: See TracChangeset for help on using the changeset viewer.