FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Website visitor info. how to collect?





darence
Hi
Can I collect informations about my visitors (such as email, location...etc) in a file located on my srever ? If it is possible, tell me please how to do it.

Thanks all

darence
Manofgames
I assume that when you say 'collect info such as email' you mean that they submit a form which collects the data??

Its simpler and easier to submit it to a mysql db, and there are plenty of tutorials to learn how to do this.

The most helpful tutorial site I've found is Tizag: http://www.tizag.com/phpT/

good luck Wink
darence
Thanks, but I am beginner and I want to download and use finished script
darence
Which php function use for:
1) Display visitor's IP
2) Display visitor's operating system & browser ?
I need those functions to put them into home page, and run on page load. Is it possible, and how to do?

Thanks
Manofgames
$_SERVER['REMOTE_ADDR'] will get you the IP
$_SERVER['USER_AGENT'] will get you the browser and OS in 'techie format' (IE, all the technichal details as well (Its not a real word, I coined it;) ))

USER_AGENT will display something like this:
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7) Gecko/20040803 Firefox/0.9.3

The alternative for the OS and or browser is to use JS to get the details, then pass it to the script in the url ($_GET format)
darence
Is it possible to host php script on another server than my site is hosted?
chris20
It is possible to include a php file from a remote web server in a php file on the local server.

Example code would be:
Code:

<?php
include 'http://www.example.com/file.php?foo=1&bar=2';
?>


You can read more about the include function here... http://us2.php.net/include/
Manofgames
IMHO I don't really its possible.
Think about it, you have a budding forum (like frihost) All you'd have to do is include the config file, and boom - You'd have access to their forum db details, and coulddo whatever you wanted to them.

There may be a way to do it, but think about it logically as well-

The way a web server works when recieving a request for a dynamic page, is that it process' it before returning it.
The server doesn't distinguish weither the requester is a human, or a script, it just process' it and returns it.

So by including a remote php script, you're in effect including a html file.
Fire Boar
Manofgames is right. PHP files are parsed by Apache just before they are sent on to the external agent. So say you've got a php script called hello.php like this:

Code:
<?php
echo "Hello world!";
?>


Apache picks up the request for hello.php, takes the php file and runs the script on it, outputting anything that's been echoed. So people outside your web server only see "Hello world!", they can't see any of the actual script.

Which is why you can have passwords unencrypted in php files - nobody but yourself can access them.
Stubru Freak
You can however save the PHP in a .txt file and then include it.
Related topics
How To : Secure Your PHP Website
how many visitors you get per day ?
[Seeking tut] Built a website with frihost.
Link color fade javascript
mambo
IRC restrictions
get upto 50 frih per guide
Website login- How?
My Performing Arts Website
<< 2 DOMAIN AUCTIONS ENDING SOON! >>
I'm surprised with my site...
Throwing IE Overboard
Forms Processing
Form Processing Email Not Sent
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.