Jump to content

Caesar

Members
  • Posts

    1,025
  • Joined

  • Last visited

    Never

Posts posted by Caesar

  1.  

    If you use a sessions table, you update the session time in the database everytime a user loads a page. You then log them out if a session update time is a certain amount of time greater than the session start time. Everytime it updates it checks...etc. So it will be as accurate as you can get within a few minutes time.

  2. If you are on a *nix based server that supports POSIX 1003.2 regular-expressions...

     

    # Rewrite <subdomain>.example.com/<path> to example.com/<subdomain>/<path>
    #
    # Skip rewrite if no hostname or if subdomain is www
    RewriteCond %{HTTP_HOST} .
    RewriteCond %{HTTP_HOST} !^www\. [NC]
    # Extract (required) subdomain (%1), and first path element (%3), discard port number if present (%2)
    RewriteCond %{HTTP_HOST}<>%{REQUEST_URI} ^([^.]+)\.example\.com(:80)?<>/([^/]*) [NC]
    # Rewrite only when subdomain not equal to first path element (prevents mod_rewrite recursion)
    RewriteCond %1<>%3 !^(.*)<>\1$ [NC]
    # Rewrite to /subdomain/path
    RewriteRule ^(.*) /%1/$1 [L] 

  3. Neither....

     

    <?php
    
      echo'
      <form method="post action="'.$_SERVER['PHP_SELF'].'">
        <table>
           <tr><td><input type="text name="nombre" value="'.$_POST['nombre'].'"></td></tr>
           <tr><td><input type="submit name="submit value="doit!"></td></tr>
        </table>
      </form>';
    
    ?>

       

  4. If you want the html code to display as HTML....and not have it parse as HTML...

     

    <?php
    
    $string = '<a href="mypage.htm">My Page</a>";
    $newstr = htmlentities($string);
    
    echo $newstr;
    
    ?>

     

     

  5. Before trying to display your image, you need to debug your code/php to make sure you're pulling the value correctly from the database. You also need to make sure you're specifying the correct image path.

     

    <?php
    
      $query = $db->query("SELECT * FROM usrinfo WHERE id = '$id'");
      $usrinfo = $db->fetch_array($query);
    
      echo'<img src="images/'.$usrinfo[uid].'jpg" alt="image info" />';
    
    ?>

     

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.