...

View Full Version : Paypal script help



RawliJr
07-05-2006, 06:06 PM
<?
function paypal($price,$credits,$custom)
{
global $GAMENAME, $DOMAIN;
?>
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="custom" value="<?=$custom?>">
<input type="hidden" name="business" value="rawlijr@hotmail.com">
<input type="hidden" name="item_name" value="<?=$credits?> <?=$GAMENAME?> credits for user <?=$custom?>">

<input type="hidden" name="amount" value="<?=$price?>">
<input type="hidden" name="no_shipping" value="1">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="notify_url" value="http://<?=$DOMAIN?>/ipn.php">
<input type="hidden" name="return" value="http://<?=$DOMAIN?>/myaccount.php">
<input type="hidden" name="cancel_return" value="http://<?=$DOMAIN?>/myaccount.php">
<input type="submit" class="text" border="0" class="button" name="submit" value="purchase">
<?if ($action==purchase) {
?>
<table>
<tr>
<td>
<br><b>How many credits do i buy?</b>
<br><font color="#770000">Well that all depends on how you look at it. Each round you can only transfer up to so many credits not including name changes or attack resets. The more credits you purchase, the more credits your going to get for your money. If you have extra credits, its alright because you can save them for another round. </font> <small><font color="#cc0000">e-checks take 3-5 days to process!</font></small>
<br>
</td>
</tr>
</table>

<br>


<table cellspacing="1" width="100%">
<tr>
<td><small>price</small></td>
<td><small>credits</small></td>
<td width="100" align="center"><small>purchase</small></td>
</tr>
<tr bgcolor="#bb915e">
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<td>$20.00</td>
<td>7,500</td>
<td align="center">
<?=paypal(20.00,'7,500',$custom)?>
</td>
</form>
</tr>
<tr bgcolor="#b18044">
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<td>$12.50</td>
<td>5,000</td>
<td align="center">
<?=paypal(12.50,'5,000',$custom)?>
</td>
</form>
</tr>
<tr bgcolor="#bb915e">
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<td>$10.00</td>
<td>2,800</td>
<td align="center">
<?=paypal(10.00,'2,800',$custom)?>
</td>
</form>
</tr>
<tr bgcolor="#b18044">
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<td>$7.50</td>
<td>1,200</td>
<td align="center">
<?=paypal(7.50,'1,200',$custom)?>
</td>
</form>
</tr>
</table>
<br><br><small><b>Purchasing credits for a friend?</b><br>
After the credits are added to your account, you may transfer them to other players.<br>
You'll need to know the accounts email address to identify them.</small><br><br>
<table width="98%">
<?} else {
?>
<tr>
<td>
<?if ($action==transfer) {
?>
<br>
<form method="post" action="credits.php?action=transfer">
<table align="center" cellspacing="1" cellpadding="4">
<tr>
<td align='center'><b>Transfer your credits as reserves.</b></td>
</tr>
<tr>
<td align="center">
<select name="round" class="text"><option value="">Select from your current rounds...</option>
</select>
</td>
</tr>
<tr>
<td align="center">
add <input type="text" class="text" size="5" name="transfer"> credits to this round. <input type="submit" class="submit" value="transfer">
</td>
</tr>
</table>
</form>
<br><b>What are credits?</b>
<br><font color="#770000">Credits are kinda like turns/reserves except you can do more with credits like change your pimp name during game play, or reseting your attacks. Once you purchase credits, your account status changes to supporter. Having a supporters account unlocks more features for you in the game, you can read below to see the listed features for supporters.</font>
<br>
<br>
<br>&nbsp;
<b>What would you like to do?</b>
<br>&bull;
<a href="?action=purchase"><b>Purchase credits with paypal</b></a>
<br>&bull;
<a href="?action=transfer"><b>Transfer credits as reserves to my rounds</b></a>
<br>&bull;
<a href="?action=send"><b>Transfer credits to another player</b></a>
<br>&bull;
<strike><a href="?action=pimpname">Change my character name</b></a></strike>
<br>&bull;
<strike><a href="?action=attackout">Reset your attacks out</b></a></strike>
<br>
<br>
<br><b>Supporter status?</b>
<br><font color="#770000">Having supporters status unlocks more features and limits in <?=$GAMENAME?>. By becoming a supporter, you are not only paying for great entertainment, you are helping pay for the games server, the resources it uses and to keep the programers alive as we work on our games for a living.</font>
<br>
<br>
<br><b>Supporter Features</font></b>
<br>&bull;
<font color="#770000">game autosets the amount of turns you use when exploring so you dont have to keep typing in the amount of turns you want every time you use scout, produce and discipline.</font>
<br>&bull;
<font color="#770000">use macromedia flash for your profile and crew profile media.</font>
<br>&bull;
<font color="#770000">crew icons upload limit goes to 5000 bytes.</font>
<br>&bull;
<font color="#770000">change pimp name during game play.</font>
<br>&bull;
<font color="#770000">reset your attacks out.</font>
<br>&bull;
<font color="#770000">and more...</font>
<br>
<br>
</td>
</tr>
</table>
<?
}
?>

that script outputs Parse error: syntax error, unexpected $end in /home/thugki/public_html/credits.php on line 147

and i honestly cant find it ....or fix it can i have some help plzz?

Cheers
Rawlijr:thumbsup:

fci
07-05-2006, 06:45 PM
is that all the code? it looks like you need 2 curly braces at the end of it.

RawliJr
07-05-2006, 07:24 PM
<?
}
}
?>


so the end of the script it would be that?

and with that a error comes

Parse error: syntax error, unexpected $end in /home/thugki/public_html/credits.php on line 151

fci
07-05-2006, 07:28 PM
this is what the last 10 lines should look like:


<br>
</td>
</tr>
</table>
<?
}
}
}

?>

RawliJr
07-05-2006, 07:33 PM
ok i got that thanx, but it still puts this dang error?


Parse error: syntax error, unexpected $end in /home/thugki/public_html/credits.php on line 153

fci
07-05-2006, 07:38 PM
why don't you copy paste your updated code since what I suggested is correct.
you also should be doing $action=='purchase' instead of $action==purchase

RawliJr
07-05-2006, 07:41 PM
here is the new code



<?
function paypal($price,$credits,$custom)
{
global $GAMENAME, $DOMAIN;
?>
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="custom" value="<?=$custom?>">
<input type="hidden" name="business" value="rawlijr@hotmail.com">
<input type="hidden" name="item_name" value="<?=$credits?> <?=$GAMENAME?> credits for user <?=$custom?>">

<input type="hidden" name="amount" value="<?=$price?>">
<input type="hidden" name="no_shipping" value="1">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="notify_url" value="http://<?=$DOMAIN?>/ipn.php">
<input type="hidden" name="return" value="http://<?=$DOMAIN?>/myaccount.php">
<input type="hidden" name="cancel_return" value="http://<?=$DOMAIN?>/myaccount.php">
<input type="submit" class="text" border="0" class="button" name="submit" value="purchase">
<?if ($action=='purchase') {
?>
<table>
<tr>
<td>
<br><b>How many credits do i buy?</b>
<br><font color="#770000">Well that all depends on how you look at it. Each round you can only transfer up to so many credits not including name changes or attack resets. The more credits you purchase, the more credits your going to get for your money. If you have extra credits, its alright because you can save them for another round. </font> <small><font color="#cc0000">e-checks take 3-5 days to process!</font></small>
<br>
</td>
</tr>
</table>

<br>


<table cellspacing="1" width="100%">
<tr>
<td><small>price</small></td>
<td><small>credits</small></td>
<td width="100" align="center"><small>purchase</small></td>
</tr>
<tr bgcolor="#bb915e">
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<td>$20.00</td>
<td>7,500</td>
<td align="center">
<?=paypal(20.00,'7,500',$custom)?>
</td>
</form>
</tr>
<tr bgcolor="#b18044">
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<td>$12.50</td>
<td>5,000</td>
<td align="center">
<?=paypal(12.50,'5,000',$custom)?>
</td>
</form>
</tr>
<tr bgcolor="#bb915e">
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<td>$10.00</td>
<td>2,800</td>
<td align="center">
<?=paypal(10.00,'2,800',$custom)?>
</td>
</form>
</tr>
<tr bgcolor="#b18044">
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<td>$7.50</td>
<td>1,200</td>
<td align="center">
<?=paypal(7.50,'1,200',$custom)?>
</td>
</form>
</tr>
</table>

<br><br><small><b>Purchasing credits for a friend?</b><br>
After the credits are added to your account, you may transfer them to other players.<br>
You'll need to know the accounts email address to identify them.</small><br><br>
<table width="98%">
<?
{
?>
<tr>
<td>
<?if ($action=='transfer') {
?>
<br>
<form method="post" action="credits.php?action=transfer">
<table align="center" cellspacing="1" cellpadding="4">
<tr>
<td align='center'><b>Transfer your credits as reserves.</b></td>
</tr>
<tr>
<td align="center">
<select name="round" class="text"><option value="">Select from your current rounds...</option>
</select>
</td>
</tr>
<tr>
<td align="center">
add <input type="text" class="text" size="5" name="transfer"> credits to this round. <input type="submit" class="submit" value="transfer">
</td>
</tr>
</table>
</form>
<br><b>What are credits?</b>
<br><font color="#770000">Credits are kinda like turns/reserves except you can do more with credits like change your pimp name during game play, or reseting your attacks. Once you purchase credits, your account status changes to supporter. Having a supporters account unlocks more features for you in the game, you can read below to see the listed features for supporters.</font>
<br>
<br>
<br>&nbsp;
<b>What would you like to do?</b>
<br>&bull;
<a href="?action=purchase"><b>Purchase credits with paypal</b></a>
<br>&bull;
<a href="?action=transfer"><b>Transfer credits as reserves to my rounds</b></a>
<br>&bull;
<a href="?action=send"><b>Transfer credits to another player</b></a>
<br>&bull;
<strike><a href="?action=pimpname">Change my character name</b></a></strike>
<br>&bull;
<strike><a href="?action=attackout">Reset your attacks out</b></a></strike>
<br>
<br>
<br><b>Supporter status?</b>
<br><font color="#770000">Having supporters status unlocks more features and limits in <?=$GAMENAME?>. By becoming a supporter, you are not only paying for great entertainment, you are helping pay for the games server, the resources it uses and to keep the programers alive as we work on our games for a living.</font>
<br>
<br>
<br><b>Supporter Features</font></b>
<br>&bull;
<font color="#770000">game autosets the amount of turns you use when exploring so you dont have to keep typing in the amount of turns you want every time you use scout, produce and discipline.</font>
<br>&bull;
<font color="#770000">use macromedia flash for your profile and crew profile media.</font>
<br>&bull;
<font color="#770000">crew icons upload limit goes to 5000 bytes.</font>
<br>&bull;
<font color="#770000">change pimp name during game play.</font>
<br>&bull;
<font color="#770000">reset your attacks out.</font>
<br>&bull;
<font color="#770000">and more...</font>
<br>
<br>
</td>
</tr>
</table>
<?
}
}
}

?>


and that does

Parse error: syntax error, unexpected $end in /home/thugki/public_html/credits.php on line 153

Lordrea
07-05-2006, 08:26 PM
Try:

<?
function paypal($price,$credits,$custom)
{
global $GAMENAME, $DOMAIN;
?>
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="custom" value="<?=$custom?>">
<input type="hidden" name="business" value="rawlijr@hotmail.com">
<input type="hidden" name="item_name" value="<?=$credits?> <?=$GAMENAME?> credits for user <?=$custom?>">

<input type="hidden" name="amount" value="<?=$price?>">
<input type="hidden" name="no_shipping" value="1">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="notify_url" value="http://<?=$DOMAIN?>/ipn.php">
<input type="hidden" name="return" value="http://<?=$DOMAIN?>/myaccount.php">
<input type="hidden" name="cancel_return" value="http://<?=$DOMAIN?>/myaccount.php">
<input type="submit" class="text" border="0" class="button" name="submit" value="purchase">
<? if ($action=='purchase') {
?>
<table>
<tr>
<td>
<br><b>How many credits do i buy?</b>
<br><font color="#770000">Well that all depends on how you look at it. Each round you can only transfer up to so many credits not including name changes or attack resets. The more credits you purchase, the more credits your going to get for your money. If you have extra credits, its alright because you can save them for another round. </font> <small><font color="#cc0000">e-checks take 3-5 days to process!</font></small>
<br>
</td>
</tr>
</table>

<br>


<table cellspacing="1" width="100%">
<tr>
<td><small>price</small></td>
<td><small>credits</small></td>
<td width="100" align="center"><small>purchase</small></td>
</tr>
<tr bgcolor="#bb915e">
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<td>$20.00</td>
<td>7,500</td>
<td align="center">
<?= paypal(20.00,'7,500',$custom) ?>
</td>
</form>
</tr>
<tr bgcolor="#b18044">
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<td>$12.50</td>
<td>5,000</td>
<td align="center">
<?=paypal(12.50,'5,000',$custom)?>
</td>
</form>
</tr>
<tr bgcolor="#bb915e">
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<td>$10.00</td>
<td>2,800</td>
<td align="center">
<?=paypal(10.00,'2,800',$custom)?>
</td>
</form>
</tr>
<tr bgcolor="#b18044">
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<td>$7.50</td>
<td>1,200</td>
<td align="center">
<?=paypal(7.50,'1,200',$custom)?>
</td>
</form>
</tr>
</table>

<br><br><small><b>Purchasing credits for a friend?</b><br>
After the credits are added to your account, you may transfer them to other players.<br>
You'll need to know the accounts email address to identify them.</small><br><br>
<table width="98%">
<?
{
?>
<tr>
<td>
<?if ($action=='transfer') {
?>
<br>
<form method="post" action="credits.php?action=transfer">
<table align="center" cellspacing="1" cellpadding="4">
<tr>
<td align='center'><b>Transfer your credits as reserves.</b></td>
</tr>
<tr>
<td align="center">
<select name="round" class="text"><option value="">Select from your current rounds...</option>
</select>
</td>
</tr>
<tr>
<td align="center">
add <input type="text" class="text" size="5" name="transfer"> credits to this round. <input type="submit" class="submit" value="transfer">
</td>
</tr>
</table>
</form>
<br><b>What are credits?</b>
<br><font color="#770000">Credits are kinda like turns/reserves except you can do more with credits like change your pimp name during game play, or reseting your attacks. Once you purchase credits, your account status changes to supporter. Having a supporters account unlocks more features for you in the game, you can read below to see the listed features for supporters.</font>
<br>
<br>
<br>&nbsp;
<b>What would you like to do?</b>
<br>&bull;
<a href="?action=purchase"><b>Purchase credits with paypal</b></a>
<br>&bull;
<a href="?action=transfer"><b>Transfer credits as reserves to my rounds</b></a>
<br>&bull;
<a href="?action=send"><b>Transfer credits to another player</b></a>
<br>&bull;
<strike><a href="?action=pimpname">Change my character name</b></a></strike>
<br>&bull;
<strike><a href="?action=attackout">Reset your attacks out</b></a></strike>
<br>
<br>
<br><b>Supporter status?</b>
<br><font color="#770000">Having supporters status unlocks more features and limits in <?=$GAMENAME?>. By becoming a supporter, you are not only paying for great entertainment, you are helping pay for the games server, the resources it uses and to keep the programers alive as we work on our games for a living.</font>
<br>
<br>
<br><b>Supporter Features</font></b>
<br>&bull;
<font color="#770000">game autosets the amount of turns you use when exploring so you dont have to keep typing in the amount of turns you want every time you use scout, produce and discipline.</font>
<br>&bull;
<font color="#770000">use macromedia flash for your profile and crew profile media.</font>
<br>&bull;
<font color="#770000">crew icons upload limit goes to 5000 bytes.</font>
<br>&bull;
<font color="#770000">change pimp name during game play.</font>
<br>&bull;
<font color="#770000">reset your attacks out.</font>
<br>&bull;
<font color="#770000">and more...</font>
<br>
<br>
</td>
</tr>
</table>
<?
}
}
}

?>

If that doesn't work, then try adding/subtracting { and }s from the bottom of the script.

fci
07-05-2006, 08:33 PM
what you posted now is different from your original post. do this on the last couple lines


</td>
</tr>
</table>
<?
}
}
}
}

?>

RawliJr
07-05-2006, 08:35 PM
ok i tried that and it didnt work...but then i added a }...and now nothing shows up?


so now the bottom looks like this



<?
}
}
}
}

?>

Lordrea
07-05-2006, 08:37 PM
Well, this may be simple.... you are calling a function. Are you actually calling it?

RawliJr
07-05-2006, 08:39 PM
not sure lol

Lordrea
07-05-2006, 08:40 PM
xP

Well that may be something to check out.

fci
07-05-2006, 08:42 PM
do you see where it says function paypal(...) ? it means you need to call that function now if you want it to run what's inside the function.
here you go:
http://us2.php.net/manual/en/language.functions.php#functions.user-defined

RawliJr
07-05-2006, 08:47 PM
<?
function paypal($price,$credits,$custom)
{
echo " function paypal.\n";

global $GAMENAME, $DOMAIN;
?>


that is at the top of the script now...and still nothing enless i didnt so something right?

GJay
07-05-2006, 09:50 PM
That is horrible, horrible code.
You have a function with reams of html in the middle, that then seems to call itself?


...stuff...
<?=paypal(20.00,'7,500',$custom)?>
...more stuff...


Where does $action come from anyway>

you have:


<table width="98%">
<?
{
?>

in the middle of the code? why?

RawliJr
07-06-2006, 07:35 AM
i got it thanx alot guys
:D



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum