Just another url shortener http://shikiryu.alwaysdata.net/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
1011 B

include 'XMLSQL.php';
class ShortURL extends XMLSQL{
const DATABASE = "db/database.xml";
const STATE_ALREADY_EXIST = "Ce nom de raccourci existe déjà";
const STATE_FIELD_MISSING = "Merci de remplir les 2 champs. ";
const STATE_ERROR = "Erreur. ";
public $_debug = false;
public function __construct($path = ''){
public function shortThisUrl($longUrl, $shortName){
if($this->pkAlreadyExists($shortName, 'url')){
return $this->insert(array('url'=>$longUrl), rawurlencode($shortName))->into('url')->query();
public function findThisUrl($shortName){
if($this->pkAlreadyExists(rawurlencode($shortName), 'url')){
return $this->select(array('url'))->from('url')->where(rawurlencode($shortName))->query();
public function extractEverything(){
return $this->select()->from('url')->query();