Menu
[code=php]
preg_match(“!Watched By Count:</B> </td>s+<td class=”BoardRowB”>([0-9,]+)s!s”, $file_replace, $match);//grabs the WUL portion
ok i have statement that retrieves everything i want into $match[1]. Now i want to put all those values into an array so i can arsort() them is this possible?
[code=php]
arsort($match);
[/code]
[i]Originally posted by RefreshF5 [/i]
[B]Fatal error: Maximum execution time of 30 seconds exceeded in C:Program FilesApache GroupApache2htdocstestign.php on line 22
anyway to change the max ececution time [/B][/QUOTE]
[code=php]
foreach($user as $x =>$value) //performs foreach so we can eventually echo all users in mu
{
$file=file_get_contents("http://users.ign.com/about/".$value." ");//grabs user profile
$file_replace=str_replace(",","",$file);//replaces comma with nothing for later
preg_match("!Watched By Count:</B> </td>s+<td class="BoardRowB">([0-9,]+)s!s", $file_replace, $match);//grabs the WUL portion
if(eregi($value."'s profile is currently not available.", $file))/*checks if user is
banned and then performs statements to see what to set $wul to*/
{
$wul="Banned";
}
else
{
$wul=$match[1];
}
if($wul=="Banned")
{
$prev="Banned";
}
elseif($previous[$x]=="")
{
$prev="New";
}
else
{
$prev=$match[1]-$previous[$x];
}
echo"[b][li] New[/b][b][color=red] ".$value."[/b][/color][b][color=green] ".$wul." [/color][color=blue]".$prev."[/b][/color][/li]<br>";
//^^ echoes out final MU code
}
echo"[/ol]";
}
[/code]
[code=php]
$ary = array();
foreach($user as $x =>$value){
$file=file_get_contents("http://users.ign.com/about/".$value." ");
$file_replace=str_replace(",","",$file);
preg_match("!Watched By Count:</B> </td>\s+<td class=\"BoardRowB\">([0-9,]+)\s!s", $file_replace, $match);
if($match[1]){
$ary[] = $match[1];
}
if(eregi($value."'s profile is currently not available.", $file)){
$wul="Banned";
} else {
$wul=$match[1];
}
if($wul=="Banned")
{
$prev="Banned";
}
elseif($previous[$x]==""){
$prev="New";
} else {
$prev=$match[1]-$previous[$x];
}
echo "[.b][li] New[/b][.b][color=red] ".$value."[/b][/color][.b][color=green] ".$wul." [/color][color=blue]".$prev."[/b][/color][/li]<br>";
# take the dots out from before the b's above
}
echo "[/ol]";
}
arsort($ary);
echo ("<pre>nn");
print_r($ary);
echo ("nn</pre>");
[/code]
[i]Originally posted by RefreshF5 [/i]
[B]is there anyway to only get the # [/B][/QUOTE]
[code=php]
$ary = array();
foreach($user as $x =>$value){
$file=file_get_contents("http://users.ign.com/about/".$value." ");
$file_replace=str_replace(",","",$file);
preg_match("!Watched By Count:</B> </td>\s+<td class=\"BoardRowB\">([0-9,]+)\s!s", $file_replace, $match);
if($match[1]){
$ary[] = $match[1];
}
}
arsort($ary);
foreach($user as $x =>$value){
$file=file_get_contents("http://users.ign.com/about/".$value." ");
$file_replace=str_replace(",","",$file);
preg_match("!Watched By Count:</B> </td>\s+<td class=\"BoardRowB\">([0-9,]+)\s!s", $file_replace, $match);
if(eregi($value."'s profile is currently not available.", $file)){
$wul="Banned";
} else {
$wul=$match[1];
}
if($wul=="Banned")
{
$prev="Banned";
}
elseif($previous[$x]==""){
$prev="New";
} else {
$prev=$match[1]-$previous[$x];
}
echo "[.b][li] New[/b][.b][color=red] ".$value."[/b][/color][.b][color=green] ".$wul." [/color][color=blue]".$prev."[/b][/color][/li]<br>";
# take the dots out from before the b's above
}
echo "[/ol]";
}
[/code]
[code=php]
$ary = array();
foreach($user as $x =>$value){
$file=file_get_contents("http://users.ign.com/about/".$value." ");
$file_replace=str_replace(",","",$file);
preg_match("!Watched By Count:</B> </td>s+<td class="BoardRowB">([0-9,]+)s!s", $file_replace, $match);
if($match[1]){
$ary[] = $match[1];
}
}
arsort($ary);
foreach($user as $x =>$value){
$file=file_get_contents("http://users.ign.com/about/".$value." ");
$file_replace=str_replace(",","",$file);
preg_match("!Watched By Count:</B> </td>s+<td class="BoardRowB">([0-9,]+)s!s", $file_replace, $match);
if(eregi($value."'s profile is currently not available.", $file)){
$wul="Banned";
} else {
$wul=$match[1];
}
if($wul=="Banned")
{
$prev="Banned";
}
elseif($previous[$x]==""){
$prev="New";
} else {
$prev=$match[1]-$previous[$x];
}
foreach($ary as $watch)
{
echo "[.b][li] New[/b][.b] ".$value."[/b][.b] ".$watch." ".$prev."[/b][/li]<br>";
# take the dots out from before the b's above
}
}
echo "[/ol]";
}
?>
[/code]
What you want to do is go through the foreach statement once to fill in all the values in $ary. Then you want to run the original foreach statement, which would have access the the proper order of the arrays. You'll need to change some of your code in the last code I posted to read from current($ary) instead of $match[1] (and then go to the next() variable at the end of the loop).[/quote]
[code=php]
$ary = array();
foreach($user as $x =>$value){
$file=file_get_contents("http://users.ign.com/about/".$value." ");
$file_replace=str_replace(",","",$file);
preg_match("!Watched By Count:</B> </td>s+<td class="BoardRowB">([0-9,]+)s!s", $file_replace, $match);
if($match[1]){
$ary[] = $match[1];
}
}
arsort($ary);
[/code]
[code=php]
foreach($user as $x =>$value){
$file=file_get_contents("http://users.ign.com/about/".$value." ");
$file_replace=str_replace(",","",$file);
preg_match("!Watched By Count:</B> </td>s+<td class="BoardRowB">([0-9,]+)s!s", $file_replace, $match);
if(eregi($value."'s profile is currently not available.", $file)){
$wul="Banned";
} else {
$wul=current($ary);
}
if($wul=="Banned")
{
$prev="Banned";
}
elseif($previous[$x]==""){
$prev="New";
} else {
$prev=current($ary)-$previous[$x];
} [/code]
[i]Originally posted by RefreshF5 [/i]
[B]I would first run this to fill the array?[/b][/quote]
[i]Originally posted by RefreshF5[/i]
[b]so thats where i believe the next($ary) would come in?[/b][/quote]
[i]Originally posted by RefreshF5[/i]
[b] ALso would i have to put the $wul and $value variable into an asscoitive array so the correct user would match the correct name. [/B][/QUOTE]
[i]Originally posted by RefreshF5 [/i]
[B]but i dont know how to do that[/B][/QUOTE]
[code=php]<?
//WUU Script for the IGN Boards(boards.ign.com) by Conor Hastings(RefreshF5)
error_reporting(E_ALL ^ E_NOTICE);//turns off notices because i need undefined variable
if(isset($_POST['submit']))//checks if submit is set
{
$users=$_POST['users'];//grabs data from textarea
$user_rep=str_replace(" ","",$users);//replaces emtpy spaces with nothing
$user= explode(",",$user_rep);//puts the data into array
$wul_count=$_POST['wul_count'];//grabs previous WUL count
$wul_rep=str_replace(" ","",$wul_count);
$previous=explode(",",$wul_rep);//explodes into array
echo"[b]Rank/Rank Change/[color=whiye]Username[/color]/[color=EDF3FE]WUL Count[/color]/[color=white]WUL Change[/color][/b]";//echoes heading
echo"[ol]<br>";
$ary = array();
foreach($user as $x =>$value){
$file=file_get_contents("http://users.ign.com/about/".$value." ");
$file_replace=str_replace(",","",$file);
preg_match("!Watched By Count:</B> </td>s+<td class="BoardRowB">([0-9,]+)s!s", $file_replace, $match);
if($match[1]){
$ary[] = $match[1];
}
}
arsort($ary);
foreach($user as $x =>$value){
$file=file_get_contents("http://users.ign.com/about/".$value." ");
$file_replace=str_replace(",","",$file);
preg_match("!Watched By Count:</B> </td>s+<td class="BoardRowB">([0-9,]+)s!s", $file_replace, $match);
if(eregi($value."'s profile is currently not available.", $file)){
$wul="Banned";
} else {
$wul=current($ary);
}
if($wul=="Banned")
{
$prev="Banned";
}
elseif($previous[$x]==""){
$prev="New";
} else {
$prev=current($ary)-$previous[$x];
}
echo "[b][li][/b][b][color=white] ".$value."[/b][/color][b][color=EDF3FE] ".$wul."[/color][color=white] ".$prev."[/color][/b][/li]<br>";
# take the dots out from before the b's above
next($ary);
}
echo "[/ol]";
}
?>[/code]
[i]Originally posted by Jona [/i]
[B][font=arial]Like this?[/font]
[b]Rank/Rank Change/[color=blue]Username[/color] /[color=orange]WUL Count[/color] /[color=blue]WUL Change[/color] [/b][list=1]
[/B][/QUOTE][*][b] [color=blue] RefreshF5 [/b][/color][b][color=orange] 44[/color] [color=blue] 39[/color] [/b][*][b] [color=blue] eshold1 [/b][/color][b][color=orange] 1920[/color] [color=blue] 1915[/color] [/b][*][b] [color=blue] carlmmii [/b][/color][b][color=orange] 516[/color] [color=blue] 511[/color] [/b][*][b] [color=blue] bigreddsmurf [/b][/color][b][color=orange] 211[/color] [color=blue] 206[/color] [/b][*][b] [color=blue] FChappa1j [/b][/color][b][color=orange] 252[/color] [color=blue] 247[/color] [/b]
[/list]
[i]Originally posted by RefreshF5 [/i]
[B]also any idea why this: $data=array("name" => $value "wul" => $ary); is giveing me this error
Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ')' in C:Program FilesApache GroupApache2htdocswuu.php on line 68 [/B][/QUOTE]
[code=php]
$data=array("name" => $value, "wul" => $ary);
[/code]
[code=php]
$data[]=array("name" => $user, "wul" => $ary);
for($i=0; $i < 200;$i++){
echo $data[$i]["name"];
}
[/code]
[code=php]
for($j=0; $j< count($user); $j++){
$data[]=array("name" => $user[$j], "wul" => $ary[$j]);
}
for($i=0; $i < count($data);$i++){
echo $data["name"][$i] .": ";
echo $data["wul][$i] ."<br>";
}
[/code]
[code=php]
<form action="<?$_SERVER['PHP_SELF'];?>" method="POST">
<b>Input a comma delimited list of usernames. Append new users to the end.</b><br><textarea rows="8" cols="40" name="users"></textarea><br>
<b>Input previous WUL counts delimited by comma. If New leave blank.</b><br><textarea rows="8" cols="40" name="wul_count"></textarea><br>
<input type="submit" name="submit"><br>
<?
//WUU Script for the IGN Boards(boards.ign.com) by Conor Hastings(RefreshF5)
error_reporting(E_ALL ^ E_NOTICE);//turns off notices because i need undefined variable
if(isset($_POST['submit']))//checks if submit is set
{
$users=$_POST['users'];//grabs data from textarea
$user_rep=str_replace(" ","",$users);//replaces emtpy spaces with nothing
$user= explode(",",$user_rep);//puts the data into array
$wul_count=$_POST['wul_count'];//grabs previous WUL count
$wul_rep=str_replace(" ","",$wul_count);
$previous=explode(",",$wul_rep);//explodes into array
echo"[b]Rank/Rank Change/[color=whiye]Username[/color]/[color=EDF3FE]WUL Count[/color]/[color=white]WUL Change[/color][/b]";//echoes heading
echo"[ol]<br>";
$ary = array();
foreach($user as $x =>$value){
$file=file_get_contents("http://users.ign.com/about/".$value." ");
$file_replace=str_replace(",","",$file);
preg_match("!Watched By Count:</B> </td>s+<td class="BoardRowB">([0-9,]+)s!s", $file_replace, $match);
if($match[1]){
$ary[] = $match[1];
}
arsort($ary);
for($j=0; $j< count($user); $j++){
$data[]=array("name" => $user[$j], "wul" => $ary[$j]);
}
for($i=0; $i < count($data);$i++){
echo $data["name"][$i] .": ";
echo $data["wul"][$i] ."<br>";
}
}
?>
[/code]
[code=php]
<form action="<?$_SERVER['PHP_SELF'];?>" method="POST">
<b>Input a comma delimited list of usernames. Append new users to the end.</b><br><textarea rows="8" cols="40" name="users"></textarea><br>
<b>Input previous WUL counts delimited by comma. If New leave blank.</b><br><textarea rows="8" cols="40" name="wul_count"></textarea><br>
<input type="submit" name="submit"><br>
<?
//WUU Script for the IGN Boards(boards.ign.com) by Conor Hastings(RefreshF5)
error_reporting(E_ALL ^ E_NOTICE);//turns off notices because i need undefined variable
if(isset($_POST['submit']))//checks if submit is set
{
$users=$_POST['users'];//grabs data from textarea
$user_rep=str_replace(" ","",$users);//replaces emtpy spaces with nothing
$user= explode(",",$user_rep);//puts the data into array
$wul_count=$_POST['wul_count'];//grabs previous WUL count
$wul_rep=str_replace(" ","",$wul_count);
$previous=explode(",",$wul_rep);//explodes into array
echo"[b]Rank/Rank Change/[color=whiye]Username[/color]/[color=EDF3FE]WUL Count[/color]/[color=white]WUL Change[/color][/b]";//echoes heading
echo"[ol]<br>";
$ary = array();
foreach($user as $x =>$value){
$file=file_get_contents("http://users.ign.com/about/".$value." ");
$file_replace=str_replace(",","",$file);
preg_match("!Watched By Count:</B> </td>s+<td class="BoardRowB">([0-9,]+)s!s", $file_replace, $match);
if($match[1]){
$ary[] = $match[1];
}
arsort($ary);
for($j=0; $j< count($user); $j++){
$data[]=array("name" => $user[$j], "wul" => $ary[$j]);
}
for($i=0; $i < count($data);$i++){
echo $data[$i]["name"] .": ";
echo $data[$i]["wul"] ."<br>";
}
?>
[/code]
[code=php]
<form action="<?$_SERVER['PHP_SELF'];?>" method="POST">
<b>Input a comma delimited list of usernames. Append new users to the end.</b><br><textarea rows="8" cols="40" name="users"></textarea><br>
<b>Input previous WUL counts delimited by comma. If New leave blank.</b><br><textarea rows="8" cols="40" name="wul_count"></textarea><br>
<input type="submit" name="submit"><br>
<?
//WUU Script for the IGN Boards(boards.ign.com) by Conor Hastings(RefreshF5)
error_reporting(E_ALL ^ E_NOTICE);//turns off notices because i need undefined variable
if(isset($_POST['submit']))//checks if submit is set
{
$users=$_POST['users'];//grabs data from textarea
$user_rep=str_replace(" ","",$users);//replaces emtpy spaces with nothing
$user= explode(",",$user_rep);//puts the data into array
$wul_count=$_POST['wul_count'];//grabs previous WUL count
$wul_rep=str_replace(" ","",$wul_count);
$previous=explode(",",$wul_rep);//explodes into array
echo"[b]Rank/Rank Change/[color=whiye]Username[/color]/[color=EDF3FE]WUL Count[/color]/[color=white]WUL Change[/color][/b]";//echoes heading
echo"[ol]<br>";
$ary = array();
foreach($user as $x =>$value){
$file=file_get_contents("http://users.ign.com/about/".$value." ");
$file_replace=str_replace(",","",$file);
preg_match("!Watched By Count:</B> </td>s+<td class="BoardRowB">([0-9,]+)s!s", $file_replace, $match);
if($match[1]){
$ary[] = $match[1];
}
}
arsort($ary);
for($j=0; $j< count($user); $j++){
$data[]=array("name" => $user[$j], "wul" => $ary[$j]);
}
for($i=0; $i < count($data);$i++){
echo $data[$i]["name"] .": ";
echo $data[$i]["wul"] ."<br>";
}
}
?>
[/code]
[code=php]
foreach($user as $x =>$value){
$file=file_get_contents("http://users.ign.com/about/".$value." ");
$file_replace=str_replace(",","",$file);
preg_match("!Watched By Count:</B> </td>s+<td class="BoardRowB">([0-9,]+)s!s", $file_replace, $match);
if($match[1]){
$ary[] = $match[1];
}
}
arsort($ary);
for($j=0; $j< count($user); $j++){
$file=file_get_contents("http://users.ign.com/about/".$data[$i]["name"]." ");
preg_match("!Watched By Count:</B> </td>s+<td class="BoardRowB">([0-9,]+)s!s", $file_replace, $match);
$data[]=array("name" => $user[$j], "wul" => $ary[$j]);
}
for($i=0; $i < count($data);$i++){
echo $data[$i]["name"] .": ";
echo $data[$i]["wul"] ."<br>";
}
}
[/code]
0.1.9 — BETA 5.18