Visualizzazione dei risultati da 1 a 2 su 2
  1. #1

    Problema percorso php/htdocs

    Salve, ho un file esempio.php in htdocs, che contiene un link
    Codice PHP:
    [url="download.php?get=foto.jpg"][img]foto.jpg[/img][/url
    Ho sempre in htdocs il seguente sorgente contatore.php che mi traccia le statistiche di chi scarica l'immagine:
    Codice PHP:
    <?

      $extension 
    "";         
      
    $counterdir "";     

      
    $textfont "Verdana,Arial"


        if (
    file_exists("$get$extension"))
        {
            
    $count 0;

            
    //header("Location: $get$extension"); // download the file [download.php?get=name_of_file]
            
    header("Content-Disposition: attachment; filename=$get$extension");
            
    readfile("$get$extension"); 

            
    $file fopen("$counterdir/$get.txt","r");  // download counter
            
    $count fread($file100);
            
    $countplus = ($count 1);
            
    fclose($file);

            
    //echo "<font face=$textfont size=2>";
            //echo "<center>

    $counterdir/$get.txt
    ";
            //echo "
    <center>

    $countplus
    ";
            
            
    $fileb = fopen("$counterdir/$get.txt","w");
            fwrite(
    $fileb$countplus, 100);
            fclose(
    $fileb);
            
            //echo "
    <center>

    $counterdir/$get.txtb
    ";
            //echo "
    <center>

    $countplus
    ";

            
    $logstr = $get;
                        
            
    $logstr = $logstr . "\t" . date("d/m/Y");
            
    $logstr = $logstr . "\t" . date("H:i:s");
            //
    $today = getdate();
            //
    $logstr = $logstr . "\t" . $today['mday'] ."/". $today['mon'] ."/". $today['year'];
            //
    $logstr = $logstr . "\t" . $today['hours'] .":". $today['minutes'] .":". $today['seconds'];

            
    $logstr = $logstr . "\t" . $REMOTE_ADDR;
            
    $logstr = $logstr . "\t" . gethostbyaddr($REMOTE_ADDR) . "\n";
            
            
    $fileb = fopen("$counterdir/log.txt","a");
            
            //echo "
    <center>

    $fileb
    ";
            //echo "
    <center>

    $logstr
    ";

            fwrite(
    $fileb$logstr, 100);
            fclose(
    $fileb);
        }
        else
        {
            echo "
    <font face=$textfont size=2>";
            echo "
    <center>

    That file [[b]$get$extension[/b]] is not available for download.
    ";
            echo "
    Please contact the server administrator [email='webmaster@$SERVER_NAME']webmaster[/email].";
        }
    ?>
    Successivamente ho uploadato questi due file e la foto sul server. Ora mi chiedo, perché in locale non mi appare la foto e in rete sì? E perché non funziona lo script per le statistiche?
    Sbaglio qualcosa con i percorsi? Cosa devo fare esattamente con Apache? Sarà sicuramente una stupidata...
    Grazie.

  2. #2
    Utente di HTML.it
    Registrato dal
    Jul 2002
    Messaggi
    443
    Dai un occhiata al error_log di apache....

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.