Need help

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Need help

    Hi again . I have anoher problem : I want to make a page to display the download categories and last time those categories were updated. I coded this
    PHP Code:
            $cat intval($_GET['cat']);
            
    $zap mysql_query("SELECT * FROM `download` WHERE `refid` = '$cat' ORDER BY `type` ASC, `time` Desc, `name` ASC LIMIT " $start "," $kmess);
            while (
    $zap2 mysql_fetch_array($zap)) {
            echo 
    '<a href="index.php?cat=' $zap2['id'] . '">' $zap2['text'] . '</a>';
     
    $file mysql_query("SELECT COUNT(*) FROM `download` WHERE `type` = 'file' AND `adres` LIKE '" . ($zap2['adres'] . '/' $zap2['name']) . "%' AND `time` > '" $old "'");
    $file1 mysql_query("select * from `download` where type = 'file' and id = '" $file "';");
    $file2 mysql_num_rows($file1);
    $adrfile mysql_fetch_array($file1);
    $filtime filemtime("$adrfile[name]");
    $filtime date("d.m.Y"$filtime);

    echo 
    'last update :</b> ' $filtime '<br/>'
    but i get a strange date .Here is the printscreen.

    in atachament must display updated, but i forgot to change:P
    Attached Files
    Last edited by alin90; 24.02.11, 21:51.

    #2
    You are not supplying a valid timestring to the date function.
    Most likely, your filemtime() cannot locate the file. Make sure you are pointing to the file by including the rule path
    Perfection comes at a cost



    I accept liberty!

    Comment


      #3
      Originally posted by frostymarvelous View Post
      You are not supplying a valid timestring to the date function.
      Most likely, your filemtime() cannot locate the file. Make sure you are pointing to the file by including the rule path
      Can you give me an example based on my script? I searched on php.net for documentation, i found something about filetime()
      PHP Code:
      <?php
      // outputs e.g.  somefile.txt was last modified: December 29 2002 22:16:23.

      $filename 'somefile.txt';
      if (
      file_exists($filename)) {
          echo 
      "$filename was last modified: " date ("F d Y H:i:s."filemtime($filename));
      }
      ?>
      I cannot figure how to point to my file. I tried :
      PHP Code:
      $filtime filemtime("$adrfile[adres]/$adrfile[name]"); 
      but i'm getting this error Warning: filemtime() [function.filemtime]: open_basedir restriction in effect. File(/) is not within the allowed path(s): (****:/usr/local/lib/php/) in *****/mobylex.info/download/noutati.php on line 26

      Comment


        #4
        Are you on a free host?

        Well, try './somefile.ext'
        Perfection comes at a cost



        I accept liberty!

        Comment


          #5
          Originally posted by frostymarvelous View Post
          Are you on a free host?

          Well, try './somefile.ext'
          Like this is ok. Is working. do you know what is the problem?

          Comment


            #6
            As I said, add the path to the file.

            './' means the same directory as the script
            ./dir/ means a directory called dir in the Sam directory
            ../ means the directory before the script

            And so forth. Just learn about file paths. This might help PHP - File And Directory Manipulation In PHP (part 2) - The Right Path - PHP - Dev Shed not too good, but okay.

            I'm sure you are on a free host and thus base dir is blocked so you need to specify the exact path. Or maybe the include path is wrong. I neve had this problem since I always specify full paths.
            Last edited by frostymarvelous; 25.02.11, 15:18.
            Perfection comes at a cost



            I accept liberty!

            Comment


              #7
              Ok. Thanks for your help.

              Comment

              Working...
              X