-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
62 lines (59 loc) · 1.58 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="css/fonts.css">
<style>
button {
padding: 10px 25px 8px;
color: #fff;
background-color: #000000;
font-size: 16px;
border: 1px solid #333;
border-radius: 2px;
margin-top: 10px;
cursor:pointer;
}
</style>
<title>link Shortner</title>
<meta charset="utf-8">
<link rel="stylesheet" href="css/style.css" />
</head>
<body>
<?php include 'inc/nav.php';?>
<?php
require('inc/function.php');
if (isset($_REQUEST['url'])){
$url = stripslashes($_REQUEST['url']); // removes backslashes
$title = stripslashes($_REQUEST['entry']); // removes backslashes
$flag = checking_duplicate($url);
if($flag==0){
$flag = insert_into_database($url,$title);
}
if($flag==1){
$id = check_for_id($url);
echo "<h1 style='padding-left:15%;'>Here's your URL:</h1>";
echo "<p style='padding-left:15%;'>Shorted URL : <a href='go.php?a=".$id."' alt='Shortened Link'>";
echo "http://lsa.atwebpages.com.com/go.php?a=".$id."</a></p>";
echo "<p style='padding-left:15%;'>URL : <a href='go.php' alt='Shortened Link'>";
echo "$url</a></p>";
}
}
else{
?>
<center>
<br>
<br>
<div class="form">
<h1>Shorten a Link</h1>
<form name="registration" method="post">
<input type="text" name="url" placeholder="URL to Shorten" required />
<input type="text" id="entry" name="entry" placeholder="Custom Text" required />
<br>
<button type="submit" class="submit" name="submit" value="Shorten Link">Shorten Link</button>
</form>
</div>
</center>
<?php include 'inc/footer.php';?>
<?php } ?>
</body>
</html>