Jump to content

JohnDeer

New Members
  • Posts

    6
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

JohnDeer's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. How could I set so that the script would only log one record per users ip address a day so as to stop this double logging
  2. When I run this code every time it is run in a firefox browser it seems to run twice and it records 2 entires, I have tried different machines and also different versions of FF but each time I run this. in my log file I see the following In Chrome and IE I just get a single entry in my log.html file <?php // Create a new image instance $im = imagecreatetruecolor(70, 20); // Make the background white imagefilledrectangle($im, 0, 0, 70, 20, 0xFFFFFF); $font = imageloadfont('arial.gdf'); // Draw a text string on the image imagestring($im, $font, 0, 0, 'Hello World', 0x000000); // Output the image to browser header('Content-Type: image/gif'); imagegif($im); imagedestroy($im); // Get server variables $address = $_SERVER['REMOTE_ADDR']; $referer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : ''; $browser = $_SERVER['HTTP_USER_AGENT']; // Do not log the full IP address replace the last 2 octets $address = preg_replace('/\.\d+\.\d+$/', '.xxx.xxx', $address); //Set time zone and date format date_default_timezone_set('Australia/Sydney'); $accessTime = date("jS F Y g:i:s a"); //Open log file $file = fopen("log.html",'a'); //write collected data to file fwrite($file, "<b>Time:</b> $accessTime<br />"); if( $address != null) fwrite($file,"<b>IP Address:</b> $address<br />"); if($referer != null) fwrite($file,"<b>Referer:<b> $referer<br />"); fwrite($file,"<b>Browser:</b> $browser<hr>"); // save file and close fclose($file); ?>
  3. Thank you effigy :-) I was going to use a regular expression to clean it up in PHP as the SQL guys said it would be easy to do some thing like this in php but it looks like you proved them wrong and its just as easy to do it in SQL thak you for your time and help :-)
  4. MYSQL 4.1 A friend said I should be able to do this direct in SQL select SUBSTRING(oldCATEGORY,PATINDEX('%gory/%',oldCATEGORY)+5,(PATINDEX('%/">%',oldCATEGORY)) - (PATINDEX('%gory/%',oldCATEGORY)+5)) ,oldCATEGORY from database where oldCategory <> '' But looking at this it looks like it is for MSSQL
  5. Hi effigy thank you fro the reply you are correct about the "home-diy" as the first category there are about 10 categories in total and they layout is the same here are a few more examples category "shopping" <A href="http://www.mysite.com/blog/category/shopping/"><IMG class="" height=149 src="http://www.mysite.com/blog/images/shop.png" width=225></A> category "pets" <A href="http://www.mysite.com/blog/category/pets/"><IMG class="" height=149 src="http://www.mysite.com/blog/images/cat.png" width=225></A> category "money" <A href="http://www.mysite.com/blog/category/money/"><IMG class="" height=149 src="http://www.mysite.com/blog/images/coins.png" width=225></A>
  6. I have a column in a MYSQL database that I need to try and clean up and I was told that maybe to use PHP would be the best bet. Here is a copy of the field there are about 900 records like this in the database and I want to try and remove all of the HTML apart from the category name <A href="http://www.mysite.com/blog/category/home-diy/"><IMG class="" height=149 src="http://www.mysite.com/blog/images/home.png" width=225></A> In this case the category name is home-diy every thing else can go :-) any help on this would be handy as I have never used php before.
×
×
  • 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.