How to send this data automatically to server on background when user opens website, using php and for function JavaScript can be used
How to send this data automatically to server on background when user opens website, using php and for function JavaScript can be used
This is my website.
When someone open this website, as shown in the website these information should be sent automatically to SQL Server or these information should be saved in a directory in the form of html in background these information are invisible for user while opening website. The user will not be able to see these data but these ta will be sent to my server in background and i will see in future.
The code i have written is enter link description here
Please help me I am a beginner in programming language. I am making a website and when someone visit to my website i want to record which ip visited my website and every information about the user what are possible.
Much of this is easily obtained log data, and you could also use Google Analytics for much or all of it too. What have you tried so far? This question doesn't look like you've done any of your own research yet.
– Paul
Jun 29 at 9:57
2 Answers
2
.I would like to mention you cannot do this with purely html, css, javascript, you would need a language that's server-side, such as PHP.
By applying PHP, it can be easily achievable.
Check out http://php.net/manual/en/reserved.variables.server.php
Those are the variables you can get, some of them are from the user. You can see the IP, browser, OS, etc... of the user.
At the beginning of the pages, simply add a php script to get those variables, and then add an SQL query to save those variables.
Example:
$_SERVER['REMOTE_ADDR'] gets the client's IP
Do an SQL query to save it, for example (if applying php)
$sql_query = "INSERT INTO ip_list (id, ip, time) VALUES (NULL, ".$_SERVER['REMOTE_ADDR'].", GETDATE())";
I would like to mention you cannot do this with purely html, css, javascript, you would need a language that's server-side, such as PHP.
By applying PHP, it can be easily achievable.
Check out http://php.net/manual/en/reserved.variables.server.php
Those are the variables you can get, some of them are from the user.
You can see the IP, browser, OS, etc... of the user.
At the beginning of the pages, simply add a php script to get those variables, and then add an SQL query to save those variables.
Example:
$_SERVER['REMOTE_ADDR'] gets the client's IP
Do an SQL query to save it, for example (if applying php)
$sql_query = "INSERT INTO ip_list (id, ip, time) VALUES (NULL, ".$_SERVER['REMOTE_ADDR'].", GETDATE())";
That should save the IP address every time someone opens a certain page
You could do a sort of verification if you want to be more accurate, and see if the IP was saved previously, to not re-insert the value again.
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
stealing of user information its very Idea.
– Geek
Jun 29 at 9:53