Help - Search - Members - Calendar
Full Version: Where to put my files ?
Hostony Board > General Support > PHP/MySQL
Pcolart
OK, I want to install a counter and find a script 100% in PHP

they explain this :

"Create a file in this example it is called counter.txt and enter a starting number.
Upload this to your server and on UNIX servers chmod to 755."

Where to upload the counter.txt file ? And how to enable it to chmo = 755

"Copy the following code into a new file called grcounter.php"

Where to upload grcounter.php ?

Thx for help
Alec
Try to install all in your public_html folder
Pcolart
don't work

Where other people put the php script files ????
Stanly
It is your scripts problem I think.
Because everyone at our server have PHP scritpts and they're working.
Niakie
Put both the grcounter.php and the counter.txt under the public_html folder. To change the permissions on the counter.txt file depends on your FTP program. with WS FTP right click on the file and select properties. then make sure that all the Read, Write, and Execute boxes are checked.

Once thats done then you should be able to call the grcounter.php file with everything working.
bgp1
I have an old CGI counter that has always worked for me. I will post the code.

Place both files in your /cgi-bin/ directory.

counter.cgi (CHMOD 755)
CODE
#!/usr/bin/perl

#change first line to proper perl location.

###########################################
#Very simple PERL text based counter.
#upload this script to your cgi-bin directory and chmod to 755.
#to use it simple add this code to your html.
#<script language="javascript" src="http://yourdomain.com/cgi-bin/counter.cgi"></script>
#If you have problems you can contact webmaster@dony.com.kg
#This script is free of charge. Do not hesitate to suggest this script to your friends.
#Thanks for using this script.
#www.dony.com.kg
###########################################

$log="counter.txt";    #counter file.

#nothing else to change leave it as is.

open (FILE,$log);
$counter=<FILE>;
close(FILE);
$counter++;
open (WRITE,">$log");
print WRITE "$counter";
close(WRITE);
print "Content-type: text/html\n\n";
print "document.write($counter)";

Please make sure to update $log=""; with whatever the name of your counter file is. If you have just the one, might as well just keep it as counter.txt as I have it.

counter.txt (CHMOD 755)
CODE
1

Since counter.txt will contain the current count, make this number whatever you wish. Just remember that you must have plain numbers (e.g. 12365478 --not-- 123,456,789).

Code to increment the counter and display the result
CODE
<script language="javascript" src="http://www.yourdomain.com/cgi-bin/counter.cgi"></script>

Change the src to your sites source. This will print out a simple text hit counter.

Hope this helps! I know that its not php, but it works great!
Stanly
Guys, he/she want to use PHP, not Perl wink.gif
PHP scripts work at any directoru under public_html folder.
Niakie
I think the main problem isn't the script unto itself but the permissions on the counter.txt...
Barrin!
If you're using FTP to change the file permissions the command should look something like this, depending on FTP program:

SITE CHMOD 755 /counter.txt

You can also do it through the file manager thing in cPanel.


You'll also want to check the PHP file to make sure it's actually pointing to counter.txt.

How is it shown on your page? Is a function defined in the .php file, and then recalled via an include statement on the page you wish to display it on?
i.e.
<?php
include("counter.php");
show_counter();
?>

Is an iFrame used?
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2024 Invision Power Services, Inc.
IPS Driver Error

IPS Driver Error

There appears to be an error with the database.
You can try to refresh the page by clicking here