I'm setting a paypal button payment system on my xataface website and I need help to insert the id of the logged in user.
The button file is named pack15.php and it contains this code :
- Code: Select all
<HTML>
<HEAD>
<TITLE>Test</TITLE>
</HEAD>
<BODY>
<H1>Pack de 15 SMS</H1>
<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="business" value="myemail@fai.com">
<input type="hidden" name="lc" value="FR">
<input type="hidden" name="item_name" <?php
mysql_connect(localhost, 'root','') or die("Erreur de connexion au serveur");
mysql_select_db('lepensebete') or die("Erreur de connexion à la base de donnees");
$query = "SELECT * FROM t_pack WHERE nom_pack = 'Pack de 15 SMS'";
$result = mysql_query($query);
$row = mysql_fetch_row($result);
echo 'value="'.$row[1].'"';
mysql_close();
?>>
<input type="hidden" name="amount" <?php
mysql_connect(localhost, 'root','') or die("Erreur de connexion au serveur");
mysql_select_db('lepensebete') or die("Erreur de connexion à la base de donnees");
$query = "SELECT * FROM t_pack WHERE nom_pack = 'Pack de 15 SMS'";
$result = mysql_query($query);
$row = mysql_fetch_row($result);
echo 'value="'.$row[4].'"';
mysql_close();
?>>
<input type="hidden" name="currency_code" value="EUR">
<input type="hidden" name="custom" <?php
class test {
function test() {
$auth =& Dataface_AuthenticationTool::getInstance();
$user =& $auth->getLoggedInUser();
$id = $user->val('id');
echo 'value="'.$id.'"';
}
}
?>>
<input type="hidden" name="button_subtype" value="products">
<input type="hidden" name="tax_rate" value="5.50">
<input type="hidden" name="shipping" value="0.00">
<input type="hidden" name="add" value="1">
<input type="hidden" name="bn" value="PP-ShopCartBF:btn_cart_LG.gif:NonHostedGuest">
<input type="image" src="https://www.paypal.com/fr_FR/FR/i/btn/btn_cart_LG.gif" border="0" name="submit" alt="PayPal - la solution de paiement en ligne la plus simple et la plus sécurisée !">
<img alt="" border="0" src="https://www.paypal.com/fr_FR/i/scr/pixel.gif" width="1" height="1">
</form>
</BODY>
</HTML>
So I can in this file put database data in parameters of the form with a mysql query but I can't get the id of the logged in user with my class :
- Code: Select all
<?php
class test {
function test() {
$auth =& Dataface_AuthenticationTool::getInstance();
$user =& $auth->getLoggedInUser();
$id = $user->val('id');
echo 'value="'.$id.'"';
}
}
?>>
I haven't got errors but the field is empty...
How can i do that ?
Thank you for the help