mirror of
https://github.com/Chouchen/shorturl.git
synced 2018-06-07 06:34:38 +02:00
Bookmarklet checker
This commit is contained in:
parent
47d162684d
commit
9ef54c068f
33
add.php
Normal file
33
add.php
Normal file
@ -0,0 +1,33 @@
|
||||
<?
|
||||
header("Content-type: text/javascript");
|
||||
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
|
||||
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date dans le passé
|
||||
|
||||
$s = $_GET['s'];
|
||||
$url = $_GET['u'];
|
||||
$title = $_GET['t'];
|
||||
$version = $_GET['v'];
|
||||
|
||||
include 'class/ShortURL.php';
|
||||
|
||||
$url = new ShortURL();
|
||||
|
||||
if($s=='' || $url==''){
|
||||
echo 'alert("'.ShortURL::STATE_FIELD_MISSING.'");';
|
||||
exit;
|
||||
}
|
||||
|
||||
$ret = $url->shortThisUrl($url, $s);
|
||||
|
||||
if(is_bool($ret) && !$ret){
|
||||
echo 'alert("'.ShortURL::STATE_ERROR.'");';
|
||||
exit;
|
||||
}
|
||||
elseif($ret === ShortURL::STATE_ALREADY_EXIST){
|
||||
echo 'alert("'.$ret.'");';
|
||||
exit;
|
||||
}
|
||||
else{
|
||||
echo 'alert("Raccourci créé : <a href="http://'.$_SERVER['SERVER_NAME'].$folder.rawurlencode($newname).'">http://'.$_SERVER['SERVER_NAME'].$folder.rawurlencode($newname).'</a>");';
|
||||
exit;
|
||||
}
|
Loading…
Reference in New Issue
Block a user