/    Sign up×
Community /Pin to ProfileBookmark

Reading info from a file

Ok. This is what the file will look like:

[li][c olor= orange]1[/ color][ c olor=green]12,000 [ /color][link=http://blah]name[/link][/li]

Well, it just repeats with different rank, post count (which is the 12k) and the name.

Well, I want to read the file and then use the 12k number and subtract (use gmp_sub) it from a new number and then store it in a variable.

The entire script so far is this:

<?php
set_time_limit(100777);
$firstmarkup = “[li][color =orange]”;
$markup1 = “[/color][colorc=green]”;
$secondmarkup = “[/color][link=http://users.ign.com/about/“;
$thirdmarkup = “]”;
$fourthmarkup = “[/link][/li]”;
$three = trim($thirdmarkup);
echo (“DragonBall Member Update<br><br>”);
$names=file(“names.txt”);
for($i=0;$i<sizeof($names);$i++){
$fname=”http://users.ign.com/about/”.trim($names[$i]);
$userpage=fread(fopen($fname,”r”),900000);
eregi(‘Posts:</B> </td>
([ ]*)?<td class=”BoardRowB”>(.*)? <a href(.*)?view latest posts’, $userpage,$regs);
$mu[$names[$i]]=str_replace(“,”,””,$regs[2]);
}
arsort($mu, SORT_NUMERIC);
$rank=0;
$srank=0;
while(list($name,$pc) = each($mu)){
$rank++;
echo “$firstmarkup$rank$markup1 “.ereg_replace(“(.+)(.{3})$”,”1,2″,$pc).”
$secondmarkup$name$three$name$fourthmarkup <br>”;
}
echo “<br>Top 10<br><br>”;
while($srank<10) {
$srank++;
echo “$srank $mu<BR>”;
}
?>

When I run the script, I will copy what it prints out and then save it as a text file (which will be used as the old number to compare with).

This may be real confusing.

Basically, I want it to print out how many posts he has gained since the last time I ran the script.

Thanks ?

to post a comment
PHP

0Be the first to comment 😎

×

Success!

Help @mg8 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...