PHP Classes

File: redir.php

Recommend this page to a friend!
  Classes of Chouchen   PHP Short URL Generator   redir.php   Download  
File: redir.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP Short URL Generator
Create short URLs storing them in a XML database
Author: By
Last change:
Date: 4 years ago
Size: 358 bytes
 

Contents

Class file image Download
<?
/**
 *
 * Redirecting file
 * Take the name in the url and redirect if it's in the DB
 */
session_start();
include
'class/ShortURL.php';

$url = new ShortURL();

$name = $_GET['name'];

$_SESSION['msg'] = '';

$ret = $url->findThisUrl($name);

if(
$ret == null){
   
header("Location: 404.html");
}else{
   
header("Location: ".$ret[0]);
}