Jump to content

Need help with a script


x_789

Recommended Posts

Hi I have a Table I need a script that will look at field user_posts and if it has 5 or more posts. To give 5 points to field user_points. If they do not have 5 posts or more it will not give them any points. Here is what I have that will reset everyone to zero

<? 

define(\'IN_PHPBB\', true); 

$phpbb_root_path = \'./\'; 

include($phpbb_root_path . \'extension.inc\'); 

include($phpbb_root_path . \'common.\'.$phpEx); 

include($phpbb_root_path . \'includes/functions_selects.\'.$phpEx); 



$sql=array( 

\'UPDATE \'.USERS_TABLE.\' SET user_points=0 \' 

); 



$userdata = session_pagestart($user_ip, PAGE_INDEX); 

init_userprefs($userdata); 



if ( $userdata[\'user_level\'] != ADMIN ) 

     message_die(GENERAL_ERROR, "You are not Authorised to do this"); 

$n=0; 

while($sql[$n]) 

{ 

  if(!$result = $db->sql_query($sql[$n])) 

  $message.="Failed to update line: ".($n+1)." , ".$sql[$n]."<br />"; 

  else $message.="Succes line: ".($n+1)." , ".$sql[$n]."<br />"; 

  $n++; 

} 

message_die(GENERAL_MESSAGE, $message); 

?>

 

Both fields I listed user_points and user_posts are in the same Table phpbb_users .... Any help is greatly appricated.. As of right now I have to manually add points to each user and its very time consuming. Thanks X

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.