Jump to content

HELP PLEASE! Need to ad payment processor to site.


laflair13

Recommended Posts

Hey all,

 

I have a script that as of now it only allows paypal as the means of payment. I am trying to ad another one (ECSuite.com) as an option of payment. I cannot find anywhere that I can intergrade it into the script.

 

Can anyone help me do this or point me in the direction on how to do it? I looked everywhere on ECsuite for something but couldnt find anything. Here are 2 pages that I think the coding might go.

 

functions.php

<?

function updateSortOrder($tablename,$sortcolumn,$idcolumn,$idvalue,$newsortno)

{

    $strSQL="select $sortcolumn from $tablename where $idcolumn=".$idvalue;

    $result=mysql_query($strSQL);

    $oldsortno=mysql_result($result,0,$sortcolumn);

    if($newsortno>$oldsortno)

        $strSQL="update $tablename set $sortcolumn=$sortcolumn-1 where $sortcolumn>$oldsortno AND $sortcolumn<=$newsortno";

    else

        $strSQL="update $tablename set $sortcolumn=$sortcolumn+1 where $sortcolumn<$oldsortno AND $sortcolumn>=$newsortno";

    $result=mysql_query($strSQL) or die(mysql_error());

    

    $strSQL="update $tablename set $sortcolumn=$newsortno where $idcolumn=$idvalue";

    $result=mysql_query($strSQL) or die(mysql_error());

}

function fixSorting($tablename,$sortcolumn,$idcolumn)

{

            $strSQL="select count(*) CNT from $tablename";

            $resultM=mysql_query($strSQL) or die(mysql_error().$strSQL);

            if(mysql_num_rows($resultM)==0)

                return false;

            $totalrecords=mysql_result($resultM,0,"CNT");

            if($totalrecords==0)

                return true;

            $strSQL="select $idcolumn from $tablename order by $sortcolumn";

            $resultSort=mysql_query($strSQL) or die(mysql_error().$strSQL);

            $arrUpdates=array();

            $counter=0;

            while($row=mysql_fetch_assoc($resultSort))

            {

                $counter++;

                $arrUpdates[]="update $tablename set $sortcolumn=$counter where $idcolumn=".$row[$idcolumn];

            }

            for($i=0;$i<count($arrUpdates);$i++)

                mysql_query($arrUpdates[$i]) or die(mysql_error());

            return true;

            

}

function getNewSortNo($tablename,$sortcolumn)

{

            $strSQL="select max($sortcolumn) msortno from $tablename";

            $resultM=mysql_query($strSQL) or die(mysql_error().$strSQL);

            if(mysql_num_rows($resultM)==0)

                $msortno=1;

            else

                $msortno=mysql_result($resultM,0,"msortno")*1+1;

            return $msortno;

}

function uploadImage($fieldname,$path,$filename)

{

    if (isset($_FILES[$fieldname]) && $_FILES[$fieldname]['name']!="" ) { 

              $filename = "pickserviceimg" . $pickserviceid . substr( $_FILES[$fieldname]['name'], strrpos ( $_FILES[$fieldname]['name'], "."));

              if (!move_uploaded_file($_FILES[$fieldname]['tmp_name'], $path . $filename)) { 

                  return "";

              } else { 

                //  echo ' good upload '; 

                    chmod ($path . $filename, 0755);

                    return $filename;

              } 

            } 

    return "";

}

function getCommaSeperatedColumn($strSQL,$column)

{

    $resultCSC=mysql_query($strSQL) or die(mysql_error().$strSQL);

    $strReturn="";

    $strComma="";

    while($row=mysql_fetch_assoc($resultCSC))

    {

        $strReturn.=$strComma.$row[$column];

        $strComma=",";

    }

    if($strReturn=="")

        return "0";

    return $strReturn;

}

function drawListBoxDB($query,$name,$valcolumn,$displaycolumn,$selected,$additional='',$option='')

{

    $ret="<select name=$name class=textbox $additional>$option";

    $rsTemp=mysql_query($query) or die(mysql_error());

    while($rowTemp=mysql_fetch_assoc($rsTemp) )

    {

        $strSelected=$rowTemp[$valcolumn]==$selected?"selected":"";

        $ret.="<option value='$rowTemp[$valcolumn]' $strSelected>$rowTemp[$displaycolumn]</option>";

    }

    $ret.="</select>";

    return $ret;

}

function drawListBoxDB_Function($query,$name,$valcolumn,$function,$selected,$additional='',$option='')

{

    $ret="<select name=$name class=textbox $additional>$option";

    $rsTemp=mysql_query($query) or die(mysql_error());

    while($rowTemp=mysql_fetch_assoc($rsTemp) )

    {

        $strSelected=$rowTemp[$valcolumn]==$selected?"selected":"";

        $ret.="<option value='$rowTemp[$valcolumn]' $strSelected>".$function($rowTemp[$valcolumn])."</option>";

    }

    $ret.="</select>";

    return $ret;

}

function getPick($pickid)

{

    $strSQL="select * from tblpicks where pickid=$pickid";

    $resultPick=mysql_query($strSQL);

    if(mysql_num_rows($resultPick)==0)

        return "";

    else

        return format_date(mysql_result($resultPick,0,"dateadded"))." - ".mysql_result($resultPick,0,"team1").":".mysql_result($resultPick,0,"team2");

}

function getMember($memberid)

{

    $strSQL="select * from tblmembers where memberid=$memberid";

    $resultPick=mysql_query($strSQL);

    if(mysql_num_rows($resultPick)==0)

        return "";

    else

        return mysql_result($resultPick,0,"fname")." ".mysql_result($resultPick,0,"lname")." (".mysql_result($resultPick,0,"login").")";

}

function drawListBoxDB2($query,$name,$valcolumn,$displaycolumn1,$displaycolumn2,$selected,$additional='',$option='')

{

    $ret="<select name=$name class=textbox $additional>$option";

    $rsTemp=mysql_query($query) or die(mysql_error());

    while($rowTemp=mysql_fetch_assoc($rsTemp) )

    {

        $strSelected=$rowTemp[$valcolumn]==$selected?"selected":"";

        $ret.="<option value='$rowTemp[$valcolumn]' $strSelected>$rowTemp[$displaycolumn1] $rowTemp[$displaycolumn2]</option>";

    }

    $ret.="</select>";

    return $ret;

}

function format_date($strdate)

{



    if($strdate=="0000-00-00" || !$strdate)

        return NULL;

    $time=strtotime($strdate,date("Y-m-d"));

    return date("m/d/Y",$time);

}



function format_timestamp($timestamp)

{

    $year=substr($timestamp,0,4);

    $month=substr($timestamp,4,2);

    $date=substr($timestamp,6,2);

    $timepart=substr($timestamp,8,2).":".substr($timestamp,10,2).":".substr($timestamp,12,2);    

    //return "$year-$month-$date $timepart";

    $datepart=strtotime("$year-$month-$date",date("Y-m-d"));

    

    //$timepart=strtotime($timepart,"His");

    

    return date("M d, Y",$datepart)." ".$timepart;

}

function jsGoURL($destnationurl)

{

return "

<SCRIPT LANGUAGE=javascript>

                    <!--

                    window.location=\"$destnationurl\";

                    //-->

                    </SCRIPT>

";

}

function getresult($status)

{

    $arr=array(0=>"Pending",1=>"Won",2=>"Loss",3=>"Tie");

    return $arr[$status];

}

function getViewableall($status)

{

    $arr=array(0=>"No",1=>"Yes");

    return $arr[$status];

}

function getServiceGroups($serviceid)

{

    $strSQL="select * from tblservicegroups,tblgroups where tblservicegroups.groupid=tblgroups.groupid AND serviceid=".$serviceid;

        $servicegroups=mysql_query($strSQL);

        $strComma="";

        $strGps="";

        while($rowgrps=mysql_fetch_array($servicegroups))

        {

            $strGps.= $strComma . $rowgrps[shorttitle];

            $strComma=", ";

        }

        return $strGps;

}

function getSortLink($title,$sort,$id)

{

    if($sort==$id)

        return "<a class='tHead' href='?sort=".($id+1)."'>$title</a>↑";

    if($sort==($id+1))

        return "<a class='tHead' href='?sort=".$id."'>$title</a>↓";

    return "<a class='tHead' href='?sort=".$id."'>$title</a>";



}

function smoothdate ($year, $month, $day)

{

    return sprintf ('%04d', $year) . sprintf ('%02d', $month) . sprintf ('%02d', $day);

}

function date_difference ($first, $second)

{



    $month_lengths = array (31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);



    $retval = FALSE;



    if (    checkdate($first['month'], $first['day'], $first['year']) &&

            checkdate($second['month'], $second['day'], $second['year'])

        )

    {

        $start = smoothdate ($first['year'], $first['month'], $first['day']);

        $target = smoothdate ($second['year'], $second['month'], $second['day']);

                            

        if ($start <= $target)

        {

            $add_year = 0;

            while (smoothdate ($first['year']+ 1, $first['month'], $first['day']) <= $target)

            {

                $add_year++;

                $first['year']++;

            }

                                                                                                            

            $add_month = 0;

            while (smoothdate ($first['year'], $first['month'] + 1, $first['day']) <= $target)

            {

                $add_month++;

                $first['month']++;

                

                if ($first['month'] > 12)

                {

                    $first['year']++;

                    $first['month'] = 1;

                }

            }

                                                                                                                                                                            

            $add_day = 0;

            while (smoothdate ($first['year'], $first['month'], $first['day'] + 1) <= $target)

            {

                if (($first['year'] % 100 == 0) && ($first['year'] % 400 == 0))

                {

                    $month_lengths[1] = 29;

                }

                else

                {

                    if ($first['year'] % 4 == 0)

                    {

                        $month_lengths[1] = 29;

                    }

                }

                

                $add_day++;

                $first['day']++;

                if ($first['day'] > $month_lengths[$first['month'] - 1])

                {

                    $first['month']++;

                    $first['day'] = 1;

                    

                    if ($first['month'] > 12)

                    {

                        $first['month'] = 1;

                    }

                }

                

            }

                                                                                                                                                                                                                                                        

            $retval = array ('years' => $add_year, 'months' => $add_month, 'days' => $add_day);

        }

    }

                                                                                                                                                                                                                                                                                

    return $retval;

}

?>

 

and

 

payconfig.php

<?

session_start();

   require('stts/hit.inc');





include("conn.php");



$item_name = $_REQUEST['item_name'];

$item_number = $_REQUEST['item_number'];

$payment_amount = $_REQUEST["mc_gross"];

$txn_id = $_REQUEST["txn_id"];



if(substr($item_number, 0, 2) == "op"){

    $op_number = substr($item_number, 2);

    $result = mysql_query("SELECT P.onepick FROM tblmemberservices M, tblpicks P WHERE (M.serviceid * -1)=P.pickid AND M.memberserviceid = $op_number");

} else

    $result = mysql_query("SELECT S.cost FROM tblmemberservices M, tblservice S WHERE M.serviceid=S.serviceid AND M.memberserviceid = $item_number");



if($row = mysql_fetch_array($result)){

    $cost = $row[0];



    if($item_name != ""){

        $result=mysql_query("SELECT cAmount FROM tbldiscounts WHERE cDiscountName = '$item_name'");



        if($row = mysql_fetch_array($result)){

            $cDiscount = str_replace("$", "", $row[0]);



            if(substr($cDiscount, strlen($cDiscount) - 1) == "%"){

                $fDiscount = substr($cDiscount, 0, strlen($cDiscount) - 1);

                $cost = $cost * (1 - ($fDiscount / 100));

            } else {

                $fDiscount = $cDiscount;

                $cost = $cost - $fDiscount;

            }

        }

    }



    if($cost < 0)

        $cost = 0;



    if($payment_amount >= ($cost - .01)){

        if(substr($item_number, 0, 2) == "op")

            mysql_query("UPDATE tblmemberservices SET subscription = 2, status = 1, txn_id = '$txn_id', paymentmethod = 'PayPal', startdate = NOW() WHERE memberserviceid = $op_number");

        else

            mysql_query("UPDATE tblmemberservices SET subscription = 2, status = 1, txn_id = '$txn_id', paymentmethod = 'PayPal', startdate = NOW() WHERE memberserviceid = $item_number");



        print("payment ok");

    } else

        print("no payment1");

} else

    print("no payment2");



print("SELECT P.onepick FROM tblmemberservices M, tblpicks P WHERE (M.serviceid * -1)=P.pickid AND M.serviceid = ($op_number * -1)");



?>

 

If anyone has any idea on how to do this, I would very much appreciate the help. I am lost when it comes to adding a payment gateway.

 

If anyone is willing, I have messengers if you can help.

 

MSN - dleflair@bellsouth.net (this is not my email)

ICQ - 343207210

AIM - xplicit1324

Yahoo - laflair13

__________________

 

Thanks in advance

David

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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

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

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.