diff --git a/DBConn.php b/DBConn.php new file mode 100644 index 000000000..fc07fda42 --- /dev/null +++ b/DBConn.php @@ -0,0 +1,281 @@ +connectToDatabase(); + } + + function connectToDatabase() + { + $dsn = "mysql:dbname=db;host=localhost"; + $user = "root"; + $password = ""; + try{ + $this->conn = new PDO($dsn, $user, $password); + } + catch(Exception $e) + { + $this->errors[] = $e->getMessage(); + return false; + } + return true; + } + + function close() + { + $this->conn = NULL; + } + + function rowCount() + { + return $this->numRows; + } + + function update($query, $newValues = array(), $whereValues = array()) + { //echo "update function parameters passed in
newValues: ".print_r($newValues, true)."
whereValues: ".print_r($whereValues, true).""; + $this->numRows = 0; + $this->errors = array(); + if(!is_array($newValues)) + { + $newValues = (array)$newValues; + } + if(!is_array($whereValues)) + { + $whereValues = (array)$whereValues; + } + $newValues = $this->clean($newValues); + $whereValues = $this->clean($whereValues); + try{ + //echo "preparing update
"; + if (($stmt = $this->conn->prepare($query)) === false) + { + $this->errors[] = "Error preparing update query: ".$query.PHP_EOL."Values: ".print_r($newValues, true).print_r($whereValues, true); + $messageArray = $stmt->errorInfo(); + $this->errors[] = $messageArray[2]; + return false; + } + $count = 1; + if (count($newValues)>0) + {//echo "new values count > 0.
"; + foreach($newValues as $key=>&$value) + { + //echo "binding value: $value
"; + if(($stmt->bindParam($count, $value)) === false) + { + $this->errors[] = "Error binding 'new' parameters for update statement: ".$query.PHP_EOL."Values: ".print_r($newValues, true).print_r($whereValues, true); + $messageArray = $stmt->errorInfo(); + $this->errors[] = $messageArray[2]; + return false; + } + $count++; + } + } + if (count($whereValues)>0) + {//echo "where values count > 0.
"; + foreach($whereValues as $key=>&$value) + {//echo "binding value: $value
"; + if(($stmt->bindParam($count, $value)) === false) + { + $this->errors[] = "Error binding 'where' parameters for update statement: ".$query.PHP_EOL."Values: ".print_r($newValues, true).print_r($whereValues, true); + $messageArray = $stmt->errorInfo(); + $this->errors[] = $messageArray[2]; + return false; + } + $count++; + } + } + if (($stmt->execute()) === false) + { + $this->errors[] = "Error executing update statement: ".$query.PHP_EOL."Values: ".print_r($newValues, true).print_r($whereValues, true); + $messageArray = $stmt->errorInfo(); + $this->errors[] = $messageArray[2]; + return false; + } + //echo "statement executed
"; + } + catch(Exception $e) + { + $this->errors[] = $e->getMessage(); + return false; + } + $this->numRows = $stmt->rowCount(); + //echo "update statement should have been successful
"; + return true; + } + + function insert($query, $values = array()) + { + $this->numRows = 0; + $this->errors = array(); + if(!is_array($values)) + { + $values = (array)$values; + } + $values = $this->clean($values); + try{ + if (($stmt = $this->conn->prepare($query)) === false) + { + $this->errors[] = "Error preparing insert query: ".$query.PHP_EOL."Values: ".print_r($values, true); + $messageArray = $stmt->errorInfo(); + $this->errors[] = $messageArray[2]; + return false; + } + if (count($values)>0) + { + foreach($values as $key=>&$value) + { + if(($stmt->bindParam($key + 1, $value)) === false) + { + $this->errors[] = "Error binding parameters for insert statement: ".$query.PHP_EOL."Values: ".print_r($values, true); + $messageArray = $stmt->errorInfo(); + $this->errors[] = $messageArray[2]; + return false; + } + } + } + if (($stmt->execute()) === false) + { + $this->errors[] = "Error executing insert statement: ".$query.PHP_EOL."Values: ".print_r($values, true); + $messageArray = $stmt->errorInfo(); + $this->errors[] = $messageArray[2]; + return false; + } + } + catch(Exception $e) + { + $this->errors[] = $e->getMessage(); + return false; + } + $this->numRows = $stmt->rowCount(); + return true; + } + + + function select($query, $values = array()) + { + $this->numRows = 0; + $this->errors = array(); + if(!is_array($values)) + { + $values = (array)$values; + } + $values = $this->clean($values); + try{ + if (($stmt = $this->conn->prepare($query)) === false) + { + $this->errors[] = "Error preparing select query: ".$query.PHP_EOL."Values: ".print_r($values, true); + $messageArray = $stmt->errorInfo(); + $this->errors[] = $messageArray[2]; + return false; + } + if(count($values)>0) + { + foreach($values as $key=>&$value) + { + if(($stmt->bindParam($key + 1, $value)) === false) + { + $this->errors[] = "Error binding parameters for select statement: ".$query.PHP_EOL."Values: ".print_r($values, true); + $messageArray = $stmt->errorInfo(); + $this->errors[] = $messageArray[2]; + return false; + } + } + } + if (($stmt->execute()) === false) + { + $this->errors[] = "Error executing select statement: ".$query.PHP_EOL."Values: ".print_r($values, true); + $messageArray = $stmt->errorInfo(); + $this->errors[] = $messageArray[2]; + return false; + } + if (($rows = $stmt->fetchAll(PDO::FETCH_ASSOC)) === false) + { + $this->errors[] = "Error fetching rows for query: ".$query.PHP_EOL."Values: ".print_r($values, true); + $messageArray = $stmt->errorInfo(); + $this->errors[] = $messageArray[2]; + return false; + } + } + catch(Exception $e) + { + $this->errors[] = $e->getMessage(); + return false; + } + $this->numRows = count($rows); + return $rows; + } + + function delete($query, $values = array()) + { + $this->numRows = 0; + $this->errors = array(); + if(!is_array($values)) + { + $values = (array)$values; + } + $values = $this->clean($values); + try{ + if (($stmt = $this->conn->prepare($query)) === false) + { + $this->errors[] = "Error preparing delete query: ".$query.PHP_EOL."Values: ".print_r($values, true); + $messageArray = $stmt->errorInfo(); + $this->errors[] = $messageArray[2]; + return false; + } + if (count($values)>0) + { + foreach($values as $key=>&$value) + { + if(($stmt->bindParam($key + 1, $value)) === false) + { + $this->errors[] = "Error binding parameters for delete statement: ".$query.PHP_EOL."Values: ".print_r($values, true); + $messageArray = $stmt->errorInfo(); + $this->errors[] = $messageArray[2]; + return false; + } + } + } + if (($stmt->execute()) === false) + { + $this->errors[] = "Error executing delete statement: ".$query.PHP_EOL."Values: ".print_r($values, true); + $messageArray = $stmt->errorInfo(); + $this->errors[] = $messageArray[2]; + return false; + } + } + catch(Exception $e) + { + $this->errors[] = $e->getMessage(); + return false; + } + $this->numRows = $stmt->rowCount(); + return true; + } + + function getErrors() + { + return $this->errors; + } + + function clean($values = array()) + {//echo "in clean, values passed in:
".print_r($values, true)."

"; + $cleanValues = array(); + foreach($values as $key=>$value) + { + if (is_array($value)) + { + $cleanValues[$key] = $this->clean($value); + } + else + { + $cleanValues[$key] = htmlspecialchars($value); + } + } + return $cleanValues; + } +} +?> diff --git a/DML/deleteFile.php b/DML/deleteFile.php new file mode 100644 index 000000000..619125d9d --- /dev/null +++ b/DML/deleteFile.php @@ -0,0 +1,22 @@ +connect_error) { + die("Connection failed: " . $conn->connect_error); +} +// prepare and bind +$stmt = $conn->prepare("DELETE FROM file WHERE groupid =?)"); +$stmt->bind_param("i", $groupid); + +//execute +$stmt->execute(); +$stmt->close(); +$conn->close(); +///filesystem operations still need to be dealt with +?> diff --git a/DML/getPermission.php b/DML/getPermission.php new file mode 100644 index 000000000..90ae1c29f --- /dev/null +++ b/DML/getPermission.php @@ -0,0 +1,28 @@ +connect_error) { + die("Connection failed: " . $conn->connect_error); +} + +// prepare and bind +$stmt = $conn->prepare("select permission_name FROM permission WHERE id=?"); +$stmt->bind_param("i", $usertypeid); + +//execute +$stmt->execute(); +$stmt->bind_result($id); +$stmt->store_result(); +$stmt->fetch(); +echo $id; +$stmt->close(); +$conn->close(); +?> diff --git a/DML/insertFile.php b/DML/insertFile.php new file mode 100644 index 000000000..bee7d12df --- /dev/null +++ b/DML/insertFile.php @@ -0,0 +1,20 @@ +connect_error) { + die("Connection failed: " . $conn->connect_error); +} +// prepare and bind +$stmt = $conn->prepare("INSERT INTO file (groupid, path, activeuserflag) VALUES (?, ?, ?, ?)"); +$stmt->bind_param("sss", $username, $hashedpassword, $usertypeid, $activeuserflag); +//execute +$stmt->execute(); +$stmt->close(); +$conn->close(); + +///filesystem operatinos still need to be dealt with +?> diff --git a/DML/insertUser.php b/DML/insertUser.php index ba62dff11..42472af48 100644 --- a/DML/insertUser.php +++ b/DML/insertUser.php @@ -15,6 +15,13 @@ $stmt = $conn->prepare("INSERT INTO user (username, hashedpassword, usertypeid, activeuserflag) VALUES (?, ?, ?, ?)"); $stmt->bind_param("sss", $username, $hashedpassword, $usertypeid, $activeuserflag); +//execute +$stmt->execute(); + +////set permission//// +// prepare and bind +$stmt = $conn->prepare("INSERT INTO permissiongroup (permissionid) VALUES (?)"); +$stmt->bind_param("i", $permissionid); //execute $stmt->execute(); diff --git a/DML/loginQueries.php b/DML/loginQueries.php new file mode 100644 index 000000000..229f04c23 --- /dev/null +++ b/DML/loginQueries.php @@ -0,0 +1,37 @@ +connect_error) { + die("Connection failed: " . $conn->connect_error); +} + +// prepare and bind +$stmt = $conn->prepare("select id from user WHERE username=? AND password=?"); +$stmt->bind_param("ss", $input, $input); + + +//execute +$stmt->execute(); + +$stmt->bind_result($id); +$stmt->store_result(); +$stmt->fetch(); + +echo $id; + +$stmt->close(); +$conn->close(); + +?> diff --git a/DML/note.txt b/DML/note.txt new file mode 100644 index 000000000..93074aca4 --- /dev/null +++ b/DML/note.txt @@ -0,0 +1,3 @@ +these are meant to be included where needed + +updating a file would just entail deleting the original and creating a new one diff --git a/DML/updateUser.php b/DML/updateUser.php index f5ab91e38..be9f24894 100644 --- a/DML/updateUser.php +++ b/DML/updateUser.php @@ -20,6 +20,16 @@ //execute $stmt->execute(); + +////update permission//// +// prepare and bind +$stmt = $conn->prepare("UPDATE permissiongroup SET permissionid=usertypeid"); +$stmt->bind_param("i", $permissionid); +//execute +$stmt->execute(); + + + $stmt->close(); $conn->close(); ?> diff --git a/RADs logo.PNG b/RADs logo.PNG new file mode 100644 index 000000000..1ab1e77dd Binary files /dev/null and b/RADs logo.PNG differ diff --git a/RADs tab.PNG b/RADs tab.PNG new file mode 100644 index 000000000..d06a4d9cd Binary files /dev/null and b/RADs tab.PNG differ diff --git a/RADstab.ico b/RADstab.ico new file mode 100644 index 000000000..08746e678 Binary files /dev/null and b/RADstab.ico differ diff --git a/README.md b/README.md index d20f1646a..cfb3690f0 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,90 @@ # Group2Final Repository for Group 2 of the Final Project -Link to Deployment: +# Link to Deployment: http://138.197.129.215/Group2Final/login.php + + + +## Deployment Notes + + The RADs software system was developed and tested on FreeBSD 11.0-RELEASE. That said, it will work in any environment with mysql57, php56, and apache24, and appropriate modules, but the details for such a deployment are not listed here. + + +### Operating System + + + FreeBSD was chosen for its reliability, security, and predictability in updates and releases. It is a proven solution as shown by its use by companies such as Netflix and Yahoo, incidentally accounting for more than a third of all internet traffic in 2015 in north america. + +### Database and Webserver + + + mysql and apache, again, were chosen as they are proven solutions and offer functionality in terms load balancing and high availability for future growth. This functionality is not yet implemented. + + +### Cloud Services Provider + + + For development and testing DigitalOcean was used, but any will do. + + +### Step-by-Step Setup + + + Get to your root shell. This is on you. + + +Update and upgrade the operating system and install pkg if you do not want to compile ports from source. The commands are as follows: + + freebsd-update fetch + freebsd-update install + pkg + pkg update + pkg upgrade + +To at any time see what installed: + + pkg info + +Install a text editor, git, and other packages: + + pkg install nano git apache24 mysql57-server php56 php56-json php56-mysql php56-mysqli php56-pdo php56-pdo_mysql php56-session mod_php56 + + +Services in FreeBSD are started and stopped like in post-systemd linux. For example “service apache24 restart” will restart. Services to be started on boot are in the file “/etc/rc.conf”. Do the following: +Add “ apache24_enable=”YES” “ to /etc/rc.conf +Add “ mysql_enable=”YES” “ to /etc/rc.conf +You will now be able to start the services, or reboot to start the services. +Run to create a php config file: + + cp /usr/local/etc/php.ini-production /usr/local/etc/php.ini + + +Add php functionality to apache configuration +Add the following to /usr/local/etc/apache24/Includes/php.conf + + + + DirectoryIndex index.php index.html + + SetHandler application/x-httpd-php + + + SetHandler application/x-httpd-php-source + + + + +Restart apache + + service apache24 restart + + +On the first start of mysql, it creates the hidden file in root’s home directory called “.mysql_secret”. You can find this with ll. cat it to see the preset password. You will use this to log in to the mysql shell. + +Log into the mysql shell with “ mysql -u root -p ”. Enter or paste the password from before. Now you may, and should, choose to change the password. Create a database “db” and source the .sql provided in the github repository. The default credentials in the application for testing are “root”:”” + +Navigate to /usr/local/www/apache24/data/ and git clone the github repository. The application will now be running. + + cd /usr/local/www/apache24/data/ + git clone https://github.com/jvbkw8/Group2Final.git diff --git a/account.php b/account.php new file mode 100644 index 000000000..bd820693e --- /dev/null +++ b/account.php @@ -0,0 +1,154 @@ + + + + + + RADs(Research Analysis and Database for Scientists) + + + + + + + + + + + + +
+connectToDatabase()){ + $q = "SELECT id, username, isadmin, activeuserflag from db.user"; + $rows = $conn->select($q); + $Yes = "Yes"; + $No = "No"; + if($rows){ + ?> + + + + + + + + + + + + + + + + + + + + + +
UsernameActive User?Admin User?Activate/DeactivateAdmin ControlReset Password
Reset Password
+ +
+ + + diff --git a/doupload.php b/doupload.php new file mode 100644 index 000000000..f5a235f62 --- /dev/null +++ b/doupload.php @@ -0,0 +1,108 @@ +connect_error) { + die("Connection failed: " . $conn->connect_error); +} + + +$max_file_size = 1024000*10000; //1mb? + + +$numFilesNotUploaded = 0; +$numFilesUploaded = 0; +$error = array(); +if(isset($_POST) and $_SERVER['REQUEST_METHOD'] == "POST"){ + + //set manifest name for all + $manifestname = $_POST["manifestname"]; + + $stmt = $conn->prepare("SELECT name FROM manifest where name = ?"); + $stmt->bind_param("s", $manifestname); + if(!$stmt->execute()){ + $error[] = "Problem when checking if manifest name exists"; + } + $mcheck = ""; + $stmt->bind_result($mcheck); + while($stmt->fetch()){ + $error[] = "Manifest name ".$mcheck." already exists."; + } + //insert manifest name and get its id + $stmt = $conn->prepare("INSERT INTO manifest(name) VALUES (?)"); + $stmt->bind_param("s", $manifestname); + if(!$stmt->execute()){ + $error[] = "Manifest name not stored."; + break; + } + $manifestid = mysqli_insert_id($conn); + + if(count($error) == 0){ + // for each file + foreach ($_FILES['files']['name'] as $f => $name) { + //echo $name; + //echo "
"; + //continue; + + if ($_FILES['files']['error'][$f] == 4) { + continue; // Skip file if any error found + } + if ($_FILES['files']['error'][$f] == 0) { + if ($_FILES['files']['size'][$f] > $max_file_size) { + $error[] = "$name is too large!"; + continue; // Skip large files + } + + else{ // No error found + //for each file do these things + $binaryData = file_get_contents($_FILES['files']['tmp_name'][$f]); + $owner = $_SESSION['NAME']; + $null = NULL; //this made it all work + + // prepare and bind + $stmt = $conn->prepare("INSERT INTO files (data, name, owner, manifestid) VALUES (?, ?, ?, ?)"); + $stmt->bind_param("bssi", $null, $name, $owner, $manifestid); + $stmt->send_long_data(0, $binaryData); //this made it all work + if(!$stmt->execute()){ + $numFilesNotUploaded++; + } else { + $numFilesUploaded++; + } + } + } + } + } +} else { + $error[] = "No files uploaded."; +} +if($numFilesUploaded == 0){ + $error[] = "No files uploaded"; +} +if($numFilesNotUploaded > 0){ + $plural = ($numFilesNotUploaded > 1)? "s":""; + $error[] = $numFilesNotUploaded." file".$plural." not uploaded."; +} +foreach($error as $msg){ + $errorMsg .= $msg."
"; +} +if(isset($errorMsg)){ + $errorMsg = rtrim($errorMsg, "
"); +} + +$stmt->close(); +$conn->close(); +if(isset($errorMsg)){ + header( 'Location: /Group2Final/upload.php?error='.$errorMsg ) ; +}else{ + header('Location: /Group2Final/upload.php?success='.$numFilesUploaded); +} +?> diff --git a/download.php b/download.php new file mode 100644 index 000000000..38dd17e99 --- /dev/null +++ b/download.php @@ -0,0 +1,34 @@ + diff --git a/editUser.php b/editUser.php new file mode 100644 index 000000000..ce4aeabdd --- /dev/null +++ b/editUser.php @@ -0,0 +1,58 @@ +'Required data not sent')); + exit(); +} +header("Content-Type: application/json"); +require "DBConn.php"; +$conn = new DBConn(); +if($conn->connectToDatabase()){ + switch($_POST['action']){ + case "resetPassword": + $newPassword = password_hash("password123", PASSWORD_DEFAULT); + $q = "UPDATE db.user SET hashedpassword = ? where id = ?"; + if($conn->update($q, $newPassword, $_POST['id'])){ + echo json_encode(array("success"=> 'Password is now password123')); + } else { + echo json_encode(array("error"=> 'Password not reset')); + } + break; + case "activateUser": + $q = "UPDATE db.user SET activeuserflag = ? where id = ?"; + if($conn->update($q, "1", $_POST['id'])){ + echo json_encode(array("success"=> 'User activated')); + } else { + echo json_encode(array("error"=> 'User activation failed')); + } + break; + case "deactivateUser": + $q = "UPDATE db.user SET activeuserflag = ? where id = ?"; + if($conn->update($q, "0", $_POST['id'])){ + echo json_encode(array("success"=> 'User deactivated')); + } else { + echo json_encode(array("error"=> 'User deactivation failed')); + } + break; + case "adminify": + $q = "UPDATE db.user SET isadmin = ? where id = ?"; + if($conn->update($q, '1', $_POST['id'])){ + echo json_encode(array("success"=> 'User is now an admin')); + } else { + echo json_encode(array("error"=> 'Adminification failed')); + } + break; + case "deadminify": + $q = "UPDATE db.user SET isadmin = ? where id = ?"; + if($conn->update($q, '0', $_POST['id'])){ + echo json_encode(array("success"=> 'User is no longer an admin')); + } else { + echo json_encode(array("error"=> 'De-admnification failed')); + } + break; + default: + echo json_encode(array("error"=> 'Action requested is not clear. '.$_POST['action'])); + } +} else { + echo json_encode(array("error"=> 'Could not connect. Try again later')); +} +?> diff --git a/header.php b/header.php new file mode 100644 index 000000000..1e1ed5625 --- /dev/null +++ b/header.php @@ -0,0 +1,73 @@ + + + +
+
+

+ +
+
+
diff --git a/index.html b/index.html deleted file mode 100644 index 88d2be11e..000000000 --- a/index.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - Final Project Group 2 - - - -

RADs(Research Analysis and Database for Scientists)

-

Hello World!

- -<<<<<<< HEAD -
- Upload -
-======= -

Search bar

->>>>>>> jvbkw8 - - diff --git a/index.php b/index.php new file mode 100644 index 000000000..6337051c5 --- /dev/null +++ b/index.php @@ -0,0 +1,26 @@ + + + + RADs(Research Analysis and Database for Scientists) + + + + + + + + + + +
+

The goal of this application is to facilitate the research of computational social scientists and data scientists alike by serving as a repository for datasets and metadata following the Open Community Data eXchange (OCDX) specification.

+

+ View the OCDX specification on their Github page. +

+
+ + + diff --git a/login.php b/login.php index 84e2b355e..1dacc9315 100644 --- a/login.php +++ b/login.php @@ -1,10 +1,8 @@ - - @@ -20,78 +18,47 @@ RADs Login - - - - - - - - - - - - -
- -
-
-
-

Login

-
-
- -
-
- -
-
- -
-
- -
- + +
+
+
+

Login

+
+
+ +
+
+ +
+
+ +
+
- - - - - +
+
+
+ +
- + + diff --git a/loginTests.php b/loginTests.php new file mode 100644 index 000000000..27adf277b --- /dev/null +++ b/loginTests.php @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + + + + +
Test PassedLogin SuccessExpected Success?UsernamePasswordAdmin?DB Errors
diff --git a/loginVerify.php b/loginVerify.php new file mode 100644 index 000000000..511a0f73d --- /dev/null +++ b/loginVerify.php @@ -0,0 +1,100 @@ +"false", + "login_expected"=>$_POST['expected'], + "test_passed"=>$passed, + "username"=>$user_name, + "password"=>$user_password, + "error"=>$errorstring); + echo json_encode($returnarray); +// echo "{login_success: 'false', +// login_expected: '".$_POST['expected']."', +// test_passed: '".$passed."', +// username: '".addslashes($user_name)."', +// error: '".$errorstring."'}"; + } else { + header("Location: login.php?error=Invalid username or password"); + } + exit(); + } + session_start(); // session starts with the help of this function + require_once "DBConn.php"; + $dbconn = new DBConn(); + if($dbconn->connectToDatabase()){ + $sql = "SELECT username, isadmin, hashedpassword FROM db.user WHERE BINARY username = ? AND activeuserflag = 1;"; + $rows = $dbconn->select($sql, array($user_name)); + if($rows !== false && count($rows) == 1){ + $row = $rows[0]; + $errorstring = ""; + } else { + $errorstring = "Username not found."; + } + $errorstring = ""; + if(count($errors = $dbconn->getErrors()) > 0){ + foreach($errors as $error){ + $errorstring .= $error."
"; + } + $errorstring = rtrim($errorstring, "
"); + } + if(!$errorstring and isset($row['hashedpassword']) and password_verify($user_password, $row['hashedpassword'])){ + $_SESSION['NAME'] = $user_name; + $_SESSION['ADMIN'] = $row['isadmin']; + if(isset($_POST['test'])){ + $passed = "false"; + if($_POST['expected'] == "true"){ + $passed = "true"; + } + $returnarray = array("login_success"=>"true", + "login_expected"=>$_POST['expected'], + "test_passed"=>$passed, + "username"=>$user_name, + "password"=>$user_password, + "isadmin"=>$row['isadmin'], + "error"=>$errorstring); + echo json_encode($returnarray); +// echo "{login_success: 'true', +// login_expected: '".$_POST['expected']."', +// test_passed: '".$passed."', +// username: '".addslashes($user_name)."', +// isadmin: '".$row['isadmin']."', +// error: '0'}"; + } else { + header("Location: index.php"); + } + exit(); + } else { + if(isset($_POST['test'])){ + $passed = "false"; + if($_POST['expected'] == "false"){ + $passed = "true"; + } + $returnarray = array("login_success"=>"false", + "login_expected"=>$_POST['expected'], + "test_passed"=>$passed, + "username"=>$user_name, + "password"=>$user_password, + "error"=>$errorstring); + echo json_encode($returnarray); +// echo "{login_success: 'false', +// login_expected: '".$_POST['expected']."', +// test_passed: '".$passed."', +// username: '".addslashes($user_name)."', +// error: '".$errorstring."'}"; + } else { + header("Location: login.php?error=Invalid username or password"); + } + exit(); + } + } else {header("Location: login.php?error=Problems connecting. Please try again later.");} +?> diff --git a/logout.php b/logout.php new file mode 100644 index 000000000..d4c63a621 --- /dev/null +++ b/logout.php @@ -0,0 +1,6 @@ + diff --git a/pagemap.png b/pagemap.png new file mode 100644 index 000000000..0d0bc577e Binary files /dev/null and b/pagemap.png differ diff --git a/search.php b/search.php new file mode 100644 index 000000000..8f0553cfa --- /dev/null +++ b/search.php @@ -0,0 +1,187 @@ + + + + + + + + + + + + + + + + + + +Search Manifests + + + + + + + +
+
+
+
+
+ +
+ +
+ + +
+ + +
+
+
+ +
+ +
+ + +
+
+
+
+ +
+ +
+ + +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
File NameOwnerGet FileView ManifestManifest NameDelete File?
Download
You Are Not The Owner
+ +
+
+
+ + + + + + + diff --git a/security.php b/security.php new file mode 100644 index 000000000..095ee30f1 --- /dev/null +++ b/security.php @@ -0,0 +1,22 @@ +num_rows != 1){ + $requireLogin = true; + } else { + $row = mysqli_fetch_assoc($r); + $_SESSION['ADMIN'] = $row['isadmin']; + } + +} +if($requireLogin){ + header("Location: /Group2Final/login.php"); +} +?> diff --git a/signup.php b/signup.php new file mode 100644 index 000000000..5c8e040cc --- /dev/null +++ b/signup.php @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + RADs Signup + + + + + + + +
+
+
+

Sign Up

+
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+
+
+
+ +
+ + + + + + + + diff --git a/signupVerify.php b/signupVerify.php new file mode 100644 index 000000000..d07916043 --- /dev/null +++ b/signupVerify.php @@ -0,0 +1,33 @@ +query($usernamecheck); + if($result->num_rows != 0){ + header("Location: signup.php?error=Username already exists"); + exit(); + } + $hashedPassword = password_hash($user_password, PASSWORD_DEFAULT); + $sql = "INSERT into db.user (username, hashedpassword, activeuserflag, isadmin) values ('$user_name', '$hashedPassword', 1, 0);"; + //echo $sql;exit(); + $conn->query($sql); + if($conn->affected_rows != 1){ + header("Location: signup.php?error=Information not stored"); + exit(); + } + session_start(); + $_SESSION[NAME] = $user_name; + header("Location: index.php"); +?> diff --git a/upload.html b/upload.html deleted file mode 100644 index e00a59cc2..000000000 --- a/upload.html +++ /dev/null @@ -1,77 +0,0 @@ - - - - - - - - - - - - -Upload Form - - -
-
-
-
-

Upload Form

-
-
- -
- -
-
-
-
- -
- -
-
-
-
- -
- -
-
-
-
- - Student - Researcher - Data Scientist
-
- - -
- - -
-
- Submit -
- -
-
-
-
-
- - - - - diff --git a/upload.php b/upload.php new file mode 100644 index 000000000..3a155092d --- /dev/null +++ b/upload.php @@ -0,0 +1,87 @@ + + + + + + + + + + + Upload Manifest + + + + +
+
+'; + echo "Error! {$_GET['error']}"; + echo '
'; + } + else if (isset ($_GET['success'])) + { + if ($_GET['success'] >= 1) + { + $s = "s"; //if plural + } + echo '
'; + echo "Success! {$_GET['success']} file{$s} uploaded."; + echo '
'; + } + +?> + + +
+
+
+ +
+ Manifest Name: +
+ +
+
+ +
+
+ + + + + + + diff --git a/uploadcheck.php b/uploadcheck.php new file mode 100644 index 000000000..f0f6a2143 --- /dev/null +++ b/uploadcheck.php @@ -0,0 +1,45 @@ + + + + + + + + + + + +Upload Check + + + + + + + + + \ No newline at end of file