Linky Spy

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

User avatar
nickman013
Forum Regular
Posts: 764
Joined: Sun Aug 14, 2005 12:02 am
Location: Long Island, New York

Linky Spy

Post by nickman013 »

HI,

I need help making a script to store 3 thing's.

I need to store $sn $page $date.

The problem is, I dont have a mySQL, nor do I want to use it, and I am using PHP3.
I have to use fopen() and stuff, However I do not know how to do that very well, So I was wondering if anybody can mybee help me with it.

The way I want them to be stored is in any file and I want the format to be

$sn $page $date <br>
$sn $page $date <br>
$sn $page $date <br>
...

Thank You!
Roja
Tutorials Group
Posts: 2692
Joined: Sun Jan 04, 2004 10:30 pm

Post by Roja »

Try doing it first, and ask for help with the problems you have.

We're here to help troubleshoot problems, not code for you.
User avatar
nickman013
Forum Regular
Posts: 764
Joined: Sun Aug 14, 2005 12:02 am
Location: Long Island, New York

Post by nickman013 »

k, i dont know how to but i will try ...
User avatar
nickman013
Forum Regular
Posts: 764
Joined: Sun Aug 14, 2005 12:02 am
Location: Long Island, New York

Post by nickman013 »

ok i tried this but i got a error

Code: Select all

<?php
$date = date("F j, Y, g:i a");
$ip = @$REMOTE_ADDR;
$filename = 'visit_log.txt';
$somecontent = "echo $sn; echo $page; echo $from; echo $date; echo $ip; ";
if (is_writable($filename)) {
   if (!$handle = fopen($filename, 'a')) {
         echo "Cannot open file ($filename)";
         exit;
   }
   if (fwrite($handle, $somecontent) === FALSE) {
       echo "Cannot write to file ($filename)";
       exit;
   }
      echo "Success, wrote ($somecontent) to file ($filename)";
   fclose($handle);

} else {
   echo "The file $filename is not writable";
}
?>
error:
Fatal error: Call to unsupported or undefined function is_writable() in /web/u54/www22882/www/visit.php3 on line 6
Line 6:
if (is_writable($filename)) {
Roja
Tutorials Group
Posts: 2692
Joined: Sun Jan 04, 2004 10:30 pm

Post by Roja »

nickman013 wrote:ok i tried this but i got a error
Fatal error: Call to unsupported or undefined function is_writable() in /web/u54/www22882/www/visit.php3 on line 6
Allright!

When you get an error while developing, first, check the function in the manual: http://us2.php.net/manual/en/function.is-writable.php
is_writable

(PHP 4, PHP 5)
Since it was added in PHP4, that function is not available.

Using PHP3 is insecure, poorly documented, and virtually *no one* has experience with it anymore. Its not available for download on the main site, or maintained.

Why do you continue using it?
User avatar
nickman013
Forum Regular
Posts: 764
Joined: Sun Aug 14, 2005 12:02 am
Location: Long Island, New York

Post by nickman013 »

i cant stand this, i am going to get my own host, the reason i cant move to a new host is becasue it takes 2 weeks. also it isnt my host lol. its my friends but im in charge of the site. whats a good, cheap host?
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

Set up your own local development server, and guess what.. its FREE!

http://hotscripts.com/PHP/Software_and_ ... index.html
User avatar
nickman013
Forum Regular
Posts: 764
Joined: Sun Aug 14, 2005 12:02 am
Location: Long Island, New York

Post by nickman013 »

I forwared my router to this computer, however is it unsafe to host sites on your computer? Its not a big site its only a couple of pages, safe or not im still doing it, but how wold i make my own domain?
foobar
Forum Regular
Posts: 613
Joined: Wed Sep 28, 2005 10:08 am

Post by foobar »

nickman013 wrote:i cant stand this, i am going to get my own host, the reason i cant move to a new host is becasue it takes 2 weeks. also it isnt my host lol. its my friends but im in charge of the site. whats a good, cheap host?
Try stuff out on your own computer first. That way, you can get whatever you want, and then look for a host that supports exactly that. Will save you the headache of making your vision fit with your webhost. :wink:

A good place to start is http://www.apachefriends.org
User avatar
nickman013
Forum Regular
Posts: 764
Joined: Sun Aug 14, 2005 12:02 am
Location: Long Island, New York

Post by nickman013 »

yup i went to the hot scripts site and did xampp ... i love it

now i can finally do stuff

btw, the code works now..

i just need to find a email server.
and i need to know how to make a break in a php file..
foobar
Forum Regular
Posts: 613
Joined: Wed Sep 28, 2005 10:08 am

Post by foobar »

nickman013 wrote:yup i went to the hot scripts site and did xampp ... i love it

now i can finally do stuff

btw, the code works now..
Good to hear! Hope it saves you pulling your hair out while working on a remote server. It's really handy to have stuff work on your own machine. Instant previews!
nickman013 wrote:i just need to find a email server.
You can send emails straight from php using the mail() function.
nickman013 wrote:and i need to know how to make a break in a php file..
Can you rephrase that? I don't understand what you mean by "break"?
User avatar
nickman013
Forum Regular
Posts: 764
Joined: Sun Aug 14, 2005 12:02 am
Location: Long Island, New York

Post by nickman013 »

i got the break working... i meant like a php version of html <br>
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Post by josh »

Code: Select all

echo '<br />';
??
foobar
Forum Regular
Posts: 613
Joined: Wed Sep 28, 2005 10:08 am

Post by foobar »

nickman013 wrote:i got the break working... i meant like a php version of html <br>
You mean like \n ?
User avatar
nickman013
Forum Regular
Posts: 764
Joined: Sun Aug 14, 2005 12:02 am
Location: Long Island, New York

Post by nickman013 »

yup they both work, now my problem is now that outside people cannot access the site and i forwared my external ip to my internal. :(
Post Reply