Jump to content

mbtaylor

Members
  • Posts

    96
  • Joined

  • Last visited

    Never

Everything posted by mbtaylor

  1. Read up on Object Orientated Programming!
  2. 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.
  3. 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.
  4. 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.
  5. Interesting, how would you use cron via wget? I have only used wget to download files.
  6. Try phoning their tech support and asking if they can do it I have a dedicated linux server with 1&1 which lets me do anything I want - not bad price too. I recommend that for any serious development.
  7. You might want to read up on the mysql min function too. You can select min or max value from a db using something like: SELECT min(userID) from site_users;
  8. $sql1 =mysql_query("SELECT name FROM `teams` ORDER BY activate DESC, teamid DESC LIMIT 1"); ASC is ascending, DESC descdending. So if you sort by DESC then the lowest one should be first.
  9. I have looked into this myself recent. There are free classes out there to write out RTF but not Word Doc. You could write out an RTF file and give it a .doc extension Try the PHPClasses website.
  10. If you can get the host to install a cron job for you, then you can set a cron task to call your php script every X minutes.
  11. 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.
  12. I recommend PHPMailer - http://phpmailer.sourceforge.net/ Its easy to use and powerful in features
  13. 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 <? $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 />" ); } ?>
  14. Ha yes: $regex = "/(#)([A-Za-z ]*)([#])?/"; I was figuring it out myself I am not quite a regex master...yet I believe you can use \s instead of a space too, or is it :space: !
  15. $string = "it was a #great# day and tomorrow #will# be even better!"; $regex = "/(#)([A-Za-z]*)(#)/"; print (preg_replace ($regex, "<b>$2</b>", $string)); That works for me Regular expressions rock !
  16. 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 />"); }
  17. 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
  18. Seems to be a problem with FCKEditor parsing the page as I agree your regex does work otherwise, as do others I have used! Does the same with TinyMCE too... its a strange one.
  19. For example http://www.mysite.com/home.htm http://www.mysite.com/somedir/blah.htm http://www.mysite.com/somedir/anotherdir/blah.htm The url can be anything, any depth etc. It all gets sent to index.php. None of the urls are 'real' all content is dynamic and stored in the database. So I guess the real url would be something like http://www.mysite.com/1/2/3
  20. 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.
  21. Then you need to use a regular expression using preg_replace. Look up url matching regular expressions. There might be more answers in the regular expressions forum.
  22. 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
  23. 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; }
  24. 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.