tengo esto
Código PHP:
$error = false;
$url = trim(urldecode(@$_REQUEST['url']));
if (!empty($url) && !$error) {
if ($url{strlen($url) - 1} == "/") {
$url = substr($url, 0, -1);
}
if (!preg_match("/^(ht|f)t(p|ps)\:\/\//si", $url)) {
$url = "http://".$url;
}
$length = strlen($url);
$count = 0;
db_connect();
do {
$short_url = generate_url();
$suffix = $short_url{0};
$result = mysql_query("SELECT url, short_url FROM url_{$suffix} WHERE short_url = '$short_url' OR url = '$url'") or die(mysql_error());
$count = mysql_num_rows($result);
if ($count > 0) {
$row = mysql_fetch_row($result);
if (stripslashes($row[0]) == $url) {
break;
}
}
else {
mysql_query("INSERT INTO url_{$suffix} (short_url, url, created) VALUES ('$short_url', '".mysql_real_escape_string($url)."', NOW())") or die(mysql_error());
break;
}
} while ($count > 0);
$short_url = "http://".$config['domain']."/".((!$config['rewrite']) ? "?" : "").$short_url;
$short_length = strlen($short_url);
echo "<div class=\"ResultTitle\"><strong>URL exprimida!</strong></div><br />\n".
"<div class=\"ResultBody\">La URL que puedes mostrar:<br /><br />\n".
"<strong>$url</strong><br /><br />\n".
"tiene una longitud de $length caracteres y dio lugar a la siguiente dirección URL abreviada que tiene una longitud de $short_length caracteres:<br /><br />\n".
"<strong>$short_url</strong><br /><br />\n".
"[ <a href=\"$short_url\" target=\"_blank\">Abrir en una nueva ventana</a> ]</div>\n";
}
else {
echo "<div class=\"ErrorBody\"><strong>La Dirección corta ya esta en uso prueba con otra!!!!.</strong></div><br />\n";
}
pero cuando le pongo la misma short_URL no me saca el mensaje de "la direccion ya esta en uso prueba con otra"
simplemente me escupe un error de servidor
Cita: Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator,
[email protected] and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.