Skip to content

Commit

Permalink
Bug fixes #1
Browse files Browse the repository at this point in the history
  • Loading branch information
pikami committed Jun 20, 2016
1 parent 045af4a commit cbb9b99
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
17 changes: 12 additions & 5 deletions index.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
<?php
if(isset($_GET["page"]) && $_GET["page"] == "login" && isset($_POST["type"]) && $_POST["type"]=="login"){
include_once "login.php";
die();
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
Expand Down Expand Up @@ -118,13 +124,14 @@
} else if($_GET["page"] == "login"){
include_once "login.php";
} else if($_GET["page"] == "logout"){
header("Location: login.php?logout=1");
die();
echo '<center><h4>Please wait...</h4></center>';
echo '<meta http-equiv="refresh" content="2;url=login.php?logout=1">';
die();
} else if($_GET["page"] == "signup"){
include_once "signup.php";
include_once "signup.php";
} else {
$uid = $_GET["page"];
include_once "ViewPaste.php";
$uid = $_GET["page"];
include_once "ViewPaste.php";
}
} else if (isset($_GET["user"])){
include_once "UserPage.php";
Expand Down
9 changes: 6 additions & 3 deletions login.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ function generate_skey(){
LogOutUserBySession($_COOKIE["pp_sid"],$_COOKIE["pp_skey"]);
UnsetBrowserCookies();
}
header("Location: index.php");
echo '<center><h4>Please wait...</h4></center>';
echo '<meta http-equiv="refresh" content="2;url=index.php">';
} else if(isset($_POST["type"])) {
if($_POST["type"]=="login" && isset($_POST["user"]) && isset($_POST["pwd"])){
//Get options
Expand Down Expand Up @@ -44,7 +45,8 @@ function generate_skey(){
setcookie("pp_sid", $sid); //Dies when browser closes
setcookie("pp_skey", $skey); //Dies when browser closes
}
header("Location: index.php");
echo '<center><h4>Please wait...</h4></center>';
echo '<meta http-equiv="refresh" content="2;url=index.php">';
die();
}
else echo "No!"; //TODO: Wrong password
Expand Down Expand Up @@ -78,7 +80,8 @@ function generate_skey(){
$stmt->bindParam(':user', $user);
$stmt->bindParam(':pwd', $hash);
if($stmt->execute()){
header("Location: login");
echo '<center><h4>Please wait...</h4></center>';
echo '<meta http-equiv="refresh" content="2;url=login">';
} else {
echo "Fail!";
}
Expand Down

0 comments on commit cbb9b99

Please sign in to comment.