Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
jianminglok committed Jul 3, 2017
1 parent c60674b commit 9da9965
Show file tree
Hide file tree
Showing 51 changed files with 1,401 additions and 4,001 deletions.
43 changes: 35 additions & 8 deletions login.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,23 @@

$error = false;

require_once __DIR__ . '/recaptcha/autoload.php';
$recaptcha = new \ReCaptcha\ReCaptcha('6LdCACcUAAAAAP21WAlXjZaFpem_an3HiizWymAf');

//check if form is submitted
if (isset($_POST['login'])) {

if (isset($_POST['g-recaptcha-response']) && !empty($_POST['g-recaptcha-response'])) {

$resp = $recaptcha->verify($_POST["g-recaptcha-response"], $_SERVER['REMOTE_ADDR']);

$email = $_POST['email'];
if (!$resp->isSuccess()) {
$errorinfo = "Bots are not welcomed! Go away please! :P";
exit();

} else if($resp->isSuccess()) {

$email = $_POST['email'];

$check = mysqli_query($con, "SELECT * FROM confirm WHERE email = '$email'");
$row=mysqli_fetch_array($check,MYSQLI_ASSOC);
Expand Down Expand Up @@ -49,14 +62,22 @@
$errorinfo = "Your account is not activated or your new email address has not been verified.";
$error = true;
}


}

} else {
$errorinfo = "Please tick the reCAPTCHA verification checkbox before continuing.";
}

}
?>

<!DOCTYPE html>
<html style="height:100%; ">
<head>
<title>BanaSell - Sign In</title>
<script src="https://www.google.com/recaptcha/api.js" async defer></script>
<script src='https://www.google.com/recaptcha/api.js'></script>
</head>
<body style="background-image: url('img/background.jpg'); height:100%; background-size: 100% 100%;
background-repeat: no-repeat;
Expand All @@ -81,16 +102,18 @@
}
</style>
<main class="mdl-layout__content">
<div class="demo-card-wide mdl-card mdl-shadow--2dp" style=" margin: 5px 0;

<form method="post" action="#" style="">
<div class="demo-card-wide mdl-card mdl-shadow--2dp" style=" margin: 45px 0;
max-width: 1044px;
margin-left: auto;
margin-right: auto;">
<div class="mdl-card__title">
<h2 class="mdl-card__title-text">Sign In</h2>
</div>
<!-- MDL Progress Bar with Indeterminate Progress -->
<div class="mdl-card__supporting-text">
<form method="post" action="#" style="padding-left: 1em; padding-right: 1em; padding-top: 1em; padding-bottom: 1.5em;">
<div class="mdl-card__supporting-text" style="margin-left: 1em; margin-right: 1em; margin-top: 0.82em; margin-bottom: 1.5em;">

<!-- Simple Textfield -->
<?php if($error) { ?>
<label class="mdl-textfield--floating-label " for="email">Please enter your email</label>
Expand Down Expand Up @@ -126,9 +149,12 @@

<?php } ?>

<div class="g-recaptcha" data-sitekey="your_site_key" style="padding-top: 1.5em; padding-bottom: 1.5em"></div>

</div>

<div style="padding-left: 1.5em">
<div class="g-recaptcha" data-sitekey="6LdCACcUAAAAAPxzdpV5cuDS9dOWZukpisPrqsTy" style="padding-bottom: 1.5em; "></div>
</div>

<div class="mdl-card__actions mdl-card--border">
<button name="login" type="submit" class="mdl-button mdl-button--colored mdl-js-button mdl-js-ripple-effect" style="margin-left: 0.5em;">
Sign In
Expand All @@ -137,9 +163,10 @@
Need Help?
</button>
</div>
</div>
</form>
</form>

</div>
</main>
<?php if(isset($errorinfo)) { ?>
<div id="error-toast" class="mdl-js-snackbar mdl-snackbar">
Expand Down
6 changes: 6 additions & 0 deletions nav.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@
<link rel="stylesheet" href="css/material.css">
<link rel="stylesheet" href="css/styles.css">
<link rel="stylesheet" href="css/mdl-selectfield.min.css">
<link href="http://code.jquery.com/ui/1.10.0/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
<script src="http://code.jquery.com/jquery-1.9.0.js"></script>
<script src="http://code.jquery.com/ui/1.10.0/jquery-ui.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.8.3/modernizr.js"></script>
<script src="js/material.js"></script>
<script src="js/mdl-selectfield.min.js"></script>

<style>
#view-source {
Expand Down
44 changes: 22 additions & 22 deletions nav2.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,28 @@
<link rel="stylesheet" href="css/material.css">
<link rel="stylesheet" href="css/styles.css">
<link rel="stylesheet" href="css/mdl-selectfield.min.css">
<link href="http://code.jquery.com/ui/1.10.0/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
<script src="http://code.jquery.com/jquery-1.9.0.js"></script>
<script src="http://code.jquery.com/ui/1.10.0/jquery-ui.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.8.3/modernizr.js"></script>
<script src="js/material.js"></script>
<script src="js/mdl-selectfield.min.js"></script>
<script>
var today = new Date(); //Get today's date
var lastDate = new Date(today.getFullYear() -12, 11, 31); //To get the 31st Dec of next year
var firstDate = new Date(today.getFullYear() -170, 0, 1);
$(function(){
if (!Modernizr.inputtypes.date) {
$('input[type=date]').datepicker({
dateFormat : 'yy-mm-dd',
minDate: firstDate,
maxDate: lastDate,
hideIfNoPrevNext: true
}
);
}
});
</script>
<link href="http://code.jquery.com/ui/1.10.0/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
<script src="http://code.jquery.com/jquery-1.9.0.js"></script>
<script src="http://code.jquery.com/ui/1.10.0/jquery-ui.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.8.3/modernizr.js"></script>
<script src="js/material.js"></script>
<script src="js/mdl-selectfield.min.js"></script>
<script>
var today = new Date(); //Get today's date
var lastDate = new Date(today.getFullYear() -12, 11, 31); //To get the 31st Dec of next year
var firstDate = new Date(today.getFullYear() -170, 0, 1);
$(function(){
if (!Modernizr.inputtypes.date) {
$('input[type=date]').datepicker({
dateFormat : 'yy-mm-dd',
minDate: firstDate,
maxDate: lastDate,
hideIfNoPrevNext: true
}
);
}
});
</script>
<style>
#view-source {
position: fixed;
Expand Down
198 changes: 198 additions & 0 deletions nav4.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,198 @@
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="description" content="Introducing Lollipop, a sweet new take on banasell.">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0">
<title>banasell</title>

<!-- Page styles -->
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:regular,bold,italic,thin,light,bolditalic,black,medium&amp;lang=en">
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<link rel="stylesheet" href="css/material.css">
<link rel="stylesheet" href="css/styles.css">
<link rel="stylesheet" href="css/mdl-selectfield.min.css">
<link href="http://code.jquery.com/ui/1.10.0/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
<script src="http://code.jquery.com/jquery-1.9.0.js"></script>
<script src="http://code.jquery.com/ui/1.10.0/jquery-ui.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.8.3/modernizr.js"></script>
<script src="js/material.js"></script>
<script src="js/mdl-selectfield.min.js"></script>
<style>
#view-source {
position: fixed;
display: block;
right: 0;
bottom: 0;
margin-right: 40px;
margin-bottom: 40px;
z-index: 900;
}
_:-moz-tree-row(hover), .banasell-search-box {
top: 4px;
}
@supports (-webkit-appearance:none) {
.banasell-search-box {
top: 1.5px;
}
}
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
.banasell-search-box {
top: 3.5px;
}
}
</style>
</head>

<?php

unset($errormsg);

$fn = basename($_SERVER['PHP_SELF']);

if(isset($_SESSION['usr_id'])!="") {
$timeouttime = time() - $_SESSION['timeout'];

if(!empty($_SESSION['stayloggedin'])) {
if($_SESSION['stayloggedin'] < time()) {

session_destroy(); unset($_SESSION['usr_id']); unset($_SESSION['usr_name']); unset($_SESSION['stayloggedin']); header("Location: index.php");

}
} else {
if ($timeouttime > 1800) {
session_destroy(); unset($_SESSION['usr_id']); unset($_SESSION['usr_name']); header("Location: index.php");

}else {
$_SESSION['timeout'] = time();
}
}
}



if (isset($_SESSION['previous']) && isset($_SESSION['previous2'])) {
if (basename($_SERVER['PHP_SELF']) != $_SESSION['previous'] && basename($_SERVER['PHP_SELF']) != $_SESSION['previous2'] ) {
session_destroy();
### or alternatively, you can use this for specific variables:
### unset($_SESSION['varname']);
}
}

if (isset($_SESSION['previous3'])) {
if (basename($_SERVER['PHP_SELF']) != $_SESSION['previous3']) {
unset($_SESSION['email2']);
### or alternatively, you can use this for specific variables:
### unset($_SESSION['varname']);
}
}

if (isset($_SESSION['previous4']) && isset($_SESSION['created'])) {
if (basename($_SERVER['PHP_SELF']) != $_SESSION['previous4'] OR time() - $_SESSION['created'] > 5) {
unset($_SESSION['error_info']);
### or alternatively, you can use this for specific variables:
### unset($_SESSION['varname']);
}
}

?>

<style type="text/css">
input {
height: 100%;
}
.form-check-input:only-child {
position: absolute;
}
</style>

<body>
<div class="mdl-layout mdl-js-layout mdl-layout--fixed-header mdl-layout--fixed-tabs">

<div class="banasell-header mdl-layout__header">
<div class="mdl-layout__header-row">
<span class="banasell-title mdl-layout-title">
<img class="banasell-logo-image" src="icon/banasell.png">
</span>
<!-- Add spacer, to align navigation to the right in desktop -->
<div class="banasell-header-spacer mdl-layout-spacer"></div>
<div class="banasell-search-box mdl-textfield mdl-js-textfield mdl-textfield--expandable mdl-textfield--floating-label mdl-textfield--align-right mdl-textfield--full-width">
<form action="search.php" method="GET">
<label class="mdl-button mdl-js-button mdl-button--icon" for="search-field">
<i class="material-icons">search</i>
</label>
<div class="mdl-textfield__expandable-holder">
<input name="search_value" class="mdl-textfield__input" type="text" id="search-field">
</div>
</form>
</div>
<!-- Navigation -->
<div class="banasell-navigation-container">
<nav class="banasell-navigation mdl-navigation">
<a <?php echo ($page == 'index.php') ? "class='mdl-navigation__link mdl-navigation__link-active mdl-typography--text-uppercase active' href='#'" : ""; ?> class="mdl-navigation__link mdl-typography--text-uppercase active" href="index.php">Home</a>
<a <?php echo ($page == 'booklist.php') ? "class='mdl-navigation__link mdl-navigation__link-active mdl-typography--text-uppercase active' href='#'" : ""; ?> class="mdl-navigation__link mdl-typography--text-uppercase" href="booklist.php">Book List</a>
<a <?php echo ($page == 'filterbooks.php' OR $page == 'filterresults.php') ? "class='mdl-navigation__link mdl-navigation__link-active mdl-typography--text-uppercase active' href='#'" : ""; ?> class="mdl-navigation__link mdl-typography--text-uppercase" href="filterbooks.php">Find Specific Book</a>
<a <?php echo ($page == 'watchlist.php' OR $page == 'watchlistresults.php' OR $page == 'watchlistadd.php') ? "class='mdl-navigation__link mdl-navigation__link-active mdl-typography--text-uppercase active' href='#'" : ""; ?> class="mdl-navigation__link mdl-typography--text-uppercase" href="watchlist.php">Watchlist</a>
<a <?php echo ($page == 'selectbooks.php' OR $page == 'submitbooks.php') ? "class='mdl-navigation__link mdl-navigation__link-active mdl-typography--text-uppercase active' href='#'" : ""; ?> class="mdl-navigation__link mdl-typography--text-uppercase" href="selectbooks.php">Post An Ad</a>
</nav>
</div>
<span class="banasell-mobile-title mdl-layout-title">
<img class="banasell-logo-image" src="icon/banasell.png">
</span>
<button class="banasell-more-button mdl-button mdl-js-button mdl-button--icon mdl-js-ripple-effect" id="more-button">
<i class="material-icons">more_vert</i>
</button>
<ul class="mdl-menu mdl-js-menu mdl-menu--bottom-right mdl-js-ripple-effect" for="more-button">
<li class="mdl-menu__item">About Us</li>
<li class="mdl-menu__item">FAQ</li>
<li class="mdl-menu__item">Contact Us</li>
<li <?php echo ($page == 'updateemail.php') ? "class='mdl-menu__item' onclick='#'" : ""; ?> class="mdl-menu__item" onclick="window.location='updateemail.php'">Update Email & Info</li>
</ul>
<button class="banasell-account-button banasell-more-button mdl-button mdl-js-button mdl-button--icon mdl-js-ripple-effect" id="account-button" style=" display: block !important;">
<?php if (isset($_SESSION['usr_id']) ) { ?>
<i class="material-icons" style="color: green !important;">account_circle</i>
<?php } else { ?>
<i class="material-icons">account_circle</i>
<?php } ?>
</button>
<ul class="mdl-menu mdl-js-menu mdl-menu--bottom-right mdl-js-ripple-effect" for="account-button">
<?php if (isset($_SESSION['usr_id']) ) { ?>
<li disabled class="mdl-menu__item">Signed In as <?php echo $_SESSION['usr_name']; ?></li>
<li class="mdl-menu__item" onclick="window.location='logout.php'">Sign Out</li>
<?php } elseif($fn == 'login.php' AND $fn !== 'register.php' AND $fn !== 'dob.php') { ?>
<li <?php echo ($page == 'login.php') ? "class='mdl-menu__item' onclick='#'" : ""; ?> class="mdl-menu__item">Sign In</li>
<li class="mdl-menu__item" onclick="window.location='dob.php'">Sign Up</li>
<?php } else { ?>
<li class="mdl-menu__item" onclick="window.location='login.php'">Sign In</li>
<li <?php echo ($page == 'register.php' OR $page == 'dob.php') ? "class='mdl-menu__item' onclick='#'" : ""; ?> class="mdl-menu__item" onclick="window.location='dob.php'">Sign Up</li>
<?php } ?>
</ul>
</div>
<!-- Tabs -->
<!-- Tabs -->
<div class="mdl-layout__tab-bar mdl-js-ripple-effect" >
<a <?php echo ($page == 'updateemail.php') ? "class='mdl-layout__tab is-active' href='#'" : ""; ?> href="updateemail.php" class="mdl-layout__tab">Update Email</a>
<a <?php echo ($page == 'updateinfo.php') ? "class='mdl-layout__tab is-active' href='#'" : ""; ?> href="updateinfo.php" class="mdl-layout__tab">Update Info</a>
</div>
</div>

<div class="banasell-drawer mdl-layout__drawer" >
<span class="mdl-layout-title" style="line-height: 1em !important">
<i class="material-icons" style="padding-top: 3em;">account_circle</i>
<br></br>
<span><?php if(isset($_SESSION['usr_name'])) { echo $_SESSION['usr_name']; } else { echo 'Sign In'; } ?></span>
</span>
<nav class="mdl-navigation">
<a <?php echo ($page == 'index.php') ? "class='mdl-navigation__link mdl-navigation__link-active' href='#'" : ""; ?> class="mdl-navigation__link" href="index.php">Home</a>
<a <?php echo ($page == 'booklist.php') ? "class='mdl-navigation__link mdl-navigation__link-active' href='#'" : ""; ?> class="mdl-navigation__link" href="booklist.php">Book List</a>
<a <?php echo ($page == 'filterbooks.php' OR $page == 'filterresults.php') ? "class='mdl-navigation__link mdl-navigation__link-active' href='#'" : ""; ?> class="mdl-navigation__link" href="filterbooks.php">Find Specific Book</a>
<a <?php echo ($page == 'watchlist.php' OR $page == 'watchlistresults.php' OR $page == 'watchlistadd.php') ? "class='mdl-navigation__link mdl-navigation__link-active' href='#'" : ""; ?> class="mdl-navigation__link" href="watchlist.php">Watchlist</a>
<a <?php echo ($page == 'selectbooks.php' OR $page == 'submitbooks.php') ? "class='mdl-navigation__link mdl-navigation__link-active' href='#'" : ""; ?> class="mdl-navigation__link" href="selectbooks.php">Post an Ad</a>
<div class="banasell-drawer-separator"></div>
<span class="mdl-navigation__link" href="">More</span>
<a class="mdl-navigation__link" href="">About Us</a>
<a class="mdl-navigation__link" href="">FAQ</a>
<a class="mdl-navigation__link" href="">Contact Us</a>
<a class="mdl-navigation__link" href="">Update Email & Info</a>
</nav>
</div>

Loading

0 comments on commit 9da9965

Please sign in to comment.