-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
executable file
·51 lines (46 loc) · 1.36 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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<link href="css/main.css" rel="stylesheet">
<script type="text/javascript" src="js/short.js"></script>
<title>URL shortener</title>
</head>
<body>
<div class="content">
<header>URL shortener</header>
<form action="javascript:shortMe()">
<table>
<tr>
<th>Long URL</th>
<th>Short URL</th>
</tr>
<tr>
<td>
<input type="url" name="url" autofocus="autofocus">
<input type="submit" value="Do!">
</td>
<td id=result><span id="spanResult"></span></td>
</tr>
</table>
</form>
<footer>
<pre>
Workflow:
1. Site-visitor (V) enters any original URL to the Input field, like
http://anydomain/any/path/etc;
2. V clicks submit button;
3. Page makes AJAX-request;
4. Short URL appears in Span element, like http://yourdomain/abCdE (don't use any
external APIs as goo.gl etc.);
5. V can copy short URL and repeat process with another link
Short URL should redirect to the original link in any browser from any place and keep
actuality forever, doesn't matter how many times application has been used after that.
Requirements:
1. Use PHP;
2. Don't use any frameworks.
</pre>
</footer>
</div>
</body>
</html>