Login   Register  
PHP Classes
elePHPant
Icontem

File: link.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Ovunc Tukenmez  >  URL Shortener  >  link.php  >  Download  
File: link.php
Role: Example script
Content type: text/plain
Description: sample_script - link.php
Class: URL Shortener
Create and expand short URLs in a MySQL database
Author: By
Last change:
Date: 2012-11-04 15:14
Size: 649 bytes
 

Contents

Class file image Download
<?php
require_once('class/UrlShortener.php');

$link_id = (isset($_GET['id']) ? $_GET['id'] : '');

if (
$link_id != '') {
    
$urlShortener = new UrlShortener();
    
    
$long_url $urlShortener->getLongUrl($link_id);
    if (
$long_url != '') {
        
header('Location: ' $long_url);
        exit();
    }
}

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Generate Short Link</title>
</head>

<body>
No link has been found.
</body>
</html>