Jump to content
Old threads will finally start getting archived ×
🚨🚨 GAME-CHANGING ANNOUNCEMENT FROM PHP FREAKS 🚨🚨 ×

Gemini 🤖

Members
  • Posts

    13
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Gemini 🤖's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Ok - problem solved - I downloaded another counter script that had the code (that writes the number of visitors) in a separate file and I then just wrote an include line in my main index page. All working perfect now. Thank you so much for your patience and assistance. This PHP stuff is bloody hard for a newbie to get to terms with :-)
  2. Could you email the file that I can upload (I already have the counter.txt file 777). I can then upload the file you give me and see if it works.
  3. I cant see the script you gave me - when i open the file i just get the html code without the php part. MY HEAD HURTS :-(
  4. I give up - Im still getting the same error message about line 21. Now im pissed ! Thanks for trying to help me - I really appreciate it.
  5. Currently the chmod is set to 755 - would that be the cause of the problem - displaying error messages on my index page ?? I will now try changing the permissions - THANK YOU
  6. <html> <head> <title>my site</title> <meta http-equiv="imagetoolbar" content="no" /><meta name="author" content="Richard Summers" /> <meta name="copyright" content="Richard Summers" /> <meta name="date" content="01-01-2008" /> <meta name="content-language" content="en-us" /> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> <link rel="icon" href="favicon.ico" type="image/x-icon" /> <link rel="shortcut icon" href="favicon.ico" type="image/x-icon" /> <link rel="stylesheet" type="text/css" href="style.css" /> </head> <body> <?php ###################################################### // This script will add a counter on your website // First thing is first, we need to define where the // data is $file = fopen("counter.txt","r+"); // Open the file R+ (read and write) $get_data = fread($file,512); // Read the counter.txt $new_data = $get_data + 1; // Adds 1 to the counter echo $new_data; // Echo the Counter fseek($file, 0) ; //Go back to line 1 in our counter file fwrite($file, $new_data) ; // Save the new data fclose($file) ; //closes the file ?> <center> <img src="title.jpg" alt="Title" border="0" /> <br> <img src="videobox.jpg" /img> <br> <img src="techniques.jpg" /img> <br> <img src="benefits.jpg" /img> <br> <img src="store.jpg" /img> <br> <img src="contact.jpg" border="0" usemap="#Map" /img> <map name="Map" id="Map"> <area shape="rect" coords="28,52,568,138" href="mailto:[email protected]" alt="E-mail Richard" /> </map> </center> </body> </html>
  7. My post has left out the last 3 lines which are </center> </body> </html>
  8. Line 21 was where the <?php code started.
  9. Here is the complete page source code of my index.php page - just in case that helps. <html> <head> <title>my site</title> <meta http-equiv="imagetoolbar" content="no" /><meta name="author" content="Richard Summers" /> <meta name="copyright" content="Richard Summers" /> <meta name="date" content="01-01-2008" /> <meta name="content-language" content="en-us" /> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> <link rel="icon" href="favicon.ico" type="image/x-icon" /> <link rel="shortcut icon" href="favicon.ico" type="image/x-icon" /> <link rel="stylesheet" type="text/css" href="style.css" /> </head> <body> <center> <img src="title.jpg" alt="Title" border="0" /> <br> <img src="videobox.jpg" /img> <br> <img src="techniques.jpg" /img>
  10. Unfortunately that didnt work either - now I get the following error message displayed on my indey page : Parse error: syntax error, unexpected T_VARIABLE in /home/fhlinux176/p/mywebsite.co.uk/user/htdocs/index.php on line 21
  11. I will try what you just typed a bit later - thank you very much. CVould you please tell me how is that different from what I had - it seems to be doing the same thing ???
  12. fcommand.fopen appears on my index page and the .txt file is set to 755 permissions.
  13. Hi all, Could someone please tell me why this script refuses to work - I have been looking at it for hours and have no idea what is wrong. I have PHP4 installed on my hosts server and my index page is correctly called index.php All I want the script to do is act as a basic visitor counter - writing the number of visitors to a txt file and then emailing me with the result. Every time I insert this script into my index.php page I get an error saying "fcommand.fopen" or somethig similiar to those words. Please help - thanks in advance. <?php //open the file handler $fp=fopen("counterdata.txt","r"); //Read the previous count $count=fgets($fp,1024); //close the file. fclose($fp); $fw=fopen("counterdata.txt","w"); //Increment the counter $cnew=$count+1; //write the counter back to the log file - counterdata.txt $countnew=fputs($fw,$count+1); fclose($fw) $address = "[email protected]"; mail($address, "Visitor at www.mywebsite.co.uk", "Total number of visits is now : $cnew"); ?>
×
×
  • 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.