Compare commits
6 Commits
e36a2cbd77
...
3b59de608a
Author | SHA1 | Date | |
---|---|---|---|
3b59de608a | |||
606d58e197 | |||
63effd893e | |||
69c8934a77 | |||
665ab0aeac | |||
b0400e59a0 |
45
header.php
Normal file
45
header.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
session_start();
|
||||
?>
|
||||
<nav class="flex items-center justify-between flex-wrap bg-gray-500 p-6 shadow-lg shadow-black/50 sticky top-0"> <!--dark:bg-black-->
|
||||
<div class="flex items-center flex-shrink-0 text-white mr-6">
|
||||
<svg id="logo" class="fill-current h-8 w-8 mr-2" width="54" height="54" viewBox="0 0 54 54" xmlns="http://www.w3.org/2000/svg"><path d="M13.5 22.1c1.8-7.2 6.3-10.8 13.5-10.8 10.8 0 12.15 8.1 17.55 9.45 3.6.9 6.75-.45 9.45-4.05-1.8 7.2-6.3 10.8-13.5 10.8-10.8 0-12.15-8.1-17.55-9.45-3.6-.9-6.75.45-9.45 4.05zM0 38.3c1.8-7.2 6.3-10.8 13.5-10.8 10.8 0 12.15 8.1 17.55 9.45 3.6.9 6.75-.45 9.45-4.05-1.8 7.2-6.3 10.8-13.5 10.8-10.8 0-12.15-8.1-17.55-9.45-3.6-.9-6.75.45-9.45 4.05z"/></svg>
|
||||
<span class="font-semibold text-xl tracking-tight">G-Link</span>
|
||||
</div>
|
||||
<div class="block lg:hidden">
|
||||
<button id="hamburger-menu" class="flex items-center px-3 py-2 border rounded text-teal-200 border-teal-400 hover:text-white hover:border-white">
|
||||
<svg class="fill-current h-3 w-3" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><title>Menu</title><path d="M0 3h20v2H0V3zm0 6h20v2H0V9zm0 6h20v2H0v-2z"/></svg>
|
||||
</button>
|
||||
</div>
|
||||
<div id="menu-options" class="w-full lg:block flex-grow lg:flex lg:items-center lg:w-auto hidden">
|
||||
<div class="text-sm lg:flex-grow">
|
||||
<a href="#head" class="block mt-4 lg:inline-block lg:mt-0 text-teal-200 hover:text-black mr-4 hover:bg-gray-200 hover:border hover:border-gray-200 hover:rounded text-teal-200 py-1 px-3">
|
||||
A
|
||||
</a>
|
||||
<a href="#head" class="block mt-4 lg:inline-block lg:mt-0 text-teal-200 hover:text-black mr-4 hover:bg-gray-200 hover:border hover:border-gray-200 hover:rounded text-teal-200 py-1 px-3">
|
||||
B
|
||||
</a>
|
||||
<a href="#head" class="block mt-4 lg:inline-block lg:mt-0 text-teal-200 hover:text-black mr-4 hover:bg-gray-200 hover:border hover:border-gray-200 hover:rounded text-teal-200 py-1 px-3">
|
||||
C
|
||||
</a>
|
||||
<a href="/index.html" class="block mt-4 lg:inline-block lg:mt-0 bg-blue-600 brightness-125 border border-blue-500 rounded text-teal-200 hover:text-black py-1 px-3">
|
||||
Products (Form)
|
||||
</a>
|
||||
</div>
|
||||
<div>
|
||||
<?php if (isset($_SESSION['user'])) { ?>
|
||||
<a href="logout.php" class="inline-block text-sm px-4 py-2 leading-none border rounded text-white border-white hover:border-transparent hover:text-teal-500 hover:bg-white mt-4 lg:mt-0">
|
||||
Log Out
|
||||
</a>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
menu = document.querySelector("#hamburger-menu");
|
||||
options = document.querySelector("#menu-options");
|
||||
menu.addEventListener("click", () => {
|
||||
options.classList.toggle("hidden");
|
||||
})
|
||||
|
||||
</script>
|
||||
</nav>
|
5
howItWorks.txt
Normal file
5
howItWorks.txt
Normal file
@@ -0,0 +1,5 @@
|
||||
1. Enter the URL that you want to shorten.
|
||||
2. Enter the GLink - a keyword used to identify your URL. This is optional, and if this textbox is left blank, a random GLink will be generated for you. The GLink that you enter will be appended to the URL, like so: glink.zip/<your keyword>
|
||||
3. If you don't want to geo-restrict it, you're good to go! Skip to step 5.
|
||||
4. If you want to geo-restrict the link, select the checkbox, and provide a radius to use as a 'containment zone'. Only those individuals who are within that radius from your current location will be able to access the Glink.
|
||||
5. Click 'Zip it!' to generate your custom URL.
|
14
index.html
14
index.html
@@ -9,6 +9,20 @@
|
||||
<body class="bg-gray-50">
|
||||
<h1 class="ml-4 text-5xl font-narrow">Link Shortener</h1>
|
||||
<p class="ml-4 font-fingerpaint">Hello There!</p>
|
||||
|
||||
<?php
|
||||
// The reason this works (i.e. I can use PHP in a .html file)
|
||||
// is because I have configured my .htaccess file to treat every file
|
||||
// ending in .html, as if it contains embedded PHP.
|
||||
// However, this is a strain on resources as it means _every_ HTML
|
||||
// file will be parsed for PHP code, even if it doesn't contain any.
|
||||
// An alternative to doing this, is to use the .php file extension for
|
||||
// any HTML file that has embedded PHP code, and the .html extension
|
||||
// for static HTML files.
|
||||
?>
|
||||
|
||||
<?php include 'header.php'; ?>
|
||||
|
||||
<div id="root">
|
||||
<form id="form" method="GET" action="result.php" onsubmit="return validate()">
|
||||
|
||||
|
6
login.js
6
login.js
@@ -31,7 +31,7 @@ if (window.location.pathname === '/signup.html') {
|
||||
}
|
||||
let emailRX = new RegExp("^[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(\\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*@[A-Za-z0-9-]+(\\.[A-Za-z]+)+$");
|
||||
let domainError = document.getElementById("domain");
|
||||
let domainRX = new RegExp("^[a-zA-Z0-9!@#$%^&*]*$");
|
||||
let domainRX = new RegExp("^[a-zA-Z0-9!@#$%^&*_]*$");
|
||||
let emailError = document.getElementById("email-error");
|
||||
let capsRX = new RegExp(".*[A-Z]+");
|
||||
let capsError = document.getElementById("capital");
|
||||
@@ -39,7 +39,7 @@ let lowRX = new RegExp(".*[a-z]+");
|
||||
let lowError = document.getElementById("letter");
|
||||
let numRX = new RegExp(".*[0-9]+");
|
||||
let numError = document.getElementById("number");
|
||||
let symbolRX = new RegExp(".*[!@#$%^&*]+");
|
||||
let symbolRX = new RegExp(".*[!@#$%^&*_]+");
|
||||
let symbolError = document.getElementById("symbol");
|
||||
let MIN_LENGTH = 10;
|
||||
let lenError = document.getElementById("length");
|
||||
@@ -165,4 +165,4 @@ if (window.location.pathname === '/signup.html') {
|
||||
check_password.classList.remove("focus:ring-red-400");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
23
logout.php
Normal file
23
logout.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
if (session_status() != PHP_SESSION_ACTIVE) {
|
||||
header('Location: https://glink.zip');
|
||||
}
|
||||
|
||||
session_start();
|
||||
|
||||
// Unset all session variables
|
||||
session_unset();
|
||||
$_SESSION = array();
|
||||
|
||||
// Delete the session cookie by setting an equivalent one with a blank value
|
||||
$params = session_get_cookie_params();
|
||||
|
||||
setcookie(session_name(),'', time()-42000, $params["path"], $params["domain"], $params["secure"], $params["httponly"]);
|
||||
|
||||
// Destroy the session
|
||||
session_destroy();
|
||||
|
||||
header('Location: https://glink.zip/');
|
||||
?>
|
||||
|
@@ -1,6 +1,5 @@
|
||||
<?php
|
||||
require_once 'db.inc.php';
|
||||
ini_set("session.cookie_secure",1);
|
||||
session_start();
|
||||
use Cassandra;
|
||||
|
||||
|
Reference in New Issue
Block a user