1 / 15

Page with Hit Counter

Page with Hit Counter. PHP Page with Counter. Read file with count print out count. <? php /* open file for reading, read and print count */ $filename= "HitCounter.txt"; $ filePointer = fopen ($filename, "r") or die("Problem opening $filename");

sofia
Télécharger la présentation

Page with Hit Counter

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Page with Hit Counter

  2. PHP Page with Counter

  3. Read file with count print out count <?php /* open file for reading, read and print count */ $filename= "HitCounter.txt"; $filePointer = fopen($filename, "r") or die("Problem opening $filename"); $theCount = fread($filePointer, filesize($filename)); print ($theCount+1); fclose($filePointer);

  4. Write file with new count /* open file for writing, write new count the file must have the appropriate permissions especially to be written to */ $filePointer = fopen($filename , "w") or die("Problem opening $filename"); $theCount = $theCount + 1; $fout= fwrite($filePointer, $theCount); fclose($filePointer); ?>

  5. Permissions • In order for the file to be able to be written to, we must change its permissions. • You can view the permissions in WinSCP. • In Linux there are three basic kinds of permission and three basic actors to whom permission may be given. • The permissions are Read, Write and Execute • The actors are: You (the Owner), Group, World

  6. Permissions seen in WinSCP

  7. Limiting Access • In order to limit access to the file, but still allow its effect, we are going to place the file into the group for web things, and then give that group write permissions. • The permissions can be changed using WinSCP by right clicking on the remote file and choosing properties. • But to change the group, we use another Putty.

  8. WinSCP Right Click/Properties

  9. Can change permissions here, but group is grayed out

  10. http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html

  11. PuTTY Interface

  12. Enter username and password (not echoed). Then use cd (change directory command to get to folder

  13. Use chgrp command to change the file’s group

  14. Alternate way to change permissions

  15. Chmod 764 filename • The first number gives permissions to Owner, the second to Group and the third to World. • The permission come in the order Read, Write, eXecute. • So 764 gives • 7  111  Read, Write, and Execute to Owner • 6  110  Read, Write to Group • 4  100  Read to World

More Related