Jump to content
MakeWebGames

Recommended Posts

Posted

hi, im kinda confused, can anyone help me on how to fill this in please?

 

<?php
session_start();


//Include your mysql connection here
//your database variables


$playertable = "users";
$rewardtype = "money";
$reward = "100";
/////////////////////////

$userid = mysql_real_escape_string($_POST['user']);
$userinfo=mysql_query("SELECT * FROM $playertable WHERE userid=$userid",$c) or die(mysql_error());
if(!mysql_num_rows($userinfo))
{
exit; 
}

$q=mysql_query("SELECT * FROM votes WHERE userid=$userid AND list='GB'",$c);
if(mysql_num_rows($q))
{

}
else
{
mysql_query("INSERT INTO votes values ($userid,'GB')",$c);
mysql_query("UPDATE $playertable SET $rewardtype=$rewardtype+$reward WHERE userid=$userid",$c);
}
?>

 

i got this code from a voting site called Gamingbytes, and im wondering how do i fill it in and what should i call the file? can anyone help me please?

Posted

Re: can anyone help me on this please?

You will want just the connection. Add this code:

 

include_once("config.php");
include_once("class/class_db_".$_CONFIG['driver'].".php");
$db = new database;
$db->configure($_CONFIG['hostname'],$_CONFIG['username'],$_CONFIG['password'],$_CONFIG['database'],$_CONFIG['persistent']);
$db->connect();
Posted

Re: can anyone help me on this please?

so like this? and it should work and give out a reward for voting?

 

<?php
session_start();


include_once("config.php");
include_once("class/class_db_".$_CONFIG['driver'].".php");
$db = new database;
$db->configure($_CONFIG['hostname'],$_CONFIG['username'],$_CONFIG['password'],$_CONFIG['database'],$_CONFIG['persistent']);
$db->connect();


$playertable = "users";
$rewardtype = "money";
$reward = "100";
/////////////////////////

$userid = mysql_real_escape_string($_POST['user']);
$userinfo=mysql_query("SELECT * FROM $playertable WHERE userid=$userid",$c) or die(mysql_error());
if(!mysql_num_rows($userinfo))
{
exit; 
}

$q=mysql_query("SELECT * FROM votes WHERE userid=$userid AND list='GB'",$c);
if(mysql_num_rows($q))
{

}
else
{
mysql_query("INSERT INTO votes values ($userid,'GB')",$c);
mysql_query("UPDATE $playertable SET $rewardtype=$rewardtype+$reward WHERE userid=$userid",$c);
}
?>

 

and yes i am using v2

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.   Paste as plain text instead

  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...