1
0
mirror of https://github.com/Chouchen/shorturl.git synced 2018-06-07 06:34:38 +02:00

Added logging (for debugging)

This commit is contained in:
Shikiryu 2011-01-04 10:19:25 +00:00
parent 7cf281fc49
commit 47d162684d

View File

@ -3,9 +3,13 @@ session_start();
include 'class/ShortURL.php'; include 'class/ShortURL.php';
$url = new ShortURL(); $url = new ShortURL();
$log = new Log('shorting.log');
$newname = $_POST['shortName']; $newname = $_POST['shortName'];
$newURL = $_POST['url']; $newURL = $_POST['url'];
$log->message('entering '.$newname.' as '.$newURL);
$_SESSION['msg'] = ''; $_SESSION['msg'] = '';
if($newname =='' || $newURL==''){ if($newname =='' || $newURL==''){
$_SESSION['msg'] .= ShortURL::STATE_FIELD_MISSING; $_SESSION['msg'] .= ShortURL::STATE_FIELD_MISSING;
@ -26,7 +30,12 @@ else{
$folder = '/'.$folders[1].'/'; $folder = '/'.$folders[1].'/';
}else }else
$folder = '/'; $folder = '/';
$log->message('folder : '.$folder);
$_SESSION['msg'] .= 'Raccourci cr&eacute;&eacute; : <a href="http://'.$_SERVER['SERVER_NAME'].$folder.rawurlencode($newname).'">http://'.$_SERVER['SERVER_NAME'].$folder.rawurlencode($newname).'</a>'; $_SESSION['msg'] .= 'Raccourci cr&eacute;&eacute; : <a href="http://'.$_SERVER['SERVER_NAME'].$folder.rawurlencode($newname).'">http://'.$_SERVER['SERVER_NAME'].$folder.rawurlencode($newname).'</a>';
$log->message('that makes the link : http://'.$_SERVER['SERVER_NAME'].$folder.rawurlencode($newname).'"');
} }
header('Location: '.$folder); header('Location: '.$folder);