Ver Mensaje Individual
  #1 (permalink)  
Antiguo 05/04/2011, 16:18
naruto261195
 
Fecha de Ingreso: abril-2011
Mensajes: 2
Antigüedad: 13 años
Puntos: 0
Pregunta Ayuda-script de acortador

La verdad soy nuevo en este foro.
a decir verdad descargue un script desde internet para agregarlo como acortador de urls cuando genero mi URL e mando tres errores y no genera nada, solo si me pudieran ayudar se los agradeceria.
los errores son:
Código:
Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in ...\includes\hjurl.php on line 19

Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in ...\includes\hjurl.php on line 73

Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in ...\includes\hjurl.php on line 123
el codigo es:

Código PHP:
<?php /* index.php ( lilURL implementation ) */

require_once 'includes/conf.php'// <- site-specific settings
require_once 'includes/hjurl.php'// <- lilURL class file

$lilurl = new lilURL();
$msg '';

// if the form has been submitted
if ( isset($_POST['longurl']) )
{
    
// escape bad characters from the user's url
    
$longurl trim(mysql_escape_string($_POST['longurl']));

    
// set the protocol to not ok by default
    
$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($longurl0strlen($ap))) == strtolower($ap) )
            {
                
$protocol_ok true;
                break;
            }
        }
    }
    else 
// if there's no protocol list, screw all that
    
{
        
$protocol_ok true;
    }
        
    
// add the url to the database
    
if ( $protocol_ok && $lilurl->add_url($longurl) )
    {
        if ( 
REWRITE // mod_rewrite style link
        
{
            
$url 'http://'.$_SERVER['SERVER_NAME'].dirname($_SERVER['PHP_SELF']).'/'.$lilurl->get_id($longurl);
        }
        else 
// regular GET style link
        
{
            
$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>';
    }
    elseif ( !
$protocol_ok )
    {
        
$msg '<p class="error">Invalid protocol!</p>';
    }
    else
    {
        
$msg '<p class="error">Creation of your lil´ URL failed for some reason.</p>';
    }
}
else 
// if the form hasn't been submitted, look for an id to redirect to
{
    if ( isSet(
$_GET['id']) ) // check GET first
    
{
        
$id mysql_escape_string($_GET['id']);
    }
    elseif ( 
REWRITE // check the URI if we're using mod_rewrite
    
{
        
$explodo explode('/'$_SERVER['REQUEST_URI']);
        
$id mysql_escape_string($explodo[count($explodo)-1]);
    }
    else 
// otherwise, just make it empty
    
{
        
$id '';
    }
    
    
// if the id isn't empty and it's not this file, redirect to it's url
    
if ( $id != '' && $id != basename($_SERVER['PHP_SELF']) )
    {
        
$location $lilurl->get_url($id);
        
        if ( 
$location != -)
        {
            
header('Location: '.$location);
        }
        else
        {
            
$msg '<p class="error">Sorry, but that lil´ URL isn\'t in our database.</p>';
        }
    }
}

// print the form

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html>

    <head>
        <title>RealGamez | Acortador Oficial</title>
        
        <style type="text/css">
        body {
            font: .8em "Trebuchet MS", Verdana, Arial, Sans-Serif;
            text-align: center;
            color: #333;
            background-color: #fff;
            margin-top: 5em;
        }
        
        h1 {
            font-size: 2em;
            padding: 0;
            margin: 0;
        }

        h4 {
            font-size: 1em;
            font-weight: bold;
        }
        
        form {
            width: 28em;
            background-color: #eee;
            border: 1px solid #ccc;
            margin-left: auto;
            margin-right: auto;
            padding: 1em;
        }

        fieldset {
            border: 0;
            margin: 0;
            padding: 0;
        }
        
        a {
            color: #09c;
            text-decoration: none;
            font-weight: bold;
        }

        a:visited {
            color: #07a;
        }

        a:hover {
            color: #c30;
        }

        .error, .success {
            font-size: 1.2em;
            font-weight: bold;
        }
        
        .error {
            color: #ff0000;
        }
        
        .success {
            color: #000;
        }
        
        </style>

    </head>
    
    <body onload="document.getElementById('longurl').focus()">
        
        <h1>RealGamez | Acortador Oficial</h1>
        
        <?php echo $msg?>
        
        <form action="<?php echo $_SERVER['PHP_SELF']?>" method="post">
        
            <fieldset>
                <label for="longurl">Introdusca link:</label>
                <input type="text" name="longurl" id="longurl" />
                <input type="submit" name="submit" id="submit" value="Crear Link!" />
            </fieldset>
        
        </form>

        <h4>Created by <a href="#">Daeck!</a></h4>
    
    </body>

</html>

AYUDA...°°°!!!!!1