diff --git a/html/tags/error.html.php b/html/tags/error.html.php new file mode 100644 index 0000000..ca173d0 --- /dev/null +++ b/html/tags/error.html.php @@ -0,0 +1,25 @@ + + + + + + + PHP Error Output + + + + + + + +

+ + + +

+ + + + diff --git a/html/tags/form.html.php b/html/tags/form.html.php new file mode 100644 index 0000000..14d42ac --- /dev/null +++ b/html/tags/form.html.php @@ -0,0 +1,18 @@ + + + + + Add tag to URL + + + + +
+
+
+ +
+
+
+ + diff --git a/html/tags/index.php b/html/tags/index.php new file mode 100644 index 0000000..78dc0a0 --- /dev/null +++ b/html/tags/index.php @@ -0,0 +1,94 @@ +check($_POST['captcha_code']) == false) + { + echo "The security code entered was incorrect."; + include 'login.html.php'; + exit(); + + } + } + + $link = mysqli_connect('localhost', 'approver', 'foobar'); + $user = mysqli_real_escape_string($link, $_POST['user']); + $pass = mysqli_real_escape_string($link, $_POST['pass']); + + if (!$link) + { + $error = 'Cant connect to database.'; + include 'error.html.php'; + exit(); + } + if (!mysqli_set_charset($link, 'utf8')) + { + $error = 'Unable to set database connection encoding.'; + include 'error.html.php'; + exit(); + } + if(!mysqli_select_db($link, 'wiby')) + { + $error = 'Unable to locate the database.'; + include 'error.html.php'; + exit(); + } + $loginresult = mysqli_query($link,"SELECT hash, attempts FROM accounts WHERE name = '$user';"); + if(!$loginresult) + { + $error = 'Error fetching index: ' . mysqli_error($link); + include 'error.html.php'; + exit(); + } + + //lets put contents of accounts into an array + while($rowaccounts = mysqli_fetch_array($loginresult)) + { + $hash[] = $rowaccounts['hash']; + $attempts[] = $rowaccounts['attempts']; + } + if(password_verify($pass,$hash[0]) && $attempts[0] < 5) + { + if($attempts[0]>0) + { + if (!mysqli_query($link, "UPDATE accounts SET attempts = '0' WHERE name = '$user';")) + { + $error = 'Error fetching index: ' . mysqli_error($link); + include 'error.html.php'; + exit(); + } + } + + $_SESSION["authenticated"] = true; + $_SESSION["user"] = $user; + include 'tags.php'; + exit(); + } + else{ + $attempt = $attempts[0] + 1; + if (!mysqli_query($link, "UPDATE accounts SET attempts = '$attempt' WHERE name = '$user';")) + { + $error = 'Error fetching index: ' . mysqli_error($link); + include 'error.html.php'; + exit(); + } + echo "It doesn't look like you submitted a valid username or password."; + include 'login.html.php'; + } + } +?> + diff --git a/html/tags/login.html.php b/html/tags/login.html.php new file mode 100644 index 0000000..18aa986 --- /dev/null +++ b/html/tags/login.html.php @@ -0,0 +1,31 @@ + + + + + + + wiby.me + + + + + + + +
+ Username
+ Password

+ +
+ CAPTCHA Image +
+
+ + Reload Image +
+ +
+
+ + + diff --git a/html/tags/tags.html.php b/html/tags/tags.html.php new file mode 100644 index 0000000..7b4134d --- /dev/null +++ b/html/tags/tags.html.php @@ -0,0 +1,30 @@ + + + + + + + Form Example + + + + + + + +
+
+ + +
+ + +
+
+
+ + + + diff --git a/html/tags/tags.php b/html/tags/tags.php new file mode 100644 index 0000000..c84ef36 --- /dev/null +++ b/html/tags/tags.php @@ -0,0 +1,80 @@ + + +