// if there's a list of allowed protocols, // check to make sure that the user's url uses one of them if (count($allowed_protocols)) { foreach ($allowed_protocols as $ap) { if (strtolower(substr($longurl, 0, strlen($ap))) == strtolower($ap)) { $protocol_ok = true; break; } } } else { $protocol_ok = true; } // add the url to the database if ($protocol_ok && $lilurl->add_url($longurl)) { if (REWRITE) { $url = 'http://' . $_SERVER['SERVER_NAME'] . dirname($_SERVER['PHP_SELF']) . $lilurl->get_id($longurl); } else { $url = 'http://' . $_SERVER['SERVER_NAME'] . $_SERVER['PHP_SELF'] . '?id=' . $lilurl->get_id($longurl); } $msg = '<p class="success">URL is: <a href="' . $url . '">' . $url . '</a></p>'; $msg = '<p class="success">URL is: <a href="' . $url . '">' . $url . '</a><br /><input type="text" id="copybox" value="' . $url . '" onselect="select_text();" onkeyup="select_text();" onclick="select_text();" readonly="readonly"/> <br />ready to be copied to your clipboard</p> <script language="JavaScript" type="text/javascript"> <!-- function select_text() { el = document.getElementById(\'copybox\'); if (el.createTextRange) { var oRange = el.createTextRange(); oRange.moveStart("character", 0); oRange.moveEnd("character", el.value.length);
$protocol_ok = false; # if there's a list of allowed protocols, # check to make sure that the user's url uses one of them if (count($allowed_protocols)) { foreach ($allowed_protocols as $ap) { if (strtolower(substr($longurl, 0, strlen($ap))) == strtolower($ap)) { $protocol_ok = true; break; } } } 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