Hello everyone,
I've been trying to make a PHP script.
For example I have a vote page on some website, so I created a nice customized form that includes in the following:
[field] Username:
[button] Go voting
So whenever a member puts his username and clicks Go voting, the system will print his username to a .txt file with the following information:
[IP] [DATE] [Username]
e.x [ 192.168.1.1 3-3-12 17:58 JonyGraphics ]
People were telling me to do it with mysql instead of .txt but I find mysql diffcult for that kind of script.
So my question is, How would that script be called?
I tried to find a tutorial for that but could never find the right name for this script.
I tried searching for PHP logging but could not find what I was looking for.
Thank you.
P.S This is not to scam people for their IP addresses, this is needed to log all of the votes for my server's accounts.
Regards
Jony.
6 Replies - 359 Views - Last Post: 14 August 2012 - 01:24 AM
#1
PHP system prints the worlds in the field to a .txt file on click
Posted 13 August 2012 - 01:44 PM
Replies To: PHP system prints the worlds in the field to a .txt file on click
#2
Re: PHP system prints the worlds in the field to a .txt file on click
Posted 13 August 2012 - 01:52 PM
You just have to point your form at the script in its "action" property. For instance, assume our script was called "voting.php". We could create the form like this...
Now when the user submits the form it will take the values in the form and send them to voting.php for processing. Depending on the method used (here we use POST) the values of the fields will be in either the $_POST array or $_GET array.
So if our field was named "username" then you will find its value in $_POST["username"].
<form method="post" action="voting.php"> <!-- some fields --> </form>
Now when the user submits the form it will take the values in the form and send them to voting.php for processing. Depending on the method used (here we use POST) the values of the fields will be in either the $_POST array or $_GET array.
So if our field was named "username" then you will find its value in $_POST["username"].
#3
Re: PHP system prints the worlds in the field to a .txt file on click
Posted 13 August 2012 - 01:57 PM
Yeah but the action is to paste the username, ip, date to the .txt file and redirect to another page which is the actual vote page powered by another website.
So whenever players don't get their rewards in-game (on my minecraft server), I can look up thought the logs.txt or if someone is spamming with multiple accounts.
So basically I were only looking for the name of that script, to find a full tutorial about this.
Thank you for the reply!
So whenever players don't get their rewards in-game (on my minecraft server), I can look up thought the logs.txt or if someone is spamming with multiple accounts.
So basically I were only looking for the name of that script, to find a full tutorial about this.
Thank you for the reply!
#4
Re: PHP system prints the worlds in the field to a .txt file on click
Posted 13 August 2012 - 02:11 PM
You hook your form up to your script, where it will write the username, ip and date to the text file and then from there you redirect the user to the other page on the other website.

Edit: You can also call your PHP script using an AJAX call where it will then write to the text file. Then let it proceed through the processing of your form to the other site. Either way works.
Edit: You can also call your PHP script using an AJAX call where it will then write to the text file. Then let it proceed through the processing of your form to the other site. Either way works.
This post has been edited by Martyr2: 13 August 2012 - 02:13 PM
#5
Re: PHP system prints the worlds in the field to a .txt file on click
Posted 13 August 2012 - 02:22 PM
Okay thanks, Ill look forward into something.
But as I said it would be better if there could be some tutorials released about something similar!
thank you Marty.
But as I said it would be better if there could be some tutorials released about something similar!
thank you Marty.
#6
Re: PHP system prints the worlds in the field to a .txt file on click
Posted 13 August 2012 - 02:49 PM
Sorry for the bump, well erm I can't edit?
Okay I did something that posts only the username from the field into the logs.txt file
Index:
Process.php:
It now posts the username that the user put in.
How do I make it find out his IP + the date he posted his username at?
Thank you.
Okay I did something that posts only the username from the field into the logs.txt file
Index:
<html> <body> <form name="form1" method="post" action="signup.php"> Username: <input type="text" name="user"> <br </form> </body> </html>
Process.php:
<?php
$username = $_POST['user'];
//data display logs.txt
$data = "$username\n";
//logs.txt write
$fh = fopen("logs.txt", "a");
fwrite($fh, $data);
//Close the file
fclose($fh);
print "Processing...";
?>
It now posts the username that the user put in.
How do I make it find out his IP + the date he posted his username at?
Thank you.
#7
Re: PHP system prints the worlds in the field to a .txt file on click
Posted 14 August 2012 - 01:24 AM
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote





|