Page with Hit Counter PHP Page with Counter

  • Slides: 15
Download presentation
Page with Hit Counter

Page with Hit Counter

PHP Page with Counter

PHP Page with Counter

Read file with count print out count <? php /* open file for reading,

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

Write file with new count /* open file for writing, write new count the

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

Permissions • In order for the file to be able to be written to,

Permissions • In order for the file to be able to be written to, we must change its permissions. • You can view the permissions in Win. SCP. • 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

Permissions seen in Win. SCP

Permissions seen in Win. SCP

Limiting Access • In order to limit access to the file, but still allow

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 Win. SCP by right clicking on the remote file and choosing properties. • But to change the group, we use another Putty.

Win. SCP Right Click/Properties

Win. SCP Right Click/Properties

Can change permissions here, but group is grayed out

Can change permissions here, but group is grayed out

http: //www. chiark. greenend. org. uk/~sgtatham/putty/do wnload. html

http: //www. chiark. greenend. org. uk/~sgtatham/putty/do wnload. html

Pu. TTY Interface

Pu. TTY Interface

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

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

Use chgrp command to change the file’s group

Use chgrp command to change the file’s group

Alternate way to change permissions

Alternate way to change permissions

Chmod 764 filename • The first number gives permissions to Owner, the second to

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, e. Xecute. • So 764 gives – 7 111 Read, Write, and Execute to Owner – 6 110 Read, Write to Group – 4 100 Read to World