P.S. The user would click a link that would begin the php trying to change the value of the number in the text file, because the link is "myscript.php?i=2" and the variable i is the number of the post that i want to change the variable in, beginning at 0. If you need any more info, please ask. Thanks!
Contents of myscript.php:
Code: Select all
<?php
$numOfEntry = isset($_POST['i']) ? intval($_POST['i']) : false;
if ($numOfEntry === false)
{
problem('You have not clicked the correct link, just tried to go to the file yourself. Error.');
}
$myline = array(0=>'',1=>'',2=>'',3=>'',4=>'',5=>'',6=>'',7=>'',8=>'');
$lines = file('entry file location here.txt');
$myline = explode("\t",$lines[$numOfEntry]);
foreach ($myline as $k=>$v)
{
$myline[$k]=rtrim($v);
}
$actualstring = $myline[8];
$actualnum = (int)$actualstring;
$numplusone = ($actualnum+1);
$numplusonestr = strval($numplusone);
$myline[8] = $numplusonestr;
$lines[$num] = implode("\t",$myline)."\n";
$lines = implode('',$lines);
$fp = fopen('entry file location here.txt','wb') or problem('Entry file is not writable.');
fputs($fp,$lines);
fclose($fp);
?>Code: Select all
Name of Poster (4 tabs here) Text of post. (1 tab here) Date, such as Febuary 2, 2010 (1 tab) 0 (1 tab) 0 (1 tab) 0 (1 tab) IP Address
Name of Poster (4 tabs here) Text of post. (1 tab here) Date, such as Febuary 2, 2010 (1 tab) 0 (1 tab) 0 (1 tab) 0 (1 tab) IP Address
Name of Poster (4 tabs here) Text of post. (1 tab here) Date, such as Febuary 2, 2010 (1 tab) 0 (1 tab) 0 (1 tab) (Here would be the numeric value that I would want to increase by one) (1 tab) IP Address
Name of Poster (4 tabs here) Text of post. (1 tab here) Date, such as Febuary 2, 2010 (1 tab) 0 (1 tab) 0 (1 tab) 0 (1 tab) IP Address
Name of Poster (4 tabs here) Text of post. (1 tab here) Date, such as Febuary 2, 2010 (1 tab) 0 (1 tab) 0 (1 tab) 0 (1 tab) IP Address