Remove points from SQL when page is viewed.

  Post new topicReply to topicPrintable Version
<< View previous topic View next topic >>
Share: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
#1   Remove points from SQL when page is viewed.
ADF-Sniper
CZ Newbie
 Codezwiz Site Donator
ADF-Sniper has been a member for over 19 year's 19 Year Member
australia.gif
Age: 45
Gender: Male
Website:
Status: Offline
Joined: Jun 30, 2005
0.00 posts per day
Posts: 8
Points: 600
   
Hi all,

I'm just after some help with phpnuke's SQL database. What I'm trying to do is remove 1000 points from the user that is logged in when they visit a php page. The problem being is I need someones help with the code to Update the table.

Thanks in advance

Nath



Back to top Reply with quote
#2   re: Remove points from SQL when page is viewed.
floppydrivez
CZ Addict
 Codezwiz Site Donator
floppydrivez has been a member for over 18 year's 18 Year Member
usa.gif mississippi.gif
Occupation: graphic design
Age: 43
Gender: Male
Website:
Status: Offline
Joined: Feb 26, 2006
0.08 posts per day
Posts: 518
Points: 4,848
AIM Address Yahoo Messenger MSN Messenger 
do want to do this for everyone or just one person?



Back to top Reply with quote
#3   re: Remove points from SQL when page is viewed.
ADF-Sniper
CZ Newbie
 Codezwiz Site Donator
ADF-Sniper has been a member for over 19 year's 19 Year Member
australia.gif
Age: 45
Gender: Male
Website:
Status: Offline
Joined: Jun 30, 2005
0.00 posts per day
Posts: 8
Points: 600
   
For anyone who visits the page... They loose there points.



Back to top Reply with quote
#4   re: Remove points from SQL when page is viewed.
floppydrivez
CZ Addict
 Codezwiz Site Donator
floppydrivez has been a member for over 18 year's 18 Year Member
usa.gif mississippi.gif
Occupation: graphic design
Age: 43
Gender: Male
Website:
Status: Offline
Joined: Feb 26, 2006
0.08 posts per day
Posts: 518
Points: 4,848
AIM Address Yahoo Messenger MSN Messenger 
Hmm.. I am gonna need a link to that page to even begin to understand the problem.



Back to top Reply with quote
#5   re: Remove points from SQL when page is viewed.
ADF-Sniper
CZ Newbie
 Codezwiz Site Donator
ADF-Sniper has been a member for over 19 year's 19 Year Member
australia.gif
Age: 45
Gender: Male
Website:
Status: Offline
Joined: Jun 30, 2005
0.00 posts per day
Posts: 8
Points: 600
   
Ok all I need is a sql command that updates the users points and takes 1000 off them. So if they view the page it will cost them 1000 points. Its too complicated if I show you.. as it works with a dedicated server and a VB program.

Its a simple command I just dont know how to talk to a SQL server.



Back to top Reply with quote
#6   re: Remove points from SQL when page is viewed.
floppydrivez
CZ Addict
 Codezwiz Site Donator
floppydrivez has been a member for over 18 year's 18 Year Member
usa.gif mississippi.gif
Occupation: graphic design
Age: 43
Gender: Male
Website:
Status: Offline
Joined: Feb 26, 2006
0.08 posts per day
Posts: 518
Points: 4,848
AIM Address Yahoo Messenger MSN Messenger 
Here is a few short tutorials that may help you understand how to communicate with you db. [ Register or login to view links on this board. ]

I see what your trying to accomplish. Lets call it a penalty.

I need to do some research in where user points are contained and I will try to come up with something.



Back to top Reply with quote
#7   re: Remove points from SQL when page is viewed.
ADF-Sniper
CZ Newbie
 Codezwiz Site Donator
ADF-Sniper has been a member for over 19 year's 19 Year Member
australia.gif
Age: 45
Gender: Male
Website:
Status: Offline
Joined: Jun 30, 2005
0.00 posts per day
Posts: 8
Points: 600
   
Like so....

UPDATE nuke_users SET user='2' WHERE points='-1000'

Something like that...



Back to top Reply with quote
#8   Re: re: Remove points from SQL when page is viewed.
floppydrivez
CZ Addict
 Codezwiz Site Donator
floppydrivez has been a member for over 18 year's 18 Year Member
usa.gif mississippi.gif
Occupation: graphic design
Age: 43
Gender: Male
Website:
Status: Offline
Joined: Feb 26, 2006
0.08 posts per day
Posts: 518
Points: 4,848
AIM Address Yahoo Messenger MSN Messenger 


Originally posted by ADF-Sniper @ Fri Dec 08, 2006 6:56 am:

Like so....

UPDATE nuke_users SET user='2' WHERE points='-1000'

Something like that...


Actually on the page, you wanted to be the penalty you would add.

Assuming this is a page on the site.

UPDATE ".$prefix."_users SET points = '$points-1000' WHERE username = '$username'


As you can see I am using pre-defined strings $points and $username. These need to be defined above this statement. Most likely by pulling them from the database just above this line.

Sorry if I am confusing.


Back to top Reply with quote
#9   re: Remove points from SQL when page is viewed.
ADF-Sniper
CZ Newbie
 Codezwiz Site Donator
ADF-Sniper has been a member for over 19 year's 19 Year Member
australia.gif
Age: 45
Gender: Male
Website:
Status: Offline
Joined: Jun 30, 2005
0.00 posts per day
Posts: 8
Points: 600
   
Thanks for your reply icon_smile.gif

Im at work atm so its a bit hard to play if you know what I mean.. but as soon as I get home... 8 Hours from now ill let you know how it goes.

I run a dedicated game server and for a map to change they will need to spend 1000 points. Thats what im working on at the moment icon_biggrin.gif

Regards
Nath



Back to top Reply with quote
#10   re: Remove points from SQL when page is viewed.
ADF-Sniper
CZ Newbie
 Codezwiz Site Donator
ADF-Sniper has been a member for over 19 year's 19 Year Member
australia.gif
Age: 45
Gender: Male
Website:
Status: Offline
Joined: Jun 30, 2005
0.00 posts per day
Posts: 8
Points: 600
   
Spent a few hours on this and have no luck at all icon_sad.gif

<html>
<head>
<title>Map Request</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="/styles.css" type="text/css">
<meta name="description" content="PHP Support Ticket System">
<meta name="abstract" content="Support Ticket System">
<meta name="keywords" content="Support Ticket System,PHP,Support Ticket,Custom PHP Scripts,Suppport,Tickett,Support system">
<meta http-equiv="Content-Language" content="EN">
<meta name="author" content="Cross Walk Central">
<meta name="distribution" content="Global">
<meta name="copyright" content="©Cross Walk Central">
<meta name="robots" content="FOLLOW,INDEX">
</head>
<?php
/************************************************************************/
/*                                                                      */
/* Copyright (c) 2001-2002 by CrossWalkCentral                          */
/* http://www.crosswalkcentral.net                                      */
/*                                                                      */
/* CrossWalkCentral                                                     */
/* You Web Hosting Community!                                           */
/*                                                                      */
/* Let us customize this script for you.                                */
/*                                                                      */
/* Please let us know what you think of the Support Ticket System     */
/* at http://www.crosswalkcentral.net/modules.php?name=Forum            */
/*                           */
/* This program is free software.               */
/*                            */
/* DOWNLOAD SUPPORT TICKET SYSTEM PRO FOR 20USD AT         */
/*         HTTP://WWW.CROSSWALKCENTRAL.NET         */
/*                           */
/************************************************************************/

if (!eregi("modules.php", $PHP_SELF)) {
    die ("You can't access this file directly...");
}

include("header.php");
include("config.php");
         //CUSTOM ACCESS BY POINTS - MJ HUFFORD - [ Register or login to view links on this board. ]
   global $userinfo;
customized_access_points($userinfo['points'], 1000);  //WHERE 1000 = MIN POINTS TO ACCESS MODULE
   
// Some definitions
global $user, $db, $cookie, $prefix, $anonymous, $dbi, $user_prefix, $points ,$username, $stop, $module_name, $redirect, $mode, $t, $f, $admin, $userinfo, $nukeurl, $startdate;

$db->sql_query("UPDATE ".$prefix."_users SET points = '$points-1000' WHERE username = '$username'");


    $content = "";
getusrinfo($user);
cookiedecode( $user );
$ip = getenv( "REMOTE_ADDR" );
$username = $cookie[1];
if ( !isset( $username ) )
{
   $username = "$ip";
   $guest = 1;
}



?>

<h3 align="center"><b><font face="Garamond">Map Request</font></b></h3>
<FORM ACTION = "modules.php??op=modload&name=mapreq&file=supportsys" METHOD = "POST">
        <table width="95%" border="0" cellspacing="0" cellpadding="0" align="center">
          <tr>
            <td width="30%">Email Address:</td>
            <td width="74%">
              <input type="text" name="custemail" maxlength="55" size ="46">
            </td>
          </tr>
          <tr>
            <td width="30%">First Name:</td>
            <td width="74%">
              <input type="text" name="custfname" size="46" maxlength="55">
            </td>
          </tr>
          <tr>
            <td width="30%">Last Name:</td>
            <td width="74%">
              <input type="text" name="custlname" size="46" maxlength="55">
            </td>
          </tr>
          <tr>

      <td width="30%">Map:</td>
            <td width="74%">
              <div align="left">
                <select name="custcatergory" size="1">
                  <option>Bridge</option>
                  <option>Pipeline</option>
                  <option>Dusk</option>
                  <option>Insurgent Camp</option>
                </select>
              </div>
            </td>
          </tr>
          <tr>
            <td width="30%">Reason for map change?:</td>
            <td width="74%">
              <textarea name="custpdes" cols="50%" rows="6"></textarea>
            </td>
          </tr>
          <tr>
            <td width="30%"></td>
            <td width="74%">
              <input type="submit" name="Submit" value="Submit">
            </td>
          </tr>
        </table>
  <p>&nbsp;</p></form>
<?php
include ('footer.php');
?>
</body>
</html>



I have also tried this
<?php

include("mainfile.php");
$points = "50";
$db->sql_query(" UPDATE ".$prefix."_users SET points = '$points' WHERE username = '$username'");

echo "DONE"
?>



Back to top Reply with quote
Display posts from previous:      
Add To: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
<< View previous topic View next topic >>
Post new topicReply to topic

Jump to 
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 cannot attach files in this forum
You cannot download files in this forum