' . htmlspecialchars($row[4]) . '
' . htmlspecialchars($row[1]) . '
created by ' . $row[3] . '
at ' . $row[2] . '
points ' . $points . '
diff --git a/prax4/src/signup.php b/prax4/src/signup.php
index c5165bd..b8939b1 100644
--- a/prax4/src/signup.php
+++ b/prax4/src/signup.php
@@ -76,7 +76,7 @@ function validifyData($username, $db) {
if (isset($_REQUEST['username']) and isset($_REQUEST['password']) and isset($_REQUEST['fullname']) and isset($_REQUEST['email'])) {
$username = escape($connection, $_REQUEST['username']);
$password = escape($connection, $_REQUEST['password']);
- $hash = hash('md5', $password);
+ $hash = hash('sha512', $password);
$fullname = escape($connection, $_REQUEST["fullname"]);
$email = escape($connection, $_REQUEST["email"]);
if (validifyData($username, $connection)) {
diff --git a/prax4/src/upload.php b/prax4/src/upload.php
new file mode 100644
index 0000000..5a5d3c3
--- /dev/null
+++ b/prax4/src/upload.php
@@ -0,0 +1,52 @@
+$target_file " . $target_file;
+ $uploadOk = 1;
+ $imageFileType = pathinfo($target_file, PATHINFO_EXTENSION);
+ echo "
$imageFileType " . $imageFileType;
+ $saved_file = $target_dir . $fileid . "." . $imageFileType;
+ // Check if image file is a actual image or fake image
+ if (isset($_POST["submit"])) {
+ $check = getimagesize($_FILES["fileToUpload"]["tmp_name"]);
+ if ($check !== false) {
+ echo "File is an image - " . $check["mime"] . ".";
+ $uploadOk = 1;
+ } else {
+ echo "File is not an image.";
+ $uploadOk = 0;
+ }
+ }
+ echo "all is fine before checks";
+ // Check if file already exists
+ if (file_exists($target_file)) {
+ echo "Sorry, file already exists.";
+ $uploadOk = 0;
+ }
+ // Check file size
+ if ($_FILES["fileToUpload"]["size"] > 5000000) {
+ echo "Sorry, your file is too large.";
+ $uploadOk = 0;
+ }
+ // Allow certain file formats
+ if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif") {
+ echo "Sorry, only JPG, JPEG, PNG & GIF files are allowed.";
+ $uploadOk = 0;
+ }
+ // Check if $uploadOk is set to 0 by an error
+ if ($uploadOk == 0) {
+ echo "Sorry, your file was not uploaded.";
+ // if everything is ok, try to upload file
+ } else {
+ if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $saved_file)) {
+ echo "
The file " . basename($_FILES["fileToUpload"]["name"]) . " has been uploaded.";
+ } else {
+ echo "
Sorry, there was an error uploading your file.";
+ }
+ }
+}
+
+upload_my_file(10);
diff --git a/prax5/app.js b/prax5/app.js
index fd7e6cb..a68dd25 100644
--- a/prax5/app.js
+++ b/prax5/app.js
@@ -1,56 +1,3 @@
-var playerPicks = [];
-
-var paper = 0;
-var rock = 1;
-var scissors = 2;
-
-
-function play(choice) {
-
- if (playerPicks.length < 3) {
- makeRandomChoice(choice);
- } else {
- //control if player chose more than 3 same in a row
- if (playerPicks[playerPicks.length - 1] === playerPicks[playerPicks.length - 2]
- && playerPicks[playerPicks.length - 2] === playerPicks[playerPicks.length - 3]) {
-
- console.log('other person TURN');
-
- if (playerPicks[playerPicks.length - 1] === 0) {
- makeTurn(choice, 2);
- } else {
- makeTurn(choice, playerPicks[playerPicks.length - 1] - 1);
- }
- } else {
- makeRandomChoice(choice);
- }
-
- }
- playerPicks.push(choice);
-}
-
-function makeTurn(playerChoice, secondPlayerChoice) {
- if (!(playerChoice === 0 && secondPlayerChoice === 2)
- && ((playerChoice === 2 && secondPlayerChoice === 0)
- || playerChoice < secondPlayerChoice)) {
- //WON
- console.log('Win ' + playerChoice + ' ' + secondPlayerChoice);
- } else if (playerChoice === secondPlayerChoice) {
- //DRAW
- console.log('Draw ' + playerChoice + ' ' + secondPlayerChoice);
- } else {
- //LOSE
- console.log('Lose ' + playerChoice + ' ' + secondPlayerChoice);
- }
-}
-
-$('#playerpaper').click(function () {
- play(paper);
-});
-$('#playerrock').click(function () {
- play(rock);
-});
-$('#playerscissors').click(function () {
- play(scissors);
-});
+function move(move) {
+}
\ No newline at end of file