示例#1
0
文件: index.php 项目: laiello/murl
         }
     }
 } else {
     $protocol_ok = true;
 }
 # add the url to the database
 if ($protocol_ok && $lilurl->add_url($longurl)) {
     $id_court = $lilurl->get_id($longurl);
     $sql = 'SELECT cpt,url,title FROM ' . URL_TABLE . ' where id = "' . $id_court . '"';
     $rqt = mysql_query($sql) or die('Error with ' . $sql);
     while ($liste = mysql_fetch_row($rqt)) {
         $nb = $liste[0];
         $url = $liste[1];
         $title = $liste[2];
         if ($title == "") {
             $title = $lilurl->get_url_title($longurl, $id_court);
         }
     }
     if (REWRITE) {
         // mod_rewrite style link
         $url = 'http://' . $_SERVER['SERVER_NAME'] . dirname($_SERVER['PHP_SELF']) . $id_court;
     } else {
         // regular GET style link
         $url = 'http://' . $_SERVER['SERVER_NAME'] . $_SERVER['PHP_SELF'] . '?id=' . $id_court;
     }
     //Si on souhaite une redirection vers un service de partage ...
     $shareto = $_REQUEST['shareto'];
     $location = '';
     switch ($shareto) {
         case "twitter":
             if (strlen($title) > 100) {