-
Notifications
You must be signed in to change notification settings - Fork 0
/
map_main.php
36 lines (33 loc) · 947 Bytes
/
map_main.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
<?php
//error_reporting(E_ERROR | E_PARSE); //suppress warnings and errors
require 'con-db.php'; // database connectivity
require 'main.php'; //file having the base_encode and base_decode dode
$short = $_POST['short'];
echo $short;
echo "<br/>";
// http://po.lo/
$len = strlen($short);
if($short[$len-1] == "/") //remove the last forward slash in the link
$short[$len-1] = NULL;
$short = substr($short, strpos($short, '/',12) + 1);
// echo $short;
// echo "<br/>";
$short = trim($short);
echo "<br/>";
$decoded_id = base_decode($short,$alphabet);
// echo $decoded_id;
session_start();
$sql_long = "SELECT long_url from data where id = '$decoded_id'";
$update = "UPDATE data SET clicks = clicks+1 WHERE id = '$decoded_id'";
if(!mysqli_query($con,$update))
{
echo "Err";
}
$results = mysqli_query($con,$sql_long);
while ($result = $results->fetch_assoc())
{
echo $result['long_url'];
// echo "<br/>helo";
}
$con->close();
?>