Help with function PicSQL($DBName

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Telemicus
Forum Newbie
Posts: 1
Joined: Tue Sep 18, 2007 2:08 pm

Help with function PicSQL($DBName

Post by Telemicus »

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


Hi 

This is my first post here so I am hoping I posting in the right area and not breaking any rules:

I'm installing a script but am having problems with the paypal payment function it includes.

The file activateaccount.php looks like this

Code: Select all

<?session_start();



//---------------------------------------------------------------------------------------
//				 Return url from 2 checkout
//---------------------------------------------------------------------------------------
		if($retfrom=="2check")
		{
		?>
			<form name="retform" action="pay_succ_2check.php" method="post">
						<input type=hidden name=product_id value="<?=$product_id?>"> 
						<input type="hidden" name="retcode" value="<?=$retcode?>">
						<input type="hidden" name="retfrom" value="2check">
			</form>
			<script language=javascript>
				retform.submit();
			</script>
		<?
		//header("Location: http://".$db->siteurl."/pay_succ.php");
		
		die();
		}
//---------------------------------------------------------------------------------------
// 					 end return url of 2 checkout
//---------------------------------------------------------------------------------------


if($USERID == "")
	header("Location: home.php");
?>
<?
include("include/connectdb.php");
include("include/DbSql.inc.php");
include("include/PicSql.inc.php");
$db = new PicSQL($DB_NAME);
$flag=$_GET[flag];
$sqladmin="select * from locker_admin";
$resadmin=$db->select_data($sqladmin);
$sqllink="select * from link";
$reslink=$db->select_data($sqllink);

// set Cookies
$secretword=$reslink[0][secretword];
$value=$USERID."-".$secretword;
setcookie ("AccessCookie", $value); 
//setcookie ("AccessCookie", $value,time()+1200);  /* expire in 1 hour */ 

//end set cookies



if($flag==1)
{	
	$sql="update member set acc_type='y' , status ='a' where uid='".$USERID."'";
	$res=$db->update_data($sql);
	$tm=time();
	$sqli="insert into member_payment(memid,amount,pdate) values('".$USERID."','".$resadmin[0][member_fees]."','".$tm."')";
	$resi=$db->insert_data($sqli);
	
	// -- CODE TO UPDATE MEMBER ACCOUNT IN  AFFILIATE SECTION
	
	$ip = $_SERVER['REMOTE_ADDR'];
	$sql1="update aff_referrer set flag='y' where mem_id = '".$USERID."' and ip_addr='".$ip."'";
	$res1=$db->update_data($sql1);

	// -- END CODE TO UPDATE MEMBER ACCOUNT IN  AFFILIATE SECTION
	
	
	
	header("Location: ./prod_security.php");
}
$sqladmin="select * from locker_admin";
$resadmin=$db->select_data($sqladmin);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="style.css"/>
</head>

<body bgcolor="#000000">
<?php 
	include("header.htm");
?>
<table width="752" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr> 
    <td background="images/pg_bg.jpg" style="padding-left:23;padding-right:22"> 
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr> 
          <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr> 
                <td width="19"><img src="images/box_tl.jpg" width="19" height="27"></td>
                <td background="images/box_mdl.jpg" class="heading">Activate Account</td>
                <td width="121" valign="top" background="images/box_mdl.jpg" class="heading"><img src="images/laptop_corner.jpg" width="121" height="20"></td>
                <td width="57"><img src="images/box_tr.jpg" width="57" height="27"></td>
              </tr>
            </table>
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr> 
                <td width="11"><img src="images/content_tl.jpg" width="12" height="13"></td>
                <td background="images/content_u_pattern.jpg"><img src="images/content_u_pattern.jpg" width="1" height="13"></td>
                <td width="11"><img src="images/content_tr.jpg" width="13" height="13"></td>
              </tr>
            </table>
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr> 
                <td width="13" height="18" background="images/content_l.jpg">&nbsp;</td>
                <td bgcolor="DADFE4" style="padding-left:5px;padding-right:5px"> <table width=100% border="0" cellspacing="0" cellpadding="0" align="center" valign=top>
		<tr>
			<td align=center>
				<TABLE cellPadding=15 width=100% border=0>
        <TBODY>
		<?
		if ($mess=="cancel")
			{
			?>
		<tr>
			<td align=center>
			<FONT style="FONT-SIZE: 10pt" face=arial,sans-serif>
				<H3>Note : You have terminated your subscription<br>
				You are not able to access your account....</H3><br>
			</font>
			</td>
		</tr>
		<?
		}
		?>
        <TR>
          <TD><FONT style="FONT-SIZE: 10pt" face=arial,sans-serif>
            <H3><font face="arial,sans-serif" style="FONT-SIZE: 10pt">Activate your
                <?=$db->siteinitial?>
                .com Account</font></H3>
            We appreciate your decision signing up with
            <?=$db->siteinitial?>
            .com. We are 
	    sure that this is the best way of protection and refunding decrease for those who are producing software and any other
	    sold E-product.
            <?
			if($resadmin[0][flag_card] == 1 && $resadmin[0][flag_paypal]==1)
			{
			?>
            <BR>
            <BR>
            Please select a payment method below...
            <?}else{?>
            <BR>
            <br>
            <!--<input type="button" name="Pay" value="Pay" class=box
onclick="window.open('http://www.productbrander.com', 'Account_Details', 'top=10,left=100,right=700,width=700,height=700')">-->
            <?}
			
			$secretword=$reslink[0][secretword];
			if($resadmin[0][flag_card] == 1)
			{?>
            <BR>
</FONT>
            <form name="myform" action="https://www.2checkout.com/cgi-bin/crbuyers/recpurchase.2c" method="post">
              <font face="arial,sans-serif" style="FONT-SIZE: 10pt">
                <!--<form name="checkout" action="https://sellers.2checkout.com/cgi-bin/sellersarea/recpassback.2c" method=post>-->
              <!--<form name="checkout" action="https://www.2checkout.com/cgi-bin/sbuyers/cartpurchase.2c" method="post">-->
              <!--<form name="myform" action="" method="post">-->
              <?
					$card_id=$resadmin[0][card_id];
					$total=$resadmin[0][member_fees];
					$retcode=$USERID."-".$secretword;
				?>
              <INPUT type="hidden" name="sid" value="<?=$card_id?>">
              <input type=hidden name=product_id2 value="1">
              <input type="hidden" name="total" value="<?=$total?>">
              <input1 type="hidden" name="retcode" value="<?=$retcode?>">
              <input1 type="hidden" name="retfrom" value="2check">
              <!--<input1 type="hidden" name="demo1" value="Y">-->
              <!--<input type=submit name=btnchkout value="2CheckOut"  class=box>-->
              </font><font style="FONT-SIZE: 10pt">
                <center>
                  <font face="arial,sans-serif">
                    <input type=image name=btnpaypal src="images/2checkoutpay.gif">
                    <br>
                <?
							if($resadmin[0][flag_card] == 1 && $resadmin[0][flag_paypal]==1)
							{
							?>
                    2Checkout
                    <?
							}
							?>
                </font>
                </center>
                </font>
            </form>
            <!--
			<A 
            href="https://www.2checkout.com/cgi-bin/crbuyers/recpurchase.2c?sid=32940&product_id=19"><FONT 
            style="FONT-SIZE: 12pt"><B>Credit Card</B></FONT></A>
			-->
            <?}?>
            <?
				if($resadmin[0][flag_paypal] == 1)
				{
			?>
            <!--Paypal -->
            <form name="paypal" target="_new" action="https://www.paypal.com/cgi-bin/webscr" method="post">
              <font face="arial,sans-serif" style="FONT-SIZE: 10pt">
                <?
							$itemname=$resadmin[0][site_name];//;$res[$i][fq_title];
						//"me@mybiz.com";//
							$business=$resadmin[0][owner_paypal_email];//$db->getadmininfo("owner_paypal_email");
							$itemnumber=$fqid."|".$fqcode."|".$ffq_id."|".$USERID."|".$totamt."|".$mainamt;
							$noshipping=$USERID."-".$secretword;
							$successurl="http://".$db->siteurl."/pay_succ.php";
							$unsuccessurl="http://".$db->siteurl."/pay_fail.php";
							$payamount=$resadmin[0][member_fees];//$totamt;
							include("include/payment/subpaypal.php");
							$linkstr="item_number=".$itemnumber."&no_shipping=".$noshipping."&ptype=25%";
							?>
              <?
								$bus=$db->getadmininfo("owner_paypal_email");
								//echo "Paypal ID : <br>".$bus;
							?>
                <br>
              <!--<input type=submit name=btnpaypal value="PayPal"  class=box>-->
                <br>
              </font><font style="FONT-SIZE: 10pt">
                <center>
                  <font face="arial,sans-serif">
                    <input type=image name=btnpaypal src="images/pay.gif">
                    <br>
                <!--
new code
-->
                <!--<input type="image" src="http://www.paypal.com/images/x-click-but20.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">-->
                <input type="hidden" name="a3" value="<?=$payamount?>">
                <input type="hidden" name="p3" value="1">
                <input type="hidden" name="t3" value="M">
                <input type="hidden" name="src" value="1">
                <input type="hidden" name="sra" value="1">
                <!--
end new code
-->
                <?
							if($resadmin[0][flag_card] == 1 && $resadmin[0][flag_paypal]==1)
							{
							?>
                    Paypal
                    <?
							}
							?>
                </font>
                </center>
                <font face="arial,sans-serif">
                  <!--<input type=submit name=btnpaypaltext value="Testing" onclick="return fun_addamt(this.form,'<?=$linkstr?>')"  class=btnh8><br>-->
              <!--							<a href="cl_pay_deposit_succ_of_fl.php?< ? = $ linkstr ? > ">Temp. Payment link (For Texting)</a>-->
              </font></font>
            </form>
            <!-- end paypall-->
            <?}?><FONT style="FONT-SIZE: 10pt" face=arial,sans-serif><BR>
            <BR>
            <CENTER>
              <SCRIPT language=javascript 
            src="actiateaccount_files/box.htm"></SCRIPT>
            </CENTER>
            <P>              </FONT></TD>
        </TR></TBODY></TABLE>
			</td>
		</tr>
</table>
                </td>
                <td width="12" background="images/content_r.jpg"><img src="images/content_r.jpg" width="12" height="1"></td>
              </tr>
            </table>
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr> 
                <td width="13"><img src="images/box_bl.jpg" width="14" height="17"></td>
                <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr> 
                      <td background="images/box_b_mdl.jpg"><img src="images/spacer.gif" width="1" height="1"></td>
                      <td width="4"><img src="images/box_b_l_arr.jpg" width="4" height="17"></td>
                      <td width="54" background="images/box_mdl_b.jpg"><img src="images/spacer.gif" width="1" height="1"></td>
                      <td width="4"><img src="images/box_b_r_arr.jpg" width="4" height="17"></td>
                      <td background="images/box_b_mdl.jpg"><img src="images/spacer.gif" width="1" height="1"></td>
                    </tr>
                  </table></td>
                <td width="13"><img src="images/box_br.jpg" width="14" height="17"></td>
              </tr>
            </table></td>
        </tr>
      </table>
      
    </td>
  </tr>
</table>
<?php
	include("footer.htm");
?>
</body>
</html>
The script sends me to Paypal but it does not appear to have picked up the correct variables and when it arrives at Paypal I get a page not found error.

The setup instructions were poor but I was wondering if I needed to change anything in the PicSql.inc.php file
Within it, there is a line:

Code: Select all

function PicSQL($DBName = "")
   {
      $this->DBSQL($DBName);
	   }
Should there be anything between the quotes or does the function set that up itself?

Any guidance greatly appreciated. (I'm willing to send a copy of the script if someone wants to review in more detail)

Thank you


feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Post Reply