Jump to content

mbtaylor

Members
  • Posts

    96
  • Joined

  • Last visited

    Never

Posts posted by mbtaylor

  1. Hmm I dont so either. You might want to check specific scanning tools like Nmap though.

     

    Surely that would mean you were querying the proxy for the ipaddress, which would be prevented as a security measure anyway.

  2. It has to be called on every page access. This would usually be from a linked script via include. I personally write a class to contain my statistics code and call something like $statistics -> record_access() via a page that is always linked. This could be a header or footer for example.

  3. Theres a few things you need mate:

     

    1. max post setting

    2. max file upload setting

    3. max script execution time

    4. Apache Limitrequestbody is not too low

     

    I have also personally experienced an issue with my IPTABLES script which was preventing large uploads... I had to add:

     

    # allow all fragments
    -A INPUT -f -j ACCEPT
    # allow icmp traffic
    -A INPUT -p icmp -j ACCEPT
    

     

    This is explained in the php manual file uploads page.

     

  4. I feel that Simple Machines Forum should be mentioned (what this forum is running). I have no idea about its memory usage, but its a most excellent forum (for a developers and users point of view). I use it on a few of my sites and theres a nice API to allow you to plug into your frameworks auth functionality.

     

    There is another forum called Phorum, that is quite light weight and has a good level of functionality.

  5. I would use the SimpleXML object. Its dead simple to use like this:

    Check out the php manual for detailed info.

     

    DomXML is soooooooooo php4 :P

     

    <?
    $xml = <<<XML
    <?xml version="1.0" ?> 
    <products>
      <product>
        <result>OK</result> 
        <description>Product 1</description> 
        <extendeddescription>TECHNICAL SPEC</extendeddescription> 
        <weight>9.35</weight> 
        <stock>434</stock> 
      </product>
      
      <product>
        <result>OK</result> 
        <description>Product 2</description> 
        <extendeddescription>TECHNICAL SPEC</extendeddescription> 
        <weight>5.35</weight> 
        <stock>132</stock> 
      </product>
    </products>
    XML;
    
    $xmlobj = simplexml_load_string($xml);
    
    foreach ($xmlobj as $product) {   
      print (
        $product -> result."<br />".
        $product -> description."<br />".
        $product -> extendeddescription."<br />".
        $product -> weight."<br />".
        $product -> stock."<br /><br />"
      );
    }
    ?>
    

  6. foreach ($array as $var => $value) {
    print ("$var = $value");
    }
    
    // or
    
    print_r ($array);
    
    //or 
    
    print ($array[0]);
    
    //or
    $max = count ($array);
    for ($i=0;$i<$max;$i++) {
      print ($array[$i]."<br />");
    }
    

  7. The regular expression just sends ALL urls that come to the domain to index.php for processing. Its part of a CMS framework I wrote...

     

    The inline editors seem to load the whole page html into their modified textarea, I am guessing being more specific with the regular expression is what is preventing the editor loading the page html. I guess they might be replacing the textarea with inline iframe dynamically with javascript. Then maybe the iframe is loading the page content when it shouldnt be.

     

    That doesnt happen with my current regex, but it does if I use varients - its something that has bothered me for quite a while!

     

    An easy solution would be to make the admin sections not use mod_rewrite :)  For example, currently the admin page would be say: http://www.someclientsite.co.uk/admin.htm

     

    That admin.htm doesnt exist, and is really database content being pulled from a) the menu table and b) the content table. The admin.htm is matched to a pageID and the appropriate xhtml content displayed along with whatever code modules etc that relate (admin ones in this case).  All page urls are really just virtual urls and are instead of doing something like:

    http://www.clientsite.co.uk/index.php?pageID=123 etc.

     

    If I was to use another specific php page like admin.php (only .htm pages use mod_rewrite in the condition) then I would be fine, but then, that would mean changing system programming :P

     

  8. Hmmm no that didnt work but cheers. The reason why it didnt work was because FCKEditor (inline html editor) loads the page content into itself when using your modified regex, whereas it doesnt with mine.

     

    Otherwise it would have worked... I dont know whats going on there.

  9. Hi everyone

     

    I use a regex that I KNOW should be better but I cant seem to get the right syntax.

    Here is what I use:

     

    RewriteBase /
    RewriteCond %{REQUEST_URI} (\.htm)
    RewriteRule    ^([^/]+)?/?([^/]+)?/?([^/]+)?/?([^/]*)$     index.php
    

     

    What it does is basically send any HTML page to index.php - which then gets dealt with using the url as variables for content lookup etc. What I am wondering is how I repeat the middle section

     

    ?/?([^/]+)
    

     

    so that it will do any url lengh as currently it does 3 levels e.g:

     

    http://www.mydomain.com/dir1/dir2/dir3/somepage.htm
    

     

    Cheers!

     

    Mark

  10. Just add whatever browsers you want to look for int the $browsers array...

     

    $useragent = $_SERVER['HTTP_USER_AGENT'];
    $browser = get_browser_name($useragent);
    
    print ("Browser name: ".$browser['browser']."<br />Browser version: ".$browser['version']."<br />");
    
    function get_browser_name($useragent){
      $browser = array (
        "Opera","Msie", "Netscape", "Firefox","Safari", "Konqueror", "Mozilla"
      );
      $info["browser"] = "Other";
      foreach ($browser as $parent) {
       if ( ($s = strpos(strtolower($useragent), strtolower($parent))) !== FALSE )   {
         $f = $s + strlen($parent);
         $version = substr($useragent, $f, 5);
         $version = preg_replace('/[^0-9,.]/','',$version);
         $info["browser"] = $parent;
         $info["version"] = $version;
         break; // first match wins
       }
      }
      return $info;
    }
    
    

  11. Well, for that preg_replace is your best bet:

     

    $html = preg_replace ("/<script/?>/", "", $html);
    

     

    That basically says, strip out anything that has a '<' and 'script' and maybe a '/' followed by a '>'.

    Regular expressions rule!

     

    A function to do the strip_tags:

     

    function strip_bad_tags($html) {
      $allowed = "<h1><h2><h3><h4><div><p><b><i><u><br><img><a><table><tr><td><th><ol><li><ul><span><strong>";
      return strip_tags($html, $allowed);
    }
    

     

    Just change the allowed tags to the tags you want to allow and you should be sorted.

     

×
×
  • 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.