MPOG gift script [Web Coders ! XD ]

Junior Spellweaver
Joined
Jul 22, 2007
Messages
135
Reaction score
0
Hello Guys =]

need you with this script , its MPOG Coins Gift Script
when some one gift a coins for example, 1 user have 20 coins
and he want to gift 10 to his friend.. it sends the coins but the 1st user still have the 20 coins and the 2nd user got 10 coins, i mean that the sender dont lose coins and the receiver gets the coins

here's the script

Code:
<?
if($_SESSION['AID'] == ""){
    msgbox("Please login first.","index.php?do=login");
exit();
}
?>
<?php
if (isset($_POST['submit']))
{
    if ($_POST['UserID'] == "")
    {
        msgbox ("Please enter a UserID.","index.php?do=gift");
    }
    
    if ($_POST['IGCoins'] == "")
    {
        msgbox ("Please enter a IG Coins Number.","index.php?do=gift");
    }
    
    $ip = ''.($_SERVER['REMOTE_ADDR']);
    $userid = ($_POST['UserID']);
    $dgcoins = ($_POST['DGCoins']);
/////////////////////////////////////////////////////
// Insuficent Coins.
$res2 = mssql_query("SELECT euCoins FROM Login WHERE AID = '".$_SESSION['AID']."'");
$acc = mssql_fetch_assoc($res2);
$result = $acc['euCoins']-$item['CashPrice'];
if($result < $dgcoins){
msgbox ("Insufficent IG Coins","index.php?do=gift");
exit();
}
// Insuficent Coins END.
////////////////////////////////////////////////////
    $result1 = mssql_query("SELECT euCoins FROM Login WHERE UserID = '$useridby'");
    $result2 = mssql_query("SELECT euCoins FROM Login WHERE UserID = '$userid'");
if (mssql_num_rows($result2) == 0)
{
msgbox ("Error, UserID not found.","index.php?do=gift");
return;
}
    
    $row1 = mssql_fetch_assoc($result1);
    $row2 = mssql_fetch_assoc($result2);
    
    $coins1 = $row1['euCoins'];
    $coins2 = $row2['euCoins'];
    
    //if ($coins1 < $dgcoins)
    //{
    //    return;
    //}
    $coins1 -= $dgcoins;
    $coins2 += $dgcoins;
    
    mssql_query("UPDATE [Login] SET [euCoins] = $coins1 WHERE UserID = '$useridby'");
    mssql_query("UPDATE [Login] SET [euCoins] = $coins2 WHERE UserID = '$userid'");
    done();
}
else gift();
?>
<?php
function gift()
{
?>
<form name="reg" method="POST" action="index.php?do=gift">
<style type="text/css">
<!--
.style1 {color: #FF0000}
-->
</style>
<body bgcolor="#323232">
                    <div align="center">
                        <table border="0" width="456" style="border-collapse: collapse">
                            <tr>
                                <td background="images/cont_up.png"> </td>
                            </tr>
                            <tr>
                                <td background="images/cont_bg.png">
                                <div align="center">
                                    <table border="0" style="border-collapse: collapse" width="454" height="100%">
                                        <tr>
                                            <td width="3" rowspan="8"> </td>
                                            <td colspan="2">
                                            <img border="0" src="images/inf/gift.jpg" width="413" height="18"></td>
                                            <td width="17"> </td>
                                        </tr>
                                        <tr>
                                          <td colspan="2"><font size="1" color="#4D4D4D">The fields marked with an * are required</font> </td>
                                          <td> </td>
                                      </tr>
                                        <tr>
                                          <td colspan="2"> </td>
                                          <td> </td>
                                      </tr>
                                        <tr>
                                          <td width="162">·<span lang="es"> User ID<font color="#FF9933">*</font></span></td>
                                          <td width="254"><input type="text" name="UserID" id="UserID"></td>
                                          <td> </td>
                                      </tr>
                                        <tr>
                                          <td>·<span lang="es"> IG Coins<font color="#FF9933">*</font></span></td>
                                          <td><input type="text" name="IGCoins" id="IGCoins"></td>
                                          <td> </td>
                                      </tr>
                                        <tr>
                                          <td colspan="3"><div align="center">
                                            <form name="form1" method="post" action="">
                                              <label>
                                              <input type="submit" name="submit" id="submit" value="Gift">
                                              </label>
                                            </form>
                                            </div></td>
                                      </tr>
                                    </table>
                                </div>
                                </td>
                            </tr>
                            <tr>
                                <td background="images/cont_top.png" height="27"> </td>
                            </tr>
                        </table>
                    </div></form>
<?php
}
?>
<?php
function done()
{
$userid = ($_POST['UserID']);
$dgcoins = ($_POST['DGCoins']);
$useridby = $_SESSION['UserID'];
?>
<div align="center">
                        <table border="0" width="456" style="border-collapse: collapse">
                            <tr>
                                <td background="images/cont_up.png"> </td>
                            </tr>
                            <tr>
                                <td background="images/cont_bg.png">
                                <div align="center">
                                    <table border="0" style="border-collapse: collapse" width="454" height="100%">
                                        <tr>
                                            <td width="3" rowspan="6"> </td>
                                            <td colspan="2">
                                            <img border="0" src="images/inf/gift.jpg" width="413" height="18"></td>
                                            <td width="17"> </td>
                                        </tr>
                                        <tr>
                                          <td colspan="2"> </td>
                                          <td> </td>
                                      </tr>
                                        <tr>
                                          <td colspan="2">Thank you <?=$useridby?>, <?=$dgcoins?> IsraelGamerZ Coins has been sent to <?=$userid?> . </td>
                                          <td> </td>
                                      </tr>
                                        
                                        <tr>
                                          <td colspan="3"><div align="center">
                                            </div></td>
                                      </tr>
                                    </table>
                                </div>
                                </td>
                            </tr>
                            <tr>
                                <td background="images/cont_top.png" height="27"> </td>
                            </tr>
                        </table>
                    </div>
<?php
}
?>

tell me what's wrong and what i have to add or remove plzz
i need it guys ! XD

Ty:):
 
Think the queries must be like this ;

Code:
mssql_query("UPDATE [Login] SET [euCoins] = $coins1-$item['CashPrice']; WHERE UserID = '$useridby'");
mssql_query("UPDATE [Login] SET [euCoins] = $coins2+$item['CashPrice'] WHERE UserID = '$userid'");

Or Swap them ><..
 
Upvote 0
didnt worked =[

look what happend
Code:
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in D:\AppServ\www\mod_gift.php on line 59
 
Upvote 0
My Bad, Cant script 'Blind',,

look for some parses on google or so,, But it got to be like that xD.
Hope i helped u a bit.
 
Upvote 0
Think the queries must be like this ;

Code:
mssql_query("UPDATE [Login] SET [euCoins] = $coins1-$item['CashPrice']; WHERE UserID = '$useridby'");
mssql_query("UPDATE [Login] SET [euCoins] = $coins2+$item['CashPrice'] WHERE UserID = '$userid'");
Or Swap them ><..

PHP:
mssql_query("UPDATE Login SET euCoins = $coins1 - $item[CashPrice] WHERE UserID = '$useridby'");
mssql_query("UPDATE Login SET euCoins = $coins2 + $item[CashPrice] WHERE UserID = '$userid'");

Remove Master PHP from your signature. You don't even know basic PHP chapter 4.
 
Upvote 0
Maybe,, Forgot 4 spaces.. and query strings can be on serval ways, Just every PHP scripter got his own ways..
Even though, settings can make alot of diffrence.. which i had diffrent then standard (WAMP) server settings.

PHP Scripters just discuss alot, cause they have their own way.. specialy the PHP5 scripters & other PHP scripters.

In my opinion, leave my sig like i want.
 
Upvote 0
WizKid =[ didnt worked also this ... damn
here's what happend

Code:
Warning: mssql_query() [function.mssql-query]: message: Incorrect syntax near the keyword 'WHERE'. (severity 15) in D:\AppServ\www\mod_gift.php on line 55

Warning: mssql_query() [function.mssql-query]: Query failed in D:\AppServ\www\mod_gift.php on line 55

Warning: mssql_query() [function.mssql-query]: message: Incorrect syntax near the keyword 'WHERE'. (severity 15) in D:\AppServ\www\mod_gift.php on line 56

Warning: mssql_query() [function.mssql-query]: Query failed in D:\AppServ\www\mod_gift.php on line 56
 
Upvote 0
WizKid =[ didnt worked also this ... damn
here's what happend

Code:
Warning: mssql_query() [function.mssql-query]: message: Incorrect syntax near the keyword 'WHERE'. (severity 15) in D:\AppServ\www\mod_gift.php on line 55

Warning: mssql_query() [function.mssql-query]: Query failed in D:\AppServ\www\mod_gift.php on line 55

Warning: mssql_query() [function.mssql-query]: message: Incorrect syntax near the keyword 'WHERE'. (severity 15) in D:\AppServ\www\mod_gift.php on line 56

Warning: mssql_query() [function.mssql-query]: Query failed in D:\AppServ\www\mod_gift.php on line 56

Be sure you have the right tables.

Maybe,, Forgot 4 spaces.. and query strings can be on serval ways, Just every PHP scripter got his own ways..
Even though, settings can make alot of diffrence.. which i had diffrent then standard (WAMP) server settings.

PHP Scripters just discuss alot, cause they have their own way.. specialy the PHP5 scripters & other PHP scripters.

In my opinion, leave my sig like i want.

That's not the point. The point is your query's won't ever work. If you can't make decent query's...
 
Upvote 0
Back