Page 1 of 2
Linky Spy
Posted: Wed Nov 30, 2005 8:34 pm
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!
Posted: Wed Nov 30, 2005 9:08 pm
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.
Posted: Wed Nov 30, 2005 9:13 pm
by nickman013
k, i dont know how to but i will try ...
Posted: Wed Nov 30, 2005 9:23 pm
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)) {
Posted: Wed Nov 30, 2005 9:38 pm
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?
Posted: Wed Nov 30, 2005 9:47 pm
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?
Posted: Thu Dec 01, 2005 12:30 am
by John Cartwright
Set up your own local development server, and guess what.. its FREE!
http://hotscripts.com/PHP/Software_and_ ... index.html
Posted: Thu Dec 01, 2005 1:21 pm
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?
Posted: Thu Dec 01, 2005 2:08 pm
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.
A good place to start is
http://www.apachefriends.org
Posted: Thu Dec 01, 2005 2:58 pm
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..
Posted: Thu Dec 01, 2005 3:25 pm
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"?
Posted: Thu Dec 01, 2005 3:58 pm
by nickman013
i got the break working... i meant like a php version of html <br>
Posted: Thu Dec 01, 2005 4:16 pm
by josh
Posted: Thu Dec 01, 2005 4:39 pm
by foobar
nickman013 wrote:i got the break working... i meant like a php version of html <br>
You mean like \n ?
Posted: Thu Dec 01, 2005 5:40 pm
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.
