supergreatboy
Nieuwe gebruiker
- Lid geworden
- 4 jul 2006
- Berichten
- 2
hallo, ik heb hier een script voor een site waarbij gebruikers punten kunnen krijgen die ze met een andere site hebben verdiend.
het is de bedoeling dat alle namen van sigil.outwar.com/crew........ in de database komen.
dan moet je de punten kunnen toekennen en updaten, ik heb hier met een vriend van me naar gekeken maar ik kan niet vinden wat er mis is.
<?php
require ( 'db.php' );
// Reward amount
$reward = 5;
// Grabs the crew page from OW
$file = (string)file_get_contents("http://sigil.outwar.com/crewprofile.php?id=235795");
// This finds all matches with the tassadars string
preg_match_all('/.The Tassadars (\d{2})\+.<\/td>.*?<td><a href=".+?">(.+?)<\/a><\/td>/is',$file,$matches);
// Loop through every user and give them their points
for($i=0;$i<sizeof($matches[2]);$i++)
{
$link = mysql_connect($host, $username, $pass, $database);
$user = $matches[2][$i];
$details = (mysql_query("SELECT * FROM 'points' WHERE 'name' = $user"));
$new_points = $details['mbpoints']+$reward;
mysql_query("UPDATE 'points' SET 'mbpoints' = $new_points WHERE 'name' = $user");
echo "$i. $reward points awarded to $user<br>";
}
?>
het is de bedoeling dat alle namen van sigil.outwar.com/crew........ in de database komen.
dan moet je de punten kunnen toekennen en updaten, ik heb hier met een vriend van me naar gekeken maar ik kan niet vinden wat er mis is.
<?php
require ( 'db.php' );
// Reward amount
$reward = 5;
// Grabs the crew page from OW
$file = (string)file_get_contents("http://sigil.outwar.com/crewprofile.php?id=235795");
// This finds all matches with the tassadars string
preg_match_all('/.The Tassadars (\d{2})\+.<\/td>.*?<td><a href=".+?">(.+?)<\/a><\/td>/is',$file,$matches);
// Loop through every user and give them their points
for($i=0;$i<sizeof($matches[2]);$i++)
{
$link = mysql_connect($host, $username, $pass, $database);
$user = $matches[2][$i];
$details = (mysql_query("SELECT * FROM 'points' WHERE 'name' = $user"));
$new_points = $details['mbpoints']+$reward;
mysql_query("UPDATE 'points' SET 'mbpoints' = $new_points WHERE 'name' = $user");
echo "$i. $reward points awarded to $user<br>";
}
?>