Ver Mensaje Individual
  #1 (permalink)  
Antiguo 19/02/2014, 22:47
efren315
 
Fecha de Ingreso: septiembre-2013
Mensajes: 32
Antigüedad: 11 años, 5 meses
Puntos: 0
mostrar imagen

saludos amigos tengo este pequeño script php que me pasaron de notas algo basico, pero nologro mostrar imagenes dentro de la ruta aqui les dejo todo el script me gusta porque tiene url amigable pero no logro hacer que muestre la imagen

index.php

Código PHP:
<?php
    error_reporting
(E_ALL E_NOTICE);
    include 
'./php/notes.class.php';
    
ob_start('relink');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>TurnkeyForms.com - Notes Script</title>
<link href="/css/main.css" media="all" rel="stylesheet" />
</head>

<body>
    <h1>TurnkeyForms - Notes Script</h1>
    <a href="/" id="welcome"></a>
    <div id="left">
        <div class="right">
            <h2>Recent Notes</h2>
            <div class="indent">
                <?php $notes->recentNotes(10); ?>
            </div>
        </div>
    </div>
    <div id="right">
        <div class="right">
            <?php
                $p 
$_GET['x'];
                
$n $_GET['n'];
                if(
$p == 'view' && is_numeric($n)) {
            
?>
                <h2><a name="notes">View Notes</a></h2>
                <div class="indent">
                    <?php $notes->viewNotes($n); ?>
                </div>
            <?php
                
} else {
            
?>
            <h2><a name="notes">Take Some Notes!</a></h2>
            <div class="indent">
                <?php $notes->takeNotes(); ?>
            </div>
            <?php
                
}
            
?>
        </div>
    </div>

</body>
</html>
<?php
    
function relink ($buffer) {
        
$root ereg_replace('/$'''dirname($_SERVER['PHP_SELF']));
        return 
preg_replace('#(href|src|action)="/([^"]*)"#i''\\1="' $root '/\\2"'$buffer);
    }
?>

note.class.php

Código PHP:
<?php
    
    
class notes {
        function 
notes () {
            if(@
mysql_connect('localhost''root''') && @mysql_select_db('clasi')) {
                return 
true;
            } else {
                return 
false;
            }
        }
        function 
unHTMLentities ($string) {
            
$trans_tbl1 get_html_translation_table(HTML_ENTITIES);
            foreach (
$trans_tbl1 as $ascii => $htmlentity) {
                
$trans_tbl2[$ascii] = '&#' ord($ascii) . ';';
            }
            
$trans_tbl1 array_flip($trans_tbl1);
            
$trans_tbl2 array_flip($trans_tbl2);
            return 
strtr(strtr($string$trans_tbl1), $trans_tbl2);
        }
        function 
takeNotes () {
            if(
$_POST['action'] == 'addNote') {
                
$data = array();
                foreach(
$_POST as $name => $value) {
                    
$data[$name] = (function_exists('mysql_real_escape_string')) ? mysql_real_escape_string($value) : addslashes($value);
                }
                
$sql "INSERT INTO `notes` (`title`, `author`, `timestamp`, `note`, `private`, `ip`) VALUES ('{$data['title']}', '{$data['author']}', '" time() . "', '{$data['notes']}', '{$data['private']}', '{$_SERVER['REMOTE_ADDR']}')";
                if(@
mysql_query($sql)) {
                    
$id mysql_insert_id();
                    
header("Location: ./view/$id/");
                } else {
                    echo 
'<span class="error">Oops! We couldn\'t post it to the site! Sorry!</span>';
                }
            } else {
                
$html '<form method="post" enctype="multipart/form-data" action="" name="post">
                    Note Name<br />
                    <input type="text" name="title" size="40" value="Untitled" /><br /><br />
                    Your Name<br />
                    <input type="text" name="author" size="40" value="Anonymous" /><br /><br />
                    Make This Note Private? Only you will be able to access it.<br />
                    <select name="private">
                        <option value="0" selected="selected">No</option>
                        <option value="1">Yes</option>
                    </select><br /><br />
                    Notes<br />
                    <textarea rows="5" cols="35" name="notes"></textarea><br /><br />
                    <input type="hidden" name="action" value="addNote" />
                    <input type="submit" name="submit" id="button" value="Submit" /> 
                    <input type="reset" name="reset" id="button" value="Reset" />
                </form>'
;
                echo 
$html;
            }
        }
        function 
recentNotes ($i 10) {
            
$sql "SELECT * FROM `notes` ORDER BY `id` DESC LIMIT $i";
            
$q mysql_query($sql);
            
$html '<ul>';
            if(
mysql_num_rows($q) == 0) {
                
$html .= "<li><h3 class=\"error\">No notes.</h3></li>";
            } else {
                while(
$r mysql_fetch_assoc($q)) {
                    
$html .= "<li><h3><a href=\"/view/{$r['id']}/\">{$r['title']}</a></h3></li>";
                }
            }
            
$html .= '</ul>';
            echo 
$html;
        }
        function 
viewNotes ($i) {
            if(
$i) {
                
$sql "SELECT * FROM `notes` WHERE `id` = '$i'";
                
$q mysql_query($sql);
                if(
mysql_num_rows($q) == 0) {
                    
$html '<span class="error">Please select a valid Note!</span>';
                } else {
                    
$r mysql_fetch_assoc($q);
                    if(
$r['private'] == && $_SERVER['REMOTE_ADDR'] !== $r['ip']) {
                        echo 
'<span class="error">Sorry, you are not allowed to view this Note.</span>';
                    } else {
                        
$notes stripslashes($r['note']);
                        
$notes split("\n"$notes);
                        for(
$i 1$i <= count($notes); $i++) {
                            
$numbers .= "$i.<br />\n";
                        }
                        
$note $this->unHTMLentities($note);
                        
$note highlight_string($r['note'], true);
                        
$date date('F jS\, Y'$r['timestamp']);
                        
$html "<strong>{$r['title']}</strong> by {$r['author']} on $date<br /><br />
                        <div class=\"notes\">
                            <div class=\"numbers\">
                                $numbers
                            </div>
                            <div class=\"note\">
                                $note 
                            </div>
                            
                            <div class=\"imagen\">
                            
                            <img  src=\"img/beb4a1059b.jpg\" />
                                 
                            </div>
                            <div class=\"clear\"></div>
                        </div>"
;
                    }
                }
                echo 
$html;
            } else {
                echo 
'<span class="error">Please select a note to view!</span>';
            }
        }
    }
    
$notes = new notes;
?>

.htaccess

Código PHP:
RewriteEngine On
RewriteRule 
^view/([0-9]+)[/]{0,1}$ index.php?x=view&n=$

Esto es lo que tengo pero no logro que me muestre cualquier imagen y quiero publicar la nota con una imagen pero no logro que me muestre la imagen si alguien sabe como podria hacer para ello

amigos de aqui descargue el script por si alguien quiere probar y ayudarme le agradesco http://www.purosoftware.com/desarrollo-web-scripts-documentos/03-note-script-php.html