Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Converting/Creating Modules
Author Message
draxx
Involved
Involved



Joined: Nov 19, 2003
Posts: 282

PostPosted: Sat Jun 13, 2009 10:13 pm Reply with quote

Here is the code the guy uses to interface with nuke. There is a function (I put in red) where he increments user posts when they post an add. In this function I would like it to also add points.

The problem is I can't include mainfile.php - when I try I get a blank page - or I would just copy a function from another module to add points.

So can someone please write into the function by example or provide me another possible example of a way to increment the user points in the nuke user database? I'm lost without being able to use mainfile. I thought I would just copy the two functions from mainfile into this program but then I was worried I wouldent get the user right. Since it uses $user and this uses ... some array?

Code:


<?php
//////////////////////////// COPYRIGHT NOTICE //////////////////////////////
// This script is part of PhotoPost PHP, a software application by        //
// All Enthusiast, Inc.  Use of any kind of part or all of this           //
// script or modification of this script requires a license from All      //
// Enthusiast, Inc.  Use or modification of this script without a license //
// constitutes Software Piracy and will result in legal action from All   //
// Enthusiast, Inc.  All rights reserved.                                 //
////////////////////////////////////////////////////////////////////////////

// this will return an array like:
//list( $userid, $username, $email, $password, $temppass, $groups, $offset, $sessionid ) = get_userinfo( $user, $userid );


function upgradesubscriber( $usergroup, $userid = 0 ) {
    global $Globals, $pp_phrase, $db_link;

    if ( !empty($usergroup) && !empty($userid) )
    {

    $resulta = ppmysql_query("UPDATE {$Globals['dprefix']}bbuser_group SET group_id='$usergroup' WHERE user_id='$userid'",$db_link);

   }

    return;
}

function get_admin( $authemail )
{
    global $Globals, $pp_phrase, $db_link;

    $queryv = ppmysql_query("SELECT user_id FROM {$Globals['dprefix']}users WHERE user_email = '$authemail'", $db_link);
    list( $sendid ) = mysql_fetch_row($queryv);

    return( $sendid );

}

function get_userinfo( $authuser, $userid=0 ) {
    global $Globals, $pp_phrase, $db_link;

    if ( $userid != 0 ) $query = "SELECT user_id,username,user_email,user_password,user_level,user_timezone FROM {$Globals['dprefix']}users WHERE user_id='$userid'";
    else $query = "SELECT user_id,username,user_email,user_password,user_level,user_timezone FROM {$Globals['dprefix']}users WHERE username='$authuser'";

    $queryv = ppmysql_query($query,$db_link);
    $results = mysql_fetch_array($queryv);

    $username[0] = $results['user_id'];           // userid
    $username[1] = $results['username'];          // username
    $username[2] = $results['user_email'];        // email
    $username[3] = $results['user_password'];     // password
    $username[4] = "";                            // temppassword
    $username[6] = $results['user_timezone'];     // timeoffset
    $username[7] = "";                            // session id

    ppmysql_free_result($queryv);

    if ( is_numeric($username[0]) ) $userid = $results['user_id'];
    else $userid = -1;

    $query = "SELECT {$Globals['dprefix']}bbuser_group.group_id FROM {$Globals['dprefix']}bbuser_group
        LEFT JOIN {$Globals['dprefix']}bbgroups ON {$Globals['dprefix']}bbuser_group.group_id = {$Globals['dprefix']}bbgroups.group_id
        WHERE {$Globals['dprefix']}bbuser_group.user_id='$userid'
        AND {$Globals['dprefix']}bbuser_group.user_pending=0
        AND {$Globals['dprefix']}bbgroups.group_single_user=0";
    $result = ppmysql_query($query,$db_link);

    $ubbgroups = array();
    while ( $row = mysql_fetch_row($result) ) {
        array_push( $ubbgroups, $row[0] );
    }

    if ( $results['user_level'] == 2 ) {
        array_push( $ubbgroups, "2");
    }
    ppmysql_free_result($result);


    $username[5] = $ubbgroups;

    $query = "SELECT session_id FROM {$Globals['dprefix']}bbsessions WHERE session_user_id='$userid'";
    $result = ppmysql_query($query,$db_link);
    $results = mysql_fetch_array($result);
    $username[7] = $results[0];                   // session id
    ppmysql_free_result($result);

    return $username;
}

//
// For each BB, get the total number of users
//

function get_totalusers() {
    global $Globals, $pp_phrase, $db_link;

    $query = "SELECT * FROM {$Globals['dprefix']}users";
    $queryv = ppmysql_query($query, $db_link);
    $totalusers = mysql_num_rows($queryv);

    return( $totalusers );
}

//
// For each BB, get the link to the profile page for that user
//

function get_profilelink( $tuserid, $tusername="" ) {
    global $Globals, $pp_phrase, $db_link, $postreply, $privatelink;

    $profilelink = "{$Globals['vbulletin']}/profile.php?mode=viewprofile&u=$tuserid";
    $postreply = "<span class=\"{$Style['medium']}\"><b>{$pp_phrase['postreply']}</b></span>";

    return( $profilelink );
}

//
// Get a list of users and ids as an option list
//

function useropts() {
    global $Globals, $pp_phrase, $db_link;

    $useropts = "";

    $query = "SELECT user_id,username FROM {$Globals['dprefix']}users ORDER BY username";
    $queryv = ppmysql_query($query,$db_link);
    while ( list( $userid, $username ) = mysql_fetch_row($queryv) ) {
        $useropts .= "<option value=\"$userid\">$username</option>";
    }
    ppmysql_free_result($rows);

    return( $useropts );
}

[color=red]//
// Increment or decrement the user post in the users database
//

function inc_user_posts( $type = "plus", $userid = 0 ) {
    global $Globals, $pp_phrase, $db_link, $User;

    if ( $userid == 0 ) $usernum = $User['userid'];
    else $usernum = $userid;

    if ( $type == "plus" ) {
        $do_inc = "+1";
    }
    else {
        $do_inc = "-1";
    }

    $query = "UPDATE {$Globals['dprefix']}users SET user_posts=user_posts$do_inc WHERE user_id='$usernum'";
    $resulta = ppmysql_query($query,$db_link);

    return;
}[/color]
function get_profiledata( $cuserid ) {
    global $Globals, $pp_phrase, $db_link;
    global $cuser, $clocation, $ctitle, $cposts, $regdate, $isonline, $hpage, $postline, $profilelink, $privatelink;

    $regdate = ""; $ctitle = ""; $cposts = ""; $chomepage = ""; $cuser = $pp_phrase['unreg']; $postline = "";
    $hpage = "";
        $userprofile = array("Anonymous","","","","","","","","","");


    if ($cuserid != 0) {
        if ( !empty( $Globals['dprefix'] ) ) {
            $utable = "{$Globals['dprefix']}users";
            $rtable = "{$Globals['dprefix']}bbranks";
        }
        else {
            $utable = "users";
            $rtable = "bbranks";
        }
        $query = "SELECT $utable.username,$utable.user_website,$utable.user_posts,$rtable.rank_title,$utable.user_regdate FROM ";
        $query .= "$utable LEFT JOIN $rtable ON $utable.user_rank = $rtable.rank_id WHERE $utable.user_id=$cuserid LIMIT 1";
        $results = ppmysql_query($query, $db_link);

        if ( $results ) {
            list( $cuser, $chomepage, $cposts, $ctitle, $regdate ) = mysql_fetch_row($results);
            ppmysql_free_result( $results );

            $userprofile[0] = $cuser;                   // Username
            $userprofile[1] = $chomepage;               // Homepage
            $userprofile[2] = $cposts;                  // Total Posts
            $userprofile[3] = $ctitle;                  // Title
            $userprofile[4] = $regdate;                 // Registered Date
            $userprofile[5] = "";                       // Location
            $userprofile[6] = "";                       // Avatar
            $userprofile[7] = "";                       // Signauture
        }

        $postline = "<a href=\"$profilelink\" target=\"_blank\"><img src=\"{$Globals['idir']}/profile.gif\"
            border=\"0\" alt=\"{$pp_phrase['seeprofile']}\" /></a>
            $hpage<!--PhotoPost, copyright All, Enthusiast, Inc.-->";
    }

    return( $userprofile );
}

function setlogin( $password ) {
    global $Globals, $pp_phrase, $User, $db_link, $_SERVER;

    $dotquad_ip = findenv("REMOTE_ADDR");
    $ip_sep = explode('.', $dotquad_ip);
    $ipaddr = sprintf('%02x%02x%02x%02x', $ip_sep[0], $ip_sep[1], $ip_sep[2], $ip_sep[3]);

    $sessiondata = array();
   $sessiondata['autologinid'] = 1;
   $sessiondata['userid'] = $User['userid'];

    $sesstime = time();
   $session_id = md5(uniqid($user_ip));

    $query = "DELETE FROM {$Globals['dprefix']}bbsessions WHERE session_user_id='{$User['userid']}'";
    $result = ppmysql_query($query,$db_link);
    ppmysql_free_result($result);

    $query = "REPLACE INTO {$Globals['dprefix']}bbsessions (session_id,session_user_id,session_start,session_time,session_ip,session_page,session_logged_in)
        VALUES ('$session_id', '{$User['userid']}', $sesstime, $sesstime, '$ipaddr', '0', '1')";
    $result = ppmysql_query($query,$db_link);
    ppmysql_free_result($result);

    $sql = "UPDATE {$Globals['dprefix']}users SET user_session_time = '$sesstime', user_session_page = '0', user_lastvisit = '$sesstime' WHERE user_id={$User['userid']}";
    $result = ppmysql_query($query,$db_link);
    ppmysql_free_result($result);

    setcookie("{$Globals['cookieprefix']}_data", serialize($sessiondata), $sesstime + 31536000, "{$Globals['cookie_path']}", $Globals['domain_path'] );
    setcookie("{$Globals['cookieprefix']}_sid", $session_id, 0, "{$Globals['cookie_path']}", $Globals['domain_path'] );

    $query = "SELECT user_id,username,user_password,storynum,umode,uorder,thold,noscore,ublockon,theme,commentmax FROM {$Globals['dprefix']}users WHERE user_id='{$User['userid']}'";
    $resultx = ppmysql_query($query,$db_link);
    list( $setuid,$setusername,$setpass,$setstorynum,$setumode,$setuorder,$setthold,$setnoscore,$setublockon,$settheme,$setcommentmax ) = mysql_fetch_row($resultx);
    ppmysql_free_result($resultx);

    $info = base64_encode("$setuid:$setusername:$setpass:$setstorynum:$setumode:$setuorder:$setthold:$setnoscore:$setublockon:$settheme:$setcommentmax");
    setcookie( "user", "$info", time()+31536000, "{$Globals['cookie_path']}", $Globals['domain_path'] );
}

function logout() {
    global $Globals, $pp_phrase, $User, $db_link;

    setcookie( "{$Globals['cookieprefix']}_data", "", time()-3600, $Globals['cookie_path'], $Globals['domain_path'] );
    setcookie( "{$Globals['cookieprefix']}_sid", "", time()-3600, $Globals['cookie_path'], $Globals['domain_path'] );
    setcookie( "{$Globals['cookieprefix']}user", "", time()-3600, $Globals['cookie_path'], $Globals['domain_path'] );

    $query = "DELETE FROM {$Globals['dprefix']}bbsessions WHERE session_user_id='{$User['userid']}'";
    $result = ppmysql_query($query,$db_link);
    ppmysql_free_result($result);

    return;
}


function get_regcode() {
    global $Globals, $pp_phrase;

    $regtext = "<a href=\"{$Globals['vbulletin']}/modules.php?name=Forums&file=profile&mode=register\">{$pp_phrase['register']}</a>";

    return($regtext);
}

function get_logincode() {
    global $Globals, $pp_phrase;

    $links[0] = "{$Globals['vbulletin']}/modules.php?name=Forums&file=profile&mode=sendpassword";
    $links[1] = "{$Globals['vbulletin']}/modules.php?name=Forums&file=profile&mode=register";

    return($links);
}

function authenticate( $authuser="", $chkpassword="" ) {
    global $Globals, $pp_phrase, $User, $password, $link, $db_link;
    global $_SERVER;
    global $phoedit, $gologin, $bbuserid, $bbpassword;
    global $up_k, $disk_k, $cedit;
    global $usergroup;
    global $CatPerms, $ueditpho, $ueditposts, $exclude_cat;
    global $session_id, $pass_hash, $member_id;

    $cookpass = $Globals['cookieprefix']."_data";
    $cookhash = $Globals['cookieprefix']."_sid";

    $$cookuser = $_COOKIE["user"];
    $$cookhash = $_COOKIE["$cookhash"];
    $$cookpass = $_COOKIE["$cookpass"];

    // Init some variables
    $User = array();
    $User['uploads'] = 0;     
    $User['userid'] = 0;
    $User['nopost'] = 1;
    $User['adminedit'] = 0;
    $User['moderator'] = 0;
    $User['uploadlimit'] = 0;

    $gologin = 1; $usergroup = 0; $checkpass = 0;
    $ueditpho = 0; $ueditposts = 0;
    $diskspace = 0; $uploadsize = 0;
    $md5cookpass=""; $ubbgroups = array();
    $sessionid = "";

    if ( !isset($$cookhash) ) $$cookhash = "0";

    if ( isset($$cookuser) ) {
        $uninfo = base64_decode($$cookuser);
       list( $cookuser,$setusername,$setpass,$setstorynum,$setumode,$setuorder,$setthold,$setnoscore,$setublockon,$settheme,$setcommentmax ) = explode(":",$uninfo);
        $checkpass = 1;
    }
    else {
        $cookuser = -1;
    }

    if ( isset($$cookpass) ) {
        $sessiondata = unserialize(stripslashes($$cookpass));
        $cookuser = $sessiondata['userid'];
        $md5cookpass = $sessiondata['autologinid'];
    }

    if ( $authuser == "" ) {
        list( $userid, $username, $email, $dbpassword, $temppass, $ubbgroups, $offset, $sessionid ) = get_userinfo( "", $cookuser );
    }
    else {
        $cookuser = addslashes($authuser);
        $md5cookpass = md5($chkpassword);
        list( $userid, $username, $email, $dbpassword, $temppass, $ubbgroups, $offset, $sessionid ) = get_userinfo( $cookuser );
    }

    if ( $sessionid == $$cookhash ) $checkpass = 1;

    if ( ($checkpass == 1 || $dbpassword == $md5cookpass) && $userid > 1 ) {
        $gologin = 0;
        $User['nopost'] = 0;
        $User['userid'] = $userid;
        $User['username'] = $username;
        $User['email'] = $email;
        $User['offset'] = $offset;

        if ($ubbgroups[0] == "") {
            $ubbgroups[0] = 3;
        }
    }
    else {
        // login for guests
        $ubbgroups = array( 1 );
    }

    $CatPerms = array();

    set_user_perms( $ubbgroups );

    return( $gologin );
}

function import_user_groups() {
   global $Globals, $db_link, $link;

   $query = "SELECT groupid, groupname, cpaccess, uploads, comments, uploadsize, editpho, editposts, modaccess, reqmod, highlight, bold, italic, payment, uplimit, free FROM {$Globals['pp_db_prefix']}usergroups";
   $resultcur = ppmysql_query($query, $link);
   $currentGroups = array();

   while ( list($groupid, $groupname, $cpaccess, $uploads, $comments, $uploadsize, $editpho, $editposts, $modaccess, $reqmod, $highlite, $bold, $italic, $payment, $uplimit, $free ) = mysql_fetch_row( $resultcur ) ) {
      $currentGroups[$groupid]['groupid'] = $groupid;
      $currentGroups[$groupid]['groupname'] = $groupname;
      $currentGroups[$groupid]['cpaccess'] =  $cpaccess;
      $currentGroups[$groupid]['uploads'] =  $uploads;
      $currentGroups[$groupid]['comments'] =  $comments;
      $currentGroups[$groupid]['uploadsize'] =  $uploadsize;
      $currentGroups[$groupid]['editpho'] =  $editpho;
      $currentGroups[$groupid]['editposts'] =  $editposts;
      $currentGroups[$groupid]['modaccess'] =  $modaccess;
      $currentGroups[$groupid]['reqmod'] =  $reqmod;
      $currentGroups[$groupid]['highlite'] =  $highlite;
      $currentGroups[$groupid]['bold'] =  $bold;
      $currentGroups[$groupid]['italic'] =  $italic;
      $currentGroups[$groupid]['payment'] =  $payment;
      $currentGroups[$groupid]['uplimit'] =  $uplimit;
      $currentGroups[$groupid]['free'] =  $free;
   }

    $grouptable="{$Globals['dprefix']}bbgroups";

    $query = "SELECT group_id,group_name FROM $grouptable WHERE group_type=2 OR group_single_user=0";
    $readug = ppmysql_query($query, $db_link);
    $newGroups = array();

    if ( !$readug ) {
        diewell("Error: Are you certain that your database prefix is set properly?<p>I cannot see your
            Nuke \"<b>$grouptable</b>\" table.<p>The prefix setting adds characters to the front of Nuke
            table names - please doublecheck this.");
    }

    $rcount = mysql_num_rows($readug);

    while ( list( $gid, $title ) = mysql_fetch_row( $readug ) ) {
      $newGroups[$gid] = $gid;
      if ( $gid == 2) $cancontrol = 1;
        else $cancontrol = 0;

      if ( !array_key_exists($gid,$currentGroups) ) {
         $currentGroups[$gid]['groupid'] = $gid;
         $currentGroups[$gid]['groupname'] = $title;
         $currentGroups[$gid]['cpaccess'] =  $cancontrol;
         $currentGroups[$gid]['uploads'] =  0;
         $currentGroups[$gid]['comments'] = 0;
         $currentGroups[$gid]['diskspace'] =  0;
         $currentGroups[$gid]['uploadsize'] = 0;
         $currentGroups[$gid]['editpho'] =  0;
         $currentGroups[$gid]['editposts'] =  0;
         $currentGroups[$gid]['modaccess'] =  0;
         $currentGroups[$gid]['reqmod'] =  0;
         $currentGroups[$gid]['highlite'] =  0;
         $currentGroups[$gid]['bold'] =  0;
         $currentGroups[$gid]['italic'] =  0;
         $currentGroups[$gid]['payment'] =  0;
         $currentGroups[$gid]['uplimit'] =  0;
         $currentGroups[$gid]['free'] =  0;
      }
   }
   ppmysql_free_result( $readug );
       
       foreach ($currentGroups as $currentGroup) {
          $gid = $currentGroup['groupid'];
          if ( !array_key_exists($gid, $newGroups)) {
             unset($currentGroups[$gid]);
          }
       }
       
    $resultd = ppmysql_query("DELETE FROM {$Globals['pp_db_prefix']}usergroups", $link);
           
   foreach ($currentGroups as $currentGroup) {
      $gid = $currentGroup['groupid'];
      $name = addslashes($currentGroup['groupname']);
      $cpaccess = $currentGroup['cpaccess'];
      $uploads = $currentGroup['uploads'];
      $comments =   $currentGroup['comments'];
      $uploadsize = $currentGroup['uploadsize'];
      $editpho = $currentGroup['editpho'];
      $editposts = $currentGroup['editposts'];
      $modaccess = $currentGroup['modaccess'];
      $reqmod = $currentGroup['reqmod'];
      $highlite = $currentGroup['highlite'];
      $bold = $currentGroup['bold'];
      $italic = $currentGroup['italic'];
      $payment = $currentGroup['payment'];
      $uplimit = $currentGroup['uplimit'];
      $free = $currentGroup['free'];

      $query="INSERT INTO {$Globals['pp_db_prefix']}usergroups (groupid,groupname,modaccess,cpaccess,uploads,comments,uploadsize,editpho,editposts,reqmod,highlight,bold,italic,payment,uplimit,free) VALUES('$gid','$name','$modaccess','$cpaccess','$uploads','$comments','$uploadsize','$editpho','$editposts','$reqmod', $highlite, $bold, $italic, $payment, $uplimit, $free)";
      $setug = ppmysql_query($query,$link);
   }
}

function init_user_groups() {
    global $Globals, $pp_phrase, $link, $pp_db_prefix;

    $query = array();
    $query[] = "CREATE TABLE {$Globals['pp_db_prefix']}usergroups (groupid int(5) NOT NULL auto_increment,
                                                        groupname varchar(50) NOT NULL default '',
                                                        cpaccess smallint(3) NOT NULL default '0',
                                                        modaccess smallint(3) NOT NULL default '0',
                                                        uploads smallint(3) NOT NULL default '1',
                                                        comments smallint(3) NOT NULL default '1',
                                                        uploadsize int(10) default '0' NOT NULL,
                                                        editpho int(3) NOT NULL default '0',
                                                        editposts int(3) NOT NULL default '0',
                                                        reqmod INT(3) DEFAULT '0' NOT NULL,
                                                        highlight INT(3) DEFAULT '0' NOT NULL,
                                                        bold INT(3) DEFAULT '0' NOT NULL,
                                                        italic INT(3) DEFAULT '0' NOT NULL,
                                                        payment INT(3) DEFAULT '0' NOT NULL,
                                                        uplimit INT(3) DEFAULT '0' NOT NULL,
                                                        free INT(3) DEFAULT '0' NOT NULL,
                                                        PRIMARY KEY (groupid)) TYPE=MyISAM  ";
    $query[] = "INSERT INTO {$Globals['pp_db_prefix']}usergroups VALUES (1, 'Anonymous', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)";
    $query[] = "INSERT INTO {$Globals['pp_db_prefix']}usergroups VALUES (2, 'Admin', 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0)";
    $query[] = "INSERT INTO {$Globals['pp_db_prefix']}usergroups VALUES (3, 'Members', 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0)";

    for ( $x=0; $x < count($query); $x++) {
      $iquery = $query[$x];
      $setup = mysql_query($iquery, $link);
      if ( !$setup ) print "<b>Error: ".mysql_error()."</b><br />";
    }

}


function convert_markups($markup)
{
    global $Globals, $pp_phrase;

    return ( ppconvert_markups($markup) );   
}

function get_forum_style()
{
    global $Globals, $pp_phrase;
   
    return( "<link rel=\"stylesheet\" href=\"{$Globals['maindir']}/stylesheets/{$Globals['theme']}.css\" type=\"text/css\" />" );
}


//
// Style references
//

if ( $Globals['forumstyle'] == "yes" ) {
    $Style['onbody'] = "onbody";
    $Style['tableborders'] = "tableborders";
    $Style['tablesurround'] = "";
    $Style['tddetails'] = "tddetails";
    $Style['tdbackground'] = "tdbackground";
    $Style['tdnothumbs'] = "tdnothumbs";
    $Style['menubar'] = "menubar";
    $Style['menubarnb'] = "menubarnb";
    $Style['catcolumn'] = "catcolumn";
    $Style['photocol'] = "photocol";
    $Style['commentscol'] = "commentscol";
    $Style['lastphocol'] = "lastphocol";
    $Style['lastcommcol'] = "lastcommcol";
    $Style['small'] = "small";
    $Style['medium'] = "medium";
    $Style['large'] = "large";
    $Style['welcome'] = "welcome";
    $Style['lighttable'] = "lighttable";
    $Style['alternatetable'] = "alternatetable";
    $Style['formboxes'] = "formboxes";
    $Style['blockquote'] = "blockquote";
}

?>
 
View user's profile Send private message
Palbin
Site Admin



Joined: Mar 30, 2006
Posts: 2583
Location: Pittsburgh, Pennsylvania

PostPosted: Sun Jun 14, 2009 8:41 am Reply with quote

Code:


//
// Increment or decrement the user post in the users database
//

function inc_user_posts( $type = "plus", $userid = 0 ) {
   global $Globals, $pp_phrase, $db_link, $User;

   if ( $userid == 0 ) {
      $usernum = $User['userid'];
   } else {
      else $usernum = $userid;
   }

   if ( $type == "plus" ) {
      $do_inc = "+1";

//give user point for there add
      $rpoints = 5;
      $query = 'UPDATE {$Globals["dprefix"]}users SET points=points+' . $rpoints . ' WHERE user_id="' . $usernum . '"';
      $result = ppmysql_query($query,$db_link);
//end
   } else {
      $do_inc = "-1";
   }

   $query = "UPDATE {$Globals['dprefix']}users SET user_posts=user_posts$do_inc WHERE user_id='$usernum'";
   $resulta = ppmysql_query($query,$db_link);

   return;
}


Try this, but I give zero guarantees that it works Wink.

Just set $rpoints = 5; to however many points you want to give them. If you want to get brave you can try adding a a row in the data base so it shows up under points management. Then you would have to query the correct amount in the function above to insert it.

_________________
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan. 
View user's profile Send private message
draxx







PostPosted: Mon Jun 15, 2009 12:53 am Reply with quote

Well that dident work - BUT with your suggestion I was able to figure it out and make it work Smile Thank you Palbin!

The proper code was this:

//give user point for there add
$rpoints = "+2";
$query = "UPDATE {$Globals['dprefix']}users SET points=points$rpoints WHERE user_id='$usernum'";

$result = ppmysql_query($query,$db_link);
//end

$query = "UPDATE {$Globals['dprefix']}users SET user_posts=user_posts$do_inc WHERE user_id='$usernum'";
$resulta = ppmysql_query($query,$db_link);
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Converting/Creating Modules

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©