hi
sorry if im asking in the wrong section
i have a little problem with a php script
i want to use url shortening service for myself on my own host
so i searched alot and found the php script that is exactly what i want
but there is a problem . the this script have ability to shorten the url and add automatic name or number to the shortened url or the user can define tag for its shortened url
and now the problem while defining tag im not able to use some characters like / or . or _ so i need a help to modify the script so i can use those characters too when chosing tag for my shortened url
i do not know php and have nobody to help me
i searched alot in the script and i think this the line that need to be modified
// Check or determine new URL (if not an edit)
if ( $return == 'index.php' ) {
if ( empty($_POST['key']) ) {
$custom=0;
// Find last URL
$result = mysql_query('SELECT id FROM shrt_urls WHERE custom=0 ORDER BY id DESC') or error('Query failed. '.mysql_error());
// Get its ID
if ( mysql_num_rows($result) ) {
$id = mysql_result($result,0,0)+1;
} else
$id = 1;
// Loop through till we find a free ID (needs improving to reduce potential number of queries)
while ( mysql_num_rows(mysql_query('SELECT 1 FROM shrt_urls WHERE id='.$id.' LIMIT 1')) )
$id++;
$key = id2key($id);
} else {
$custom = 1;
$key = clean($_POST['key']);
// Check for forbidden characters
if ( ! ctype_alnum($key) ) {
$_SESSION['msg'] = 'Error: The new URL can only contain alphanumeric characters (a-z,0-9).';
localRedirect($return);
}
// Check chosen key is available
$id = key2id($key);
if ( mysql_num_rows(mysql_query('SELECT 1 FROM shrt_urls WHERE id='.$id.' LIMIT 1')) ) {
$_SESSION['msg'] = 'Error: Sorry, the new URL you chose is already in use.';
localRedirect($return);
hope ive guessed it write
can someone help me remove this restriction ?
thanks so much in advanced