Changeset 208
- Timestamp:
- 01/06/12 10:29:09 (13 years ago)
- Location:
- Dev/branches/jos-branch
- Files:
-
- 12 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
Dev/branches/jos-branch/index.php
r60 r208 2 2 require 'classes/master.php'; //should be at top of every page 3 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 //Even voor tijdelijk, aangezien er nog pagina's missen en redirects daarom niet goed werken: 10 if (isset($_SESSION['userUid'])) { 11 redirect("logout.php"); 12 } 13 14 $errorMessage[] = ""; 15 4 16 if (isset($_POST['register'])) { 5 if ($_POST['username'] != null && $_POST['password'] != null) { 6 $userDBI = new UserDatabaseInterface(); 7 $user_exists = $userDBI->checkUserName($_POST['username']); 8 if (!$user_exists) { 9 $userDBI->addNewUser($_POST); 17 if (isset($_POST['username']) && isset($_POST['password'])) { 18 $dbi = new DatabaseInterface(); 19 $user_results = $dbi->get("user", array("name" => $_POST['username'])); 20 if (count($user_results) == 0 || !$user_results) { 21 if (strlen($_POST['password']) > 6) { 22 $user = new User(null, $_POST['username'], $_POST['password']); 23 $dbi->set($user); 24 $_SESSION['userUid'] = $user->uid; 25 } else { 26 $errorMessage[] = "Password is too short"; 27 } 10 28 } 11 29 else 12 echo "Username already exists, try something else";30 $errorMessage[] = "Username already exists, try something else!"; 13 31 } 14 32 else 15 echo "please fill in a username and password";33 $errorMessage[] = "Please fill in a username and password"; 16 34 } 17 35 18 if (isset($_SESSION['username'])) 19 redirect('mainmenu.php'); 36 if (isset($_POST['login'])) { // User clicked the login button 37 $dbi = new DatabaseInterface(); 38 $user_results = $dbi->get("user", array("name" => $_POST['username'])); 39 if (isset($user_results[0])) { 40 if ($user_results[0]->password == $_POST['password']) { 41 $_SESSION['userUid'] = $user_results[0]->uid; 42 } else { 43 $errorMessage[] = "Incorrect password!"; 44 } 45 } else { 46 $errorMessage[] = "Username doesn't exist!"; 47 } 48 } 49 50 if (isset($_SESSION['userUid'])) { // User just registered a new account 51 redirect('selectSession.php'); 52 } 20 53 ?> 21 54 … … 25 58 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 26 59 <title>Facilitator</title> 27 <?php new StyleSheet( ); ?>60 <?php new StyleSheet("awesome"); ?> 28 61 <script type="text/javascript" src="js/menu.js"></script> 62 <script type="text/javascript"> 63 64 65 66 </script> 29 67 </head> 30 68 <body> 31 69 <div id="header"> 32 <?php new Logo(); ?>70 <?php new Logo(); ?> 33 71 </div> 34 72 … … 37 75 <div id="content"> 38 76 <div class="menu"> 39 <form action=" mainmenu.php" method="POST">77 <form action="index.php" method="POST"> 40 78 <h3>Username</h3> 41 79 <input type="text" name="username"><br /> 42 80 <h3>Password</h3> 43 <input type="password" name="password"><br/><br/><br/> 81 <input type="password" name="password"><br/><br /> 82 <div id="errorDisplay"> 83 <?php 84 foreach ($errorMessage as $message) { 85 echo "<h3 style='color: #FF0000;'>$message</h3>"; 86 } 87 ?> 88 </div> 89 <br/> 44 90 <input type="submit" name="login" class="surveyButton bigSurveyButton" value="Log in"> 45 91 </form> -
Dev/branches/jos-branch/rdfConstants.php
r143 r208 22 22 define('RESPONDENT',SURVEYTOOL_RESOURCES_NAMESPACE . 'respondent'); 23 23 define('APPDATA',SURVEYTOOL_RESOURCES_NAMESPACE . 'graph'); 24 define('SESSIONINSTANCE', SURVEYTOOL_RESOURCES_NAMESPACE . 'sessioninstance'); 25 define('RESULTSET', SURVEYTOOL_RESOURCES_NAMESPACE . 'resultset'); 24 26 25 27 // Predicates used for RDF triples … … 52 54 define('HAS_SURVEY', SURVEYTOOL_PREDICATES_NAMESPACE . 'has_survey'); 53 55 define('HAS_ANSWERSET', SURVEYTOOL_PREDICATES_NAMESPACE . 'has_answerset'); 54 56 define('LOCATION', SURVEYTOOL_PREDICATES_NAMESPACE . 'location'); 57 define('FACILITATOR', SURVEYTOOL_PREDICATES_NAMESPACE . 'facilitator'); 58 define('STARTTIME', SURVEYTOOL_PREDICATES_NAMESPACE . 'starttime'); 59 define('ENDTIME', SURVEYTOOL_PREDICATES_NAMESPACE . 'endtime'); 60 define('HAS_NOTE', SURVEYTOOL_PREDICATES_NAMESPACE . 'has_note'); 61 define('OF_SESSION', SURVEYTOOL_PREDICATES_NAMESPACE . 'of_session'); 62 define('HAS_RESULTSET', SURVEYTOOL_PREDICATES_NAMESPACE . 'has_resultset'); 63 define('CREATIONDATE', SURVEYTOOL_PREDICATES_NAMESPACE . 'creationdate'); 55 64 ?> -
Dev/branches/jos-branch/register.php
r65 r208 6 6 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 7 7 <title>Facilitator</title> 8 <?php new StyleSheet( ); ?>8 <?php new StyleSheet("awesome"); ?> 9 9 <script type="text/javascript" src="js/menu.js"></script> 10 10 </head> -
Dev/branches/jos-branch/surveycreation.php
r95 r208 5 5 redirect('index.php'); 6 6 7 $savedSurvey = null; 8 $timeStamp = null; 7 if (isset($_POST['submit'])) { 8 if (isset($_POST['surveyName'])) { 9 $survey = new Survey(null, $_POST['surveyName'], "Thijs", null); 10 $dbi = new DatabaseInterface(); 11 $dbi->set($survey); 12 } 13 } 9 14 10 15 16 17 18 /* 19 $savedSurvey = null; 20 $timeStamp = null; 21 */ 22 11 23 /* LOAD SURVEY */ 12 if (isset($_POST['UID'])) { 13 $surveyID = $_POST['UID']; 14 $surveyDBI = new SurveyCreationDatabaseInterface($surveyID); 15 $info = $surveyDBI->getSurveyInfo(); 24 /* 25 if (isset($_POST['UID'])) { 26 $surveyID = $_POST['UID']; 27 $surveyDBI = new SurveyCreationDatabaseInterface($surveyID); 28 $info = $surveyDBI->getSurveyInfo(); 16 29 17 $savedSurvey = Survey::getSurvey($info); 18 } 30 $savedSurvey = Survey::getSurvey($info); 31 } 32 */ 33 /* AUTOSAVE */ 19 34 20 /* AUTOSAVE */21 else if (isset($_POST['timeStamp'])) {22 35 /* 36 else if (isset($_POST['timeStamp'])) { 37 $timeStamp = $_POST['timeStamp']; 23 38 24 25 26 27 28 29 30 31 32 39 echo 'This is what gets sent:'; 40 var_dump($_POST); 41 echo '<br/><br/>'; 42 $surveyDBI = new SurveyCreationDatabaseInterface($_POST['surveyID']); 43 $surveyDBI->setSurveyInfo($_POST,$_SESSION); 44 $info = $surveyDBI->getSurveyInfo(); 45 echo '<br/><br/>'; 46 echo 'This is what I get back:'; 47 var_dump($info); 33 48 34 $savedSurvey = Survey::getSurvey($info); 35 } 49 $savedSurvey = Survey::getSurvey($info); 50 } 51 52 */ 36 53 ?> 37 54 … … 42 59 <head> 43 60 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 44 45 <?php new StyleSheet(); ?>61 <title>Survey Creation</title> 62 <?php new StyleSheet("awesome"); ?> 46 63 </head> 47 64 <body> … … 52 69 53 70 <div id="content"> 54 <?php 55 new SurveyCreationTool($savedSurvey, $timeStamp); 56 ?> 71 <form action="surveycreation.php" method="post"> 72 <fieldset> 73 Name: <input type="text" name="surveyName" /><br /> 74 Uid: <input type="text" name="surveyID" /><br /><br /> 75 <input type="submit" name="submit" value="Make fake survey!" /> 76 </fieldset> 77 </form> 57 78 </div> 58 79 </div> -
Dev/branches/jos-branch/testpage.php
r148 r208 3 3 4 4 $db = new DatabaseInterface(); 5 $user = $db->get("user", array("name" => "jkraaijeveld")); 6 print_r($user[0]); 5 6 $result = $db->get("Session"); 7 $session = $result[0]; 8 $session->title = "Changed title"; 9 $db->set($session); 10 print_r($result); 7 11 8 12 ?>
Note: See TracChangeset
for help on using the changeset viewer.