Jump to content

'Fatal Error: Cannot access empty property' problem with PHP 5?


xbox2box

Recommended Posts

Hello PHP Anon out there,

 

I wish to get some of my old PHP code back up on some new sites.

After getting all of my databases connected and getting everything else working perfectly.

I started going through the code and didn't have much of a problem until I ran into ONE issue :(

This was programed by me and a friend back in the PHPv4 days and my new server has PHP 5.

I have 2 pages that this problem might link to

The main problem is a file below called eflyerListing.php

 

<? session_start();
include_once ('includes/database.php');
include_once ("includes/dbFunc.php");
if (!isset($_SESSION['user']))
	{
header("Location: login.php"); /* Redirect browser */
exit;  
}
/////////////////////////////////////////////////////////////////////
include('includes/Paging.class.php');
	$arrMainParam['TOTAL_RECORDS']				=	'';
	$arrChildParam['FORM_NAME']	=	'frm';
	$arrMainParam['RECORDS_PER_PAGE']			=	10;
$arrMainParam['PAGELINKS_PER_PAGE']			=	10;

	$arrChildParam['SHOW_TOTAL_RECORDS_FOUND']	=	'0';
	$arrChildParam['PAGINATION_STYLE']			=	'3';
	$arrChildParam['SPT_URL_PARAM']				=	'1';

//////////////////////////////////////////////////////////////////////////	

 

The Fatal error i get when going to this page is Fatal error: Cannot access empty property in /home/content/s/h/o/shouthouse/html/DMTMAIL.COM/includes/Paging.class.php on line 19

 

The Include for Paging.class.php is below

<?php

class Paging
{
#== Configurable Variables
var $TOTAL_RECORDS;
var $RECORDS_PER_PAGE;
var $PAGELINKS_PER_PAGE;
var $SPT_SQL_WITH_LIMIT;
var $SPT_URL_PARAM = 0;

#== Non-Configurable Variables
var $strErrorMsg;
var $intCurrentPage;
var $strJSCode;

Function Paging($arrParentParam)
{
	$this->$SPT_URL_PARAM = 0;  //<-- THIS IS LINE 19 THAT IS A HOOKER.
	if(!is_array($arrParentParam)) $arrParentParam=array();

 

Ive dug all over the world wide internetz and have tried getting rid of the dollar sign to make line 19 like below

$this->SPT_URL_PARAM = 0;

w/o the $ symbol

 

The eflyersListing.php pages purpose is to layout a table of mysql data that it pulls with all of the users save HTML flyers.

 

after trying to see if it was a PHP 5 problem with the $ symbol place before the var it gave me this error below

Invalid query: Unknown column 'Array' in 'where clause'

 

Please help me and I will forever be in your debt.

 

Ill give you good music or something like that in exchange for the help lol  ;D

 

-Copelander

-DMTHouse.com

 

 

Link to comment
Share on other sites

Well I have gotten rid of the $ sign.. I did an echo on the arrParentParam on line 19 to see if I could get any more idea of how this works.

 

it posted

 

Array

Fatal error: Cannot access empty property in /includes/Paging.class.php on line 20

 

What I cant figure out is if this error is still leading to the $SPT_URL_PARAM var which also appears in an array on the eflyerListing.php

$arrChildParam['SPT_URL_PARAM'] = '1';

 

 

Here is my full code below to shead more light on this. plz no sql inject mezz :(

 

eflyerListing.php

<? session_start();
include_once ('includes/database.php');
include_once ("includes/dbFunc.php");
if (!isset($_SESSION['user']))
	{
header("Location: login.php"); /* Redirect browser */
exit;  
}
/////////////////////////////////////////////////////////////////////
include('includes/Paging.class.php');
	$arrMainParam['TOTAL_RECORDS']				=	'';
	$arrChildParam['FORM_NAME']	=	'frm';
	$arrMainParam['RECORDS_PER_PAGE']			=	10;
$arrMainParam['PAGELINKS_PER_PAGE']			=	10;

	$arrChildParam['SHOW_TOTAL_RECORDS_FOUND']	=	'0';
	$arrChildParam['PAGINATION_STYLE']			=	'3';
	$arrChildParam['SPT_URL_PARAM']				=	'1';

//////////////////////////////////////////////////////////////////////////	

if($_POST['btnAction']=="delete"  && isset($_POST['selection'])){
	// delete the eflyer account
	$selection = $_POST['selection'];
	$selection_arr=count($selection);
	for($i=0;$i<$selection_arr;$i++){
	$sql_del_eflyer = "delete from tbleflyer  WHERE Eflyer_id ='".$selection[$i]."'";
	$enRes = mysql_query($sql_del_eflyer)or die("Invalid query: " . mysql_error());
	$sql_insert_History="insert into tblhistoryeflyer (History_user_id ,History_eflyer_id) values('".$_SESSION['userID']."','".$selection[$i]."')";
	$res_insert_History= mysql_query($sql_insert_History)or die("Invalid query: " . mysql_error());
	}


$message="E-Flyer deleted succesfully";
	}	


$sql_slct_eflyer="select * from  tbleflyer where Eflyer_user_id='".$_SESSION['userID']."'";
$res_slct_eflyer= mysql_query($sql_slct_eflyer)or die("Invalid query: " . mysql_error());
//die($sql_slct_eflyer);
$num_slct_eflyer = mysql_num_rows($res_slct_eflyer);
$num_rows=mysql_num_rows($res_slct_eflyer);
$arrMainParam['TOTAL_RECORDS'] = $num_rows;
$objPaging = new Paging($arrMainParam);

$sql_slct_eflyer.= $objPaging->SPT_SQL_WITH_LIMIT;
$res_slct_eflyer1=mysql_query($sql_slct_eflyer);

if($num_slct_eflyer>0){
$i=1;
$table_string="<table><tr><td><input type='checkbox' name='tickall' id='tickall' onclick='javascript:checkall();'></td><td>Eflye Name</td><td>Eflyer Area</td><td>Eflyer Created</td><td>Eflyer Send Date</td><td>Eflyer Credit</td><td>Eflyer Status</td></tr>";
	while($rw_slct=mysql_fetch_array($res_slct_eflyer1, MYSQL_BOTH)){

			if($i%2!=0){
				$trcolor = "#EFEFEF";
			}else{
				$trcolor = "#FFFFFF";
			}
				$i++;
		$table_string.="<tr bgcolor=".$trcolor."><td><input type='checkbox' name='selection[]' id='selection[]' value='".$rw_slct['Eflyer_Id']."'></td>";
		$table_string.="<td ><a href='eflyerProof.php?id=".$rw_slct['Eflyer_Id']."'>".$rw_slct['Eflyer_Name']."</a></td>";
		if($rw_slct['Area_Send']=="")
		$area_num=0;
		else
		$area_num=$rw_slct['Area_Send'];

		$area_send_arr=explode(",",$rw_slct['Area_Send']);
		$sql_state="select area_def from tblareadef where area_id  in(".$area_num.") ";

		$res_state= mysql_query($sql_state)or die("Invalid query: " . mysql_error());
		//die($sql_state);
		$area_send="";
		while($rw_state=mysql_fetch_array($res_state, MYSQL_BOTH))
		{
			$area_send.=$rw_state['area_def'].",";
		}
		$area_send=substr($area_send,0,-1);
		$table_string.="<td title='".$area_send."'>".substr($area_send,0,80)."</td>";
		$table_string.="<td>".$rw_slct['Eflyer_datetime']."</td>";
		$table_string.="<td>".$rw_slct['Date_Send']."</td>";
		$table_string.="<td>".$rw_slct['Eflyer_credit']."</td>";

		if($rw_slct['Eflyer_status']==1){
			$table_string.="<td>Paid Send</td></tr>";
		}else if($rw_slct['Eflyer_status']==0){
			$table_string.="<td>Pending</td></tr>";
		}else if($rw_slct['Eflyer_status']==3){
			$table_string.="<td>Viewed</td></tr>";
		}else if($rw_slct['Eflyer_status']==2){
			$table_string.="<td>Paid Un Send</td></tr>";
		}


	}

$table_string.="<tr>
                      <td bgcolor='C9C37F' valign='top' align='center' colspan='7'>
				  <font color='green'>To Edit / Re-Send a E-Flyer previously created, please click on name of E-Flyer
				  </td>
                      </tr></table>";
}else{
$message="No Eflyer Created Yet";
}
// conetent start   	
$data=file_get_contents("template/heade_left_footer.html");
$data=eregi_replace("%%title%%","E-Flyer",$data);

$btnaction='<select name="btnAction">
                            <option value="delete">Delete</option>
                          </select> <input type="submit" name="Go" value="Go">';
					  
$data3=file_get_contents("template/eflyerListing.html"); 
$data3=eregi_replace("%%eflyerList%%","eflyerListing.php",$data3);
$data3=eregi_replace("%%tableString%%",$table_string,$data3);
$data3=eregi_replace("%%btnAction%%",$btnaction,$data3);
$data3=eregi_replace("%%paging%%",$objPaging->fnCreateSPT($arrChildParam),$data3);

$data=eregi_replace("%%inner_table%%",$data3,$data);
if (isset($message))
{
$data=eregi_replace("<!--MESSAGE","<!--MESSAGE-->",$data);
$data=eregi_replace("MESSAGE-->","<!--MESSAGE-->",$data);
$data=eregi_replace("%%message%%",$message,$data);
}
print $data;
exit();
?>

 

 

Paging.class.php

<?php

class Paging
{
#== Configurable Variables
var $TOTAL_RECORDS;
var $RECORDS_PER_PAGE;
var $PAGELINKS_PER_PAGE;
var $SPT_SQL_WITH_LIMIT;
var $SPT_URL_PARAM;

#== Non-Configurable Variables
var $strErrorMsg;
var $intCurrentPage;
var $strJSCode;

Function Paging($arrParentParam)
{
	echo $arrParentParam;
	$this->$SPT_URL_PARAM = 0;
	if(!is_array($arrParentParam)) $arrParentParam=array();
	#Init the Error Msg
	$this->strErrorMsg ='<table width="100%" border="0" ';
	$this->strErrorMsg.='style="font-family:Verdana;font-size:11px;color:#FF0000;"><tr>';
	$this->strErrorMsg.='<td width="100%" align="center">';
	$this->strErrorMsg.='Unable to create Smart Paging Technique© [{ERROR}]</td></tr></table>';

	#Init the Total Records
	$TotRec=trim($arrParentParam['TOTAL_RECORDS']);
	if(trim($TotRec)=='') die(str_replace('{ERROR}','Total Records are NULL',$this->strErrorMsg)); 
	else $this->TOTAL_RECORDS=(int)$TotRec;

	#Init Records Per Page
	$RecPerPage=trim($arrParentParam['RECORDS_PER_PAGE']);
	if($RecPerPage!='') $this->RECORDS_PER_PAGE=$RecPerPage;
	else $this->RECORDS_PER_PAGE=10; #Default Value

	#Init Page Links Per Page
	$LinksPerPage=trim($arrParentParam['PAGELINKS_PER_PAGE']);
	if($LinksPerPage1!='') $this->PAGELINKS_PER_PAGE=$LinksPerPage1;
	else $this->PAGELINKS_PER_PAGE=5; #Default Value

	#Init the Current Pagination Page
	$FormValues=array_merge($_POST,$_GET);
	if(trim($FormValues['SPTPage'])=='' OR !isset($FormValues['SPTPage'])) $this->intCurrentPage=1;
	else $this->intCurrentPage=(int) trim($FormValues['SPTPage']);

	#Init the LIMIT Query for the User
	if(($this->intCurrentPage)==1) $LowerLimit=0;
	else $LowerLimit = (($this->intCurrentPage - 1) * $this->RECORDS_PER_PAGE);
	$UpperLimit = $this->RECORDS_PER_PAGE;
	$this->SPT_SQL_WITH_LIMIT = " LIMIT $LowerLimit, $UpperLimit ";

	$this->strJSCode ='<script type="text/javascript">'."\n";
	$this->strJSCode.='<!--'."\n";
	$this->strJSCode.='if(!document.<FUNCTION_NAME>) { ';
	$this->strJSCode.='function <FUNCTION_NAME>() { ';
	$this->strJSCode.=' try { var hndFRM=document.getElementById("<FRM_NAME>"); } catch(e) ';
	$this->strJSCode.='{ alert("Smart Paging Technique [Error: Document.Form is NULL or not an Object]"); '; 
	$this->strJSCode.='return; } ';
	$this->strJSCode.='var URL_Add="<ADD_VALUES>"; var ToPage="?SPTPage="; ';
	$this->strJSCode.='if(<FUNCTION_NAME>.arguments[0]) ToPage+=<FUNCTION_NAME>.arguments[0]; ';
	$this->strJSCode.='hndFRM.action=" "+ToPage+URL_Add; hndFRM.method="POST"; hndFRM.submit(); } ';
	$this->strJSCode.='} '."\n";
	$this->strJSCode.='//--> '."\n";
	$this->strJSCode.='</script>';
}

Function fnCreateSPT($arrChildParam)
{


	if(!is_array($arrChildParam)) $arrChildParam=array();
	$stmtPlaceSPT = '';



	#Init the Form Name
	$tmpFormName=trim($arrChildParam['FORM_NAME']);
	# Code commented below have to be placed in Beta Versions only
	#if($tmpFormName!='')
	#{
	#	$sptFormName=$tmpFormName;
	#	$flagFrmAvailable='Y';
	#} else
	#{
	#	$sptFormName=strtoupper(uniqid('frmSPT'));
	#	$flagFrmAvailable='N';
	#}
	if($tmpFormName!='')
	{
		$sptFormName=$tmpFormName;
		$flagFrmAvailable='Y';
	}else die(str_replace('{ERROR}','Document.Form is NULL or not an object',$this->strErrorMsg));

	$arrDoSPT['FORM_NAME']=$sptFormName;
	$arrDoSPT['FLAG_FORM_AVAILABLE']=$flagFrmAvailable;

	#Init the Flag to Show the Total Records Found
	$tmpFlag_TotRec=trim($arrChildParam['SHOW_TOTAL_RECORDS_FOUND']);
	if($tmpFlag_TotRec!=='') $sptFlag_TotRec=$tmpFlag_TotRec;
	else $sptFlag_TotRec=0;
	if((bool)$sptFlag_TotRec) $arrDoSPT['FLAG_SHOWTOTALREC']='Y';
	else $arrDoSPT['FLAG_SHOWTOTALREC']='N';

	#Init the Move First Link/Image
	$tmpMoveFirst=trim($arrChildParam['IMAGE_MOVE_FIRST']);
	if($tmpMoveFirst=='') $sptMoveFirst='<<First';
	else $sptMoveFirst=$tmpMoveFirst;


	#Init the Move Prev Link/Image
	$tmpMovePrev=trim($arrChildParam['IMAGE_MOVE_PREV']);
	if($tmpMovePrev=='') $sptMovePrev='<Prev';
	else $sptMovePrev=$tmpMovePrev;


	#Init the Move Next Link/Image
	$tmpMoveNext=trim($arrChildParam['IMAGE_MOVE_NEXT']);
	if($tmpMoveNext=='') $sptMoveNext='Next>';
	else $sptMoveNext=$tmpMoveNext;


	#Init the Move Last Link/Image
	$tmpMoveLast = trim($arrChildParam['IMAGE_MOVE_LAST']);
	if($tmpMoveLast=='') $sptMoveLast = 'Last>>';
	else $sptMoveLast = $tmpMoveLast;

	#Init the Additional Values to be passed with the URL (on Submittion)
	$tmpAdditional = trim($arrChildParam['ADDITIONAL_VALUES']);
	if($tmpAdditional=='') $arrDoSPT['ADD_VAL']='';
	else $arrDoSPT['ADD_VAL']=str_replace('?','',$tmpAdditional);


# Added by kalim
	if($sptFlag_TotRec=='1') $ShowTotal=true;
	else $ShowTotal=false;
	if($flagFrmAvailable=='Y') $frmAvailable=true;
	else $frmAvailable=false;
	$URL_APPEND=stripslashes(trim($arrArguments['ADD_VAL']));
	if(substr($URL_APPEND,0,1)!='&') $URL_APPEND='&'.$URL_APPEND;
	$URL_APPEND=addslashes($URL_APPEND);
	$URL_APPEND=str_replace("\\'", "'", $URL_APPEND); #Eliminating the JS Error Possibility

//          echo "here".$arrParentParam["SPT_URL_PARAM"];


	if ( $arrChildParam["SPT_URL_PARAM"] )
	{
		$base_url = substr($_SERVER['QUERY_STRING'], 0, strpos($_SERVER['QUERY_STRING'],"&SPTPage")===false?strlen($_SERVER['QUERY_STRING']):strpos($_SERVER['QUERY_STRING'],"&SPTPage")); 
		$URL_APPEND .= ereg_replace("SPTPage=[0-9]+&","",$base_url);
	}

	#Prepare the JS Code
	$stmtJS = $this->strJSCode;
	$jsFuncName = 'fn'.strtoupper(uniqid('SPT')); #This is the JS Function Name
	$stmtJS = str_replace('<FRM_NAME>', $sptFormName, $stmtJS); #Replacing values
	$stmtJS = str_replace('<FUNCTION_NAME>', $jsFuncName, $stmtJS);
	$stmtJS = str_replace('<ADD_VALUES>', $URL_APPEND, $stmtJS);
	$stmtSPTCode.=$stmtJS; #Appending the JS Code

          $arrDoSPT['JS_FUNC_NAME'] = $jsFuncName;

	$SPT_TotalPages = ceil($this->TOTAL_RECORDS/$this->RECORDS_PER_PAGE); #Calculate Total Pages
	if($this->TOTAL_RECORDS!=0 AND $SPT_TotalPages > 1)
	{
		if(!$frmAvailable) $stmtSPT.='<FORM id="'.$sptFormName.'" ACTION="" METHOD="POST">'."\n";

		$stmtSPT.="<table width='100%' cellpadding='0' cellspacing='0' border='0'><tr>";
		$stmtSPT.="\n<td><table width='100%' cellpadding='0' cellspacing='0'>";
		$stmtSPT.="<tr>";

		if($ShowTotal) 
		{
			$stmtSPT.="<td align='left' style='font-family:Verdana;font-size:11px;color:#000000;'><b> Total ".$this->TOTAL_RECORDS." record(s) found</b></td>";
		}
		else 
		{
			$stmtSPT.='';
		}

		$stmtSPT.="<td align='right'>";
		#== [Create FIRST Page Link]
		if($this->intCurrentPage==1)
		{
			$stmtSPT.=$sptMoveFirst;
		}
		else 
		{
			$stmtSPT.='<a href="#" onclick="javascript:{'.$jsFuncName.'(1);}" title="Move to First Page">'.$sptMoveFirst.'</a>';
		}
		$stmtSPT.=' ';

		#== [Create PREVIOUS Page Link]
		if($this->intCurrentPage==1) $stmtSPT.=$sptMovePrev;
		else $stmtSPT.='<a href="#" onclick="javascript:{'.$jsFuncName.'('.($this->intCurrentPage-1).');}" title="Move to Previous Page">'.$sptMovePrev.'</a>';
		$stmtSPT.=' ';

		$stmtSPT.='  ';

               #Choose the SPT Style
               $intSPTStyle=trim($arrChildParam['PAGINATION_STYLE']);
               switch($intSPTStyle)
               {
                    case '1':
                         $stmtSPT .= $this->fnSPT_Style1($arrDoSPT);
                         break;
                    case '2':
                         $stmtSPT .= $this->fnSPT_Style2($arrDoSPT);
                         break;
                    case '3':
                         $stmtSPT .= $this->fnSPT_Style3($arrDoSPT);
                         break;
                    default:
                         $stmtSPT .= $this->fnSPT_Style1($arrDoSPT);
                          break;
               }

		#== [Create NEXT Page Link]
		if($this->intCurrentPage==$SPT_TotalPages) $stmtSPT.=$sptMoveNext;
		else $stmtSPT.='<a href="#" onclick="javascript:{'.$jsFuncName.'('.($this->intCurrentPage+1).');}" title="Move to Next Page">'.$sptMoveNext.'</a>';
		$stmtSPT.=' ';

		#== [Create LAST Page Link]
		if($this->intCurrentPage==$SPT_TotalPages) $stmtSPT.=$sptMoveLast;
		else $stmtSPT.='<a href="#" onclick="javascript:{'.$jsFuncName.'('.$SPT_TotalPages.');}" title="Move to Last Page">'.$sptMoveLast.'</a>';

		for($i=0;$i<=3;$i++) $stmtSPT.=' ';
		$stmtSPT.="</td></tr>\n</table></td></tr></table>";
		if(!$frmAvailable) $stmtSPT.='</FORM>';
		$stmtSPTCode.=$stmtSPT;
	} else $stmtSPTCode='';
# End 
	return $stmtSPTCode;
}

Function fnSPT_Style1($arrArguments)
{
	$stmtSPTCode='';
	#Config and Fix the Arguments
          $jsFuncName = $arrArguments['JS_FUNC_NAME'];
	$SPT_TotalPages = ceil($this->TOTAL_RECORDS/$this->RECORDS_PER_PAGE); #Calculate Total Pages
	if($this->TOTAL_RECORDS!=0 AND $SPT_TotalPages > 1)
	{
		#== [Create ALL PAGE Dropdown]
		$stmtSPT.="<select name='SPT_CurrentPage' onChange=\"javascript:$jsFuncName(this.value);\">";
		for($i=1;$i<=$SPT_TotalPages;$i++)
		{
		 $stmtSPT.="<option value='$i' ";
		 if($this->intCurrentPage==$i) $stmtSPT.='selected';
		 $stmtSPT.=">$i</option>";
		}
		$stmtSPT.="</select>";
		$stmtSPT.=' ';
	} else $stmtSPT='';
	return $stmtSPT;
}#END FUNCTION fnSPT_Style1()



Function fnSPT_Style2($arrArguments)
{
	$stmtSPTCode='';
          return $stmtSPTCode;
}#END FUNCTION fnSPT_Style2()



Function fnSPT_Style3($arrArguments)
{
	$stmtSPTCode='';
	#Config and Fix the Arguments
          $jsFuncName = $arrArguments['JS_FUNC_NAME'];

	$SPT_TotalPages = ceil($this->TOTAL_RECORDS/$this->RECORDS_PER_PAGE); #Calculate Total Pages
	if($this->TOTAL_RECORDS!=0 AND $SPT_TotalPages > 1)
	{

		#== Create PAGE Links
		if(($this->intCurrentPage-floor($this->PAGELINKS_PER_PAGE/2))<1) $LowerLimit=1;
		else $LowerLimit=($this->intCurrentPage-floor($this->PAGELINKS_PER_PAGE/2));
		if($SPT_TotalPages>=$this->PAGELINKS_PER_PAGE)
		{
			if(($LowerLimit+($this->PAGELINKS_PER_PAGE-1))>$SPT_TotalPages)
			{
				$LowerLimit-=(($LowerLimit+($this->PAGELINKS_PER_PAGE-1))-$SPT_TotalPages);
				$UpperLimit=$SPT_TotalPages;
			}else $UpperLimit=($LowerLimit+($this->PAGELINKS_PER_PAGE-1));
		}else $UpperLimit=$SPT_TotalPages;

		for($i=$LowerLimit;$i<=$UpperLimit;$i++)
		{
			if($this->intCurrentPage==$i) $stmtSPT.=$i;
			else $stmtSPT.='<a href="#" onclick="javascript:{'.$jsFuncName.'('.$i.');}">'.$i.'</a>';
			$stmtSPT.='  ';
		}
	} else $stmtSPT='';

	return $stmtSPT;

}#END FUNCTION fnSPT_Style3()

}#END CLASS

?>

 

 

Any help is greatly appreciated as I have been stumped on this for 3 days....

 

 

Link to comment
Share on other sites

i see two problems...first, in eflyerListing.php:

if($_POST['btnAction']=="delete"  && isset($_POST['selection'])){
      // delete the eflyer account
      $selection = $_POST['selection'];
      $selection_arr=count($selection);
      for($i=0;$i<$selection_arr;$i++){
      $sql_del_eflyer = "delete from tbleflyer  WHERE Eflyer_id ='".$selection_arr[$i]."'"; //Needs to be $selection_arr
      $enRes = mysql_query($sql_del_eflyer)or die("Invalid query: " . mysql_error());
      $sql_insert_History="insert into tblhistoryeflyer (History_user_id ,History_eflyer_id) values('".$_SESSION['userID']."','".$selection_arr[$i]."')"; //Needs to be $selection_arr
      $res_insert_History= mysql_query($sql_insert_History)or die("Invalid query: " . mysql_error());
      }

 

and then the same thing we talked about before in Paging.class.php

   function Paging($arrParentParam)
   {
      print_r($arrParentParam); //If it's an array, you need to use print_r()
      $this->SPT_URL_PARAM = 0; //No dollar sign
      if(!is_array($arrParentParam)) $arrParentParam=array();
      #Init the Error Msg
      $this->strErrorMsg ='<table width="100%" border="0" ';
      $this->strErrorMsg.='style="font-family:Verdana;font-size:11px;color:#FF0000;"><tr>';
      $this->strErrorMsg.='<td width="100%" align="center">';
      $this->strErrorMsg.='Unable to create Smart Paging Technique© [{ERROR}]</td></tr></table>';

 

more about

$this->SPT_URL_PARAM = 0;

...if there is a dollar sign in front of SPT, it first looks up the value of $SPT_URL_PARAM in the scope of that method, which is empty (cus there is no variable). Then it throws the error, cus you can't have an empty member.

Link to comment
Share on other sites

Dude, Macgyver

 

I think with your help that I am getting closer! Thanks for your help but it looks like it is still having that array problem but it is printing the array which states

 

Array ( [TOTAL_RECORDS] => 3 [RECORDS_PER_PAGE] => 10 [PAGELINKS_PER_PAGE] => 10 ) Invalid query: Unknown column 'Array' in 'where clause'

 

Still pondering if this problem lies in      $this->SPT_URL_PARAM = 0; //No dollar sign

 

If you can think of anything else, I would appreciate it!

Link to comment
Share on other sites

I am trying to locate where this problem lies but dosnt seem to be in any of this area of the code.

<?php

class Paging
{
#== Configurable Variables
var $TOTAL_RECORDS;
var $RECORDS_PER_PAGE;
var $PAGELINKS_PER_PAGE;
var $SPT_SQL_WITH_LIMIT;
var $SPT_URL_PARAM;

#== Non-Configurable Variables
var $strErrorMsg;
var $intCurrentPage;
var $strJSCode;

function Paging($arrParentParam)
{
      print_r($arrParentParam); //If it's an array, you need to use print_r()
      $arrParentParam['SPT_URL_PARAM'] = '0'; //No dollar sign
  print_r($arrParentParam);
      if(!is_array($arrParentParam)) $arrParentParam=array();

 

I dont think be me adding the SPT_URL_PARAM to the Parent Param really did anything but it is chaging the array var now

Array ( [TOTAL_RECORDS] => 3 [RECORDS_PER_PAGE] => 10 [PAGELINKS_PER_PAGE] => 10 [sPT_URL_PARAM] => 1 ) Array ( [TOTAL_RECORDS] => 3 [RECORDS_PER_PAGE] => 10 [PAGELINKS_PER_PAGE] => 10 [sPT_URL_PARAM] => 0 ) Invalid query: Unknown column 'Array' in 'where clause'

 

I think there is a function in Paging.class that is f'ed up and cant access some unknown column

 

 

Link to comment
Share on other sites

no, the problem shouldn't be with Paging or $arrParentParam...the error is coming from here right:

if($_POST['btnAction']=="delete"  && isset($_POST['selection'])){
      // delete the eflyer account
      $selection = $_POST['selection'];
      $selection_arr=count($selection);
      for($i=0;$i<$selection_arr;$i++){
      $sql_del_eflyer = "delete from tbleflyer  WHERE Eflyer_id ='".$selection_arr[$i]."'"; //Needs to be $selection_arr
      $enRes = mysql_query($sql_del_eflyer)or die("Invalid query: " . mysql_error());
      $sql_insert_History="insert into tblhistoryeflyer (History_user_id ,History_eflyer_id) values('".$_SESSION['userID']."','".$selection_arr[$i]."')"; //Needs to be $selection_arr
      $res_insert_History= mysql_query($sql_insert_History)or die("Invalid query: " . mysql_error());
      }

did you update that file like i said to earlier? change it to this and see what it does:

if($_POST['btnAction']=="delete"  && isset($_POST['selection'])){
      // delete the eflyer account
      $selection = $_POST['selection'];
      $selection_arr=count($selection);
      for($i=0;$i<$selection_arr;$i++){
        $sql_del_eflyer = "delete from tbleflyer  WHERE Eflyer_id ='".$selection_arr[$i]."'"; //Needs to be $selection_arr
        $enRes = mysql_query($sql_del_eflyer)or die("Invalid query: " . mysql_error());
        $sql_insert_History="insert into tblhistoryeflyer (History_user_id ,History_eflyer_id) values('".$_SESSION['userID']."','".$selection_arr[$i]."')"; //Needs to be $selection_arr
        $res_insert_History= mysql_query($sql_insert_History)or die("Invalid query '$sql_insert_History': " . mysql_error());
      }

Link to comment
Share on other sites

You are so very right about it coming from there and i think i tracked it down to the line but still am stumped  ???

Array ( [TOTAL_RECORDS] => 4 [RECORDS_PER_PAGE] => 10 [PAGELINKS_PER_PAGE] => 10 ) Array ( [TOTAL_RECORDS] => 4 [RECORDS_PER_PAGE] => 10 [PAGELINKS_PER_PAGE] => 10 ) Invalid query: Unknown column 'Array' in 'where clause'

 

I think the error lies somewhere in the code below...

 

this code     

 $sql_del_eflyer = "delete from tbleflyer  WHERE Eflyer_id ='".$selection_arr[$i]."'"; //Needs to be $selection_arr

 

or this line...

     

 $sql_insert_History="insert into tblhistoryeflyer (History_user_id ,History_eflyer_id) values('".$_SESSION['userID']."','".$selection_arr[$i]."')";

 

I am pretty sure there is something screwed up here but looking in phpadmin... all the table names and stuff are correct to the best of my knowledge by comparison.

 

You are the most awesome Anon i know and truly thank you for the help you have givin so far....

 

Im so broke and just want to get this going so i can make money again....

 

I have changed the userID in SESSION to user in the line below as a test

$sql_slct_eflyer="select * from  tbleflyer where Eflyer_user_id='".$_SESSION['userID']."'";

 

and the page loaded! BUT with out the eflyers listed from the mysql of course...

 

Thx again and I will give you logins for my online database of music, movies and software once i can sleep at night form this catastrophe of a disaster...

 

Link to comment
Share on other sites

I got it working! I did what you said and traced it down. stupid $ was fing things up....

 

Now everything works EXECPT the darn payment side of it... I am using a paypal API to send payment, check this out...

 

The payment goes through and I see the money land in the paypal account but my programmer used a file called xml2array.php to return the payment information so it can email the user and add a credit into the mysql database so they can use the credit to send their flyer out.

 

at first I didnt see any file called xml2array.php so I did some googlein and found a file just by that name... so I tossed it up and had these errors below.

 

 

 

Warning: Call-time pass-by-reference has been deprecated in /home/content/s/h/o/shouthouse/html/DMTMAIL.COM/includes/xml2array.php on line 64

Warning: Call-time pass-by-reference has been deprecated in /home/content/s/h/o/shouthouse/html/DMTMAIL.COM/includes/xml2array.php on line 64

Warning: Call-time pass-by-reference has been deprecated in /home/content/s/h/o/shouthouse/html/DMTMAIL.COM/includes/xml2array.php on line 65

Warning: Call-time pass-by-reference has been deprecated in /home/content/s/h/o/shouthouse/html/DMTMAIL.COM/includes/xml2array.php on line 66

Warning: Call-time pass-by-reference has been deprecated in /home/content/s/h/o/shouthouse/html/DMTMAIL.COM/includes/xml2array.php on line 68

Warning: Call-time pass-by-reference has been deprecated in /home/content/s/h/o/shouthouse/html/DMTMAIL.COM/includes/xml2array.php on line 73

Warning: Call-time pass-by-reference has been deprecated in /home/content/s/h/o/shouthouse/html/DMTMAIL.COM/includes/xml2array.php on line 73

 

now after I look at these lines , I noticed that there where aperand "&" symbols in the xml2array file and did more googleing and seen that PHP5 does not need that symbol.......... sooooooooooooooooooooooooo

I removed them but it still is not passing the information to my database!!!    this makes me a very sad panda...

 

There are 2 files mainly involved that I know of.

credit.php

paypalclass.php <- this file calls a bunch of stuff that I am clueless about

 

but it gets worse, after looking at my back ups of the old site I have a ton of paypal code that is mindboggling to me.

here is the tree of crazyness

tree.gif

So I call upon the powers of MacGyver to help me out once again :)

 

Here is a screenshot of the error on the credit.php page

damnit.gif

NOTE that i found where that error displays and changed it to "timed out error , please up credits"

 

here is the code for credit.php with that error on line 981

<? session_start();

include_once ('includes/database.php');

include_once ("includes/dbFunc.php");

if (!isset($_SESSION['user']))

	{

header("Location: login.php"); /* Redirect browser */

exit;  

}

function folderMake($eflyerId){



$sql_eflyer="select * from tbleflyer where Eflyer_Id='".$eflyerId."' and Eflyer_user_id='".$_SESSION['userID']."'";

$res_eflyer= mysql_query($sql_eflyer)or die("Invalid query: " . mysql_error());

$numRows=mysql_num_rows($res_eflyer);

if($numRows>0){



$row_eflyer=mysql_fetch_array($res_eflyer, MYSQL_BOTH);



$root=$_SERVER['DOCUMENT_ROOT'];

$dir=substr($row_eflyer['Eflyer_Name'],0,3).'_'.$row_eflyer['Eflyer_Id'].'_'.$_SESSION['userID'];

$root=$root.'/template/eflyer/'.$dir;

mkdir($root,0777);

mkdir($root.'/images',0777);







$sql_property_select="select * from tblpropertydetail where Eflyer_Id='".$eflyerId."'";





$res_property_select= mysql_query($sql_property_select)or die("Invalid query: " . mysql_error());



$row=mysql_fetch_array($res_property_select, MYSQL_BOTH);





$Email_Subject=$row['Email_Subject'];

$Property_Address=$row['Property_Address'];

$Mls=$row['Mls'];

$List_Price=$row['List_Price'];

$Header_Comment=$row['Header_Comment'];

$Bedrooms=$row['Bedrooms'];

$Bathrooms=$row['Bathrooms'];

$Year_Built=$row['Year_Built'];

$Area_Town=$row['Area_Town'];

$Remark_Property=$row['Remark_Property'];

$Virtual_Tour_Link=$row['Virtual_Tour_Link'];

$Open_House_Date=$row['Open_House_Date'];

$OPen_House_Time=$row['OPen_House_Time'];

$Picture1=$row['Picture1'];

$Picture2=$row['Picture2'];

$Picture3=$row['Picture3'];

$Picture4=$row['Picture4'];

$Picture5=$row['Picture5'];

$Picture6=$row['Picture6'];

$Picture7=$row['Picture7'];

$Picture8=$row['Picture8'];

if($row['highlight1']!='')

$highlight1="<p class='style5'> ".$row['highlight1']." </p>";

if($row['highlight2']!='')

$highlight2="<p class='style5'> ".$row['highlight2']." </p>";

if($row['highlight3']!='')

$highlight3="<p class='style5'> ".$row['highlight3']." </p>";

if($row['highlight4']!='')

$highlight4="<p class='style5'> ".$row['highlight4']." </p>";

if($row['highlight5']!='')

$highlight5="<p class='style5'> ".$row['highlight5']." </p>";

if($row['highlight6']!='')

$highlight6="<p class='style5'> ".$row['highlight6']." </p>";

if($row['highlight7']!='')

$highlight7="<p class='style5'> ".$row['highlight7']." </p>";

if($row['highlight8']!='')

$highlight8="<p class='style5'> ".$row['highlight8']." </p>";

if($row['highlight9']!='')

$highlight9="<p class='style5'> ".$row['highlight9']." </p>";

if($row['highlight10']!='')

$highlight10="<p class='style5'> ".$row['highlight10']." </p>";

if($row['highlight11']!='')

$highlight11="<p class='style5'> ".$row['highlight11']." </p>";

if($row['highlight12']!='')

$highlight12="<p class='style5'> ".$row['highlight12']." </p>";



$imagePath="http://www.DMTmail.com/template/eflyer/".$dir."/images";







if($Picture1!="")

copy($_SERVER['DOCUMENT_ROOT'].'/images/users/'.$Picture1,$root.'/images/'.$Picture1);

if($Picture2!="")

copy($_SERVER['DOCUMENT_ROOT'].'/images/users/'.$Picture2,$root.'/images/'.$Picture2);

if($Picture3!="")

copy($_SERVER['DOCUMENT_ROOT'].'/images/users/'.$Picture3,$root.'/images/'.$Picture3);

if($Picture4!="")

copy($_SERVER['DOCUMENT_ROOT'].'/images/users/'.$Picture4,$root.'/images/'.$Picture4);

if($Picture5!="")

copy($_SERVER['DOCUMENT_ROOT'].'/images/users/'.$Picture5,$root.'/images/'.$Picture5);

if($Picture6!="")

copy($_SERVER['DOCUMENT_ROOT'].'/images/users/'.$Picture6,$root.'/images/'.$Picture6);

if($Picture7!="")

copy($_SERVER['DOCUMENT_ROOT'].'/images/users/'.$Picture7,$root.'/images/'.$Picture7);

if($Picture8!="")

copy($_SERVER['DOCUMENT_ROOT'].'/images/users/'.$Picture8,$root.'/images/'.$Picture8);



if($row_eflyer['Eflyer_Template']=='1')

$data=file_get_contents("template/classic1pic.html");

else if($row_eflyer['Eflyer_Template']=='2')

$data=file_get_contents("template/classic4pic.html");

else if($row_eflyer['Eflyer_Template']=='3')

$data=file_get_contents("template/highlights1pic.html");

else if($row_eflyer['Eflyer_Template']=='4')

$data=file_get_contents("template/highlights4pic.html");

else if($row_eflyer['Eflyer_Template']=='5')

$data=file_get_contents("template/rounded5pic.html");

else if($row_eflyer['Eflyer_Template']=='6')

$data=file_get_contents("template/rounded8pic.html");



$credinfo=$row_eflyer['Eflyer_credit'];



$HeaderImage=$row_eflyer['Eflyer_header'].'/'.$row_eflyer['Eflyer_Color'].'.gif';

$bordercolor='#'.$row_eflyer['Eflyer_tab_color'];

$headingcolor='#'.$row_eflyer['Eflyer_header_color'];

$pricecolor=$row_eflyer['Eflyer_price_color'];

$listpricetag='<font color="'.$pricecolor.'">$'.$List_Price.'</font>';



$data=eregi_replace("%%headerImage%%",$HeaderImage,$data);

$data=eregi_replace("%%headercomments%%",$Header_Comment,$data);



$data=eregi_replace("%%listprice%%",$listpricetag,$data);

$data=eregi_replace("%%propertyaddress%%",$Property_Address,$data);

$data=eregi_replace("%%city%%","",$data);

$data=eregi_replace("%%state%%","",$data);

$data=eregi_replace("%%emailsubject%%",$Email_Subject,$data);

$data=eregi_replace("%%tabcolor%%",$bordercolor,$data);

$data=eregi_replace("%%headercmnt%%",$headingcolor,$data);







$data=eregi_replace("%%pic1%%",'./images/'.$Picture1,$data);

$data=eregi_replace("%%pic2%%",'./images/'.$Picture2,$data);

$data=eregi_replace("%%pic3%%",'./images/'.$Picture3,$data);

$data=eregi_replace("%%pic4%%",'./images/'.$Picture4,$data);

$data=eregi_replace("%%pic5%%",'./images/'.$Picture5,$data);

$data=eregi_replace("%%pic6%%",'./images/'.$Picture6,$data);

$data=eregi_replace("%%pic7%%",'./images/'.$Picture7,$data);

$data=eregi_replace("%%pic8%%",'./images/'.$Picture8,$data);



$data=eregi_replace("%%highlight1%%",$highlight1,$data);

$data=eregi_replace("%%highlight2%%",$highlight2,$data);

$data=eregi_replace("%%highlight3%%",$highlight3,$data);

$data=eregi_replace("%%highlight4%%",$highlight4,$data);

$data=eregi_replace("%%highlight5%%",$highlight5,$data);

$data=eregi_replace("%%highlight6%%",$highlight6,$data);

$data=eregi_replace("%%highlight7%%",$highlight7,$data);

$data=eregi_replace("%%highlight8%%",$highlight8,$data);

$data=eregi_replace("%%highlight9%%",$highlight9,$data);

$data=eregi_replace("%%highlight10%%",$highlight10,$data);

$data=eregi_replace("%%highlight11%%",$highlight11,$data);

$data=eregi_replace("%%highlight12%%",$highlight12,$data);



$data=eregi_replace("%%mlsno%%",$Mls,$data);

$data=eregi_replace("%%areaoftown%%",$Area_Town,$data);

$data=eregi_replace("%%sqft%%","",$data);

$data=eregi_replace("%%noofbedroom%%",$Bedrooms,$data);

$data=eregi_replace("%%noofbathroom%%",$Bathrooms,$data);

$data=eregi_replace("%%yearbuilt%%",$Year_Built,$data);

if($Open_House_Date!='' || $OPen_House_Time!=''){

$data=eregi_replace("%%date%%","Open House at : <br />".$Open_House_Date,$data);

$data=eregi_replace("%%time%%"," / ".$OPen_House_Time,$data);

}else{

$data=eregi_replace("%%date%%","",$data);

$data=eregi_replace("%%time%%","",$data);

}

$data=eregi_replace("%%remarksonproperty%%",$Remark_Property,$data);

$data=eregi_replace("%%virtualtourlink%%",$Virtual_Tour_Link,$data);





$sql_user="select * from users where user_id='".$_SESSION['userID']."'";

$result_user= mysql_query($sql_user)or die("Invalid query: " . mysql_error());

$row_user=mysql_fetch_array($result_user, MYSQL_BOTH);



$data=eregi_replace("%%membersname%%",$row_user['fullname'],$data);

$data=eregi_replace("%%memberscompany%%",$row_user['company'],$data);

$data=eregi_replace("%%phone%%",$row_user['phone'],$data);

$data=eregi_replace("%%memberemail%%",$row_user['username'],$data);

$data=eregi_replace("%%memberwebsite%%",$row_user['website'],$data);

$data=eregi_replace("%%agentAddress%%",$row_user['address1'],$data);

$data=eregi_replace("%%agentCity%%",$row_user['city'],$data);

$data=eregi_replace("%%agentState%%",$row_user['state'],$data);





if($row_user['thumb_logo']!=""){

copy($_SERVER['DOCUMENT_ROOT'].'/images/users/'.$row_user['thumb_logo'],$root.'/images/'.$row_user['thumb_logo']);

$data=eregi_replace("%%memeberlogo%%",'./images/'.$row_user['thumb_logo'],$data);

}else{

$data=eregi_replace("%%memeberlogo%%",'',$data);

}



if($row_user['thumb_picture']!=""){

copy($_SERVER['DOCUMENT_ROOT'].'/images/users/'.$row_user['thumb_picture'],$root.'/images/'.$row_user['thumb_picture']);

$data=eregi_replace("%%memeberpic%%",'./images/'.$row_user['thumb_picture'],$data);

}else{

$data=eregi_replace("%%memeberpic%%",'',$data);

}



$data=eregi_replace("%%imagePath%%",$imagePath,$data);



$data=eregi_replace("%%tempfooter%%","",$data);



$filename=$root.'/'.$dir.'.html';

$handle = fopen($filename, "wb");

if (!fwrite($handle, $data)) {

       $foldermsg='0';// echo "Cannot write to file ($filename)";

        

    }

    

    $foldermsg='1';//echo "Success, wrote ($data) to file ($filename)";

    

    fclose($handle);

return $dir;

}

}





if(isset($_POST['saveproof'])){



$sql_slect_user="select account from users  where user_id='".$_SESSION['userID']."'";

$res_slect_user= mysql_query($sql_slect_user)or die("Invalid query: " . mysql_error());



$rws_slect_user=mysql_fetch_array($res_slect_user, MYSQL_BOTH);

$credits=$rws_slect_user['account'];

$select_colors=$_POST['colorSlct'];

$select_header=$_POST['headerSlct'];

$select_tabcolors=$_POST['select_tabcolors']; 

$select_headercmnt=$_POST['select_headercmnt']; 

$select_pricecolors=$_POST['select_pricecolors']; 

$sql_update_eflyer="update tbleflyer set Eflyer_status='0',Eflyer_edit_request='',Eflyer_header='".$select_header."',Eflyer_Color='".$select_colors."',Eflyer_tab_color='".$select_tabcolors."',Eflyer_header_color='".$select_headercmnt."',Eflyer_price_color='".$select_pricecolors."' where Eflyer_Id='".$_POST['eflyer_id']."'";

	$res_update_eflyer= mysql_query($sql_update_eflyer)or die("Invalid query: " . mysql_error());



/*$sql_update_user="update users set  account='".$_POST['credinfo']."' where user_id='".$_SESSION['userID']."'";

	$res_update_user= mysql_query($sql_update_user)or die("Invalid query: " . mysql_error());*/





$sql_insert_History="insert into tblhistoryeflyer (History_user_id ,History_eflyer_id,History_action) values('".$_SESSION['userID']."','".$_POST['eflyer_id']."','Update Eflyer To Pending')";

	$res_insert_History= mysql_query($sql_insert_History)or die("Invalid query: " . mysql_error());	



$credits_info=$credits-$_POST['credinfo'];

if($credits_info>=0){

	$sql_update_user="update users set  account='".$credits_info."' where user_id='".$_SESSION['userID']."'";

	$res_update_user= mysql_query($sql_update_user)or die("Invalid query: " . mysql_error());



	$foldername=folderMake($_POST['eflyer_id']);



	$sql_update_eflyer="update tbleflyer set Eflyer_status='2',Eflyer_folder= '".$foldername."' where Eflyer_Id='".$_POST['eflyer_id']."'";

	$res_update_eflyer= mysql_query($sql_update_eflyer)or die("Invalid query: " . mysql_error());



	$sql_insert_History="insert into tblhistoryeflyer (History_user_id ,History_eflyer_id,History_action) values('".$_SESSION['userID']."','".$_POST['eflyer_id']."','Update Eflyer To Paid')";

	$res_insert_History= mysql_query($sql_insert_History)or die("Invalid query: " . mysql_error());	



//mail code inserted to send eflyer generation email

			$sql_slct="select * from tbleflyer where Eflyer_Id='".$eflyer."'";	

$result=mysql_query($sql_slct) or die($sql_slct);

$row=mysql_fetch_array($result);

$sql_slct_area="select * from tblareadef where area_id in(".$row['Area_Send'].")";

$res_slct_area=mysql_query($sql_slct_area) or die($sql_slct_area);

$area_strng="";

while($row_slct_area=mysql_fetch_array($res_slct_area)){

	$area_strng.=$row_slct_area['area_def'];

}

			$subject="D M T mail - Your E-Flyer Has Been Received";

			$message="Hello ".$_SESSION['user'].",\n



Thank you for your E-Flyer business! Your transaction details are below.

We will send it on the date you provided.

Note. If your E-Flyer is being sent same day, please allow up to 4 hours

for your E-Flyer to be sent out.\n



E-Flyer Details---

Eflyer Name :".$unique_name."\n

Date to send :".$row['Date_Send']."\n

Area to send :".$area_strng."\n



Thank you for your business,



Technical Support

Tech@DMTmail.com

(702) 355-6672



D M T mail, Inc.

2550 E Desert Inn Rd #280

Las Vegas, NV 89121";

			mailfunction($_SESSION['user'],$subject,$message);





	//mail code inserted to send eflyer generation email end here		

	header("location:eflyerListing.php");

	exit;

}





$message="Your are having ".$credits." credits and you required ".abs($credits_info)." credits" ;

}	



if (isset($_POST['upd']))

	{



	include_once ('paypalclass.php');



	$ccNum=$_POST['accnumber'];

	$expMonth=$_POST['lstMonth'];

	$expYear=$_POST['lstYear'];

	$ccVerCode=$_POST['cardcode'];

	$ccFName=$_POST['ccFName'];

	$ccLName=$_POST['ccLName'];

	$street2=$_POST['street2'];

	$street1=$_POST['street1'];

	$city=$_POST['city'];

	$state=$_POST['state'];

	$zip=$_POST['zip'];

	$phone=$_POST['phone'];

	$purchase=$_POST['purchase'];

	$email=$_SESSION['user'];

	$eflyer=$_POST['eflyer'];



	$sql_cred="select * from tblcredit where Credit='".$purchase."'";

	$res_cred= mysql_query($sql_cred)or die("Invalid query: " . mysql_error());

	$rw_cred=mysql_fetch_array($res_cred, MYSQL_BOTH);

	$total=number_format($rw_cred['Credit_rate'], 2, '.', '');



	if($_POST['lstCardType']=="AE")

		$cctype="Amex";

        if($_POST['lstCardType']=="DI")

		$cctype="Discover";

	if($_POST['lstCardType']=="MC")

		$cctype="MasterCard";

	if($_POST['lstCardType']=="VI")

		$cctype="Visa";

       

$sql_paymt="INSERT INTO `tblPaymentdetail` (`ccNum` , `expMonth` , `expYear` , `ccVerCode` , `ccFName` , `ccLName` , `street2` , `street1` , `city` , `state` , `zip` , `phone` , `purchase` , `email` , `eflyer` , `ccType` , `user_id` )

VALUES (

'".$ccNum."', '".$expMonth."', '".$expYear."', '".$ccVerCode."', '".$ccFName."', '".$ccLName."', '".$street2."', '".$street1."', '".$city."', '".$state."', '".$zip."', '".$phone."', '".$purchase." - ".$total."', '".$email."', '".$eflyer."', '".$cctype."','".$_SESSION['userID']."')";  

$res_pymt=mysql_query($sql_paymt) or die($sql_paymt);

$paymt_id=mysql_insert_id();



	$vals = array

(

"PaymentAction" => "Sale", # Sale or Auth * REQUIRED

"CurrencyID" => "USD", # 3 digit country code * REQUIRED

"OrderTotal" => $total, # Total amount (inc. sh/h) * REQUIRED



#Credit Card Details

"FirstName" => $ccFName, # * REQUIRED

"LastName" => $ccLName, # * REQUIRED

"CreditCardType" => $cctype, # * REQUIRED

"CreditCardNumber" => $ccNum, # * REQUIRED

"CVV2" => $ccVerCode, # * REQUIRED

"ExpMonth" => $expMonth, # * REQUIRED

"ExpYear" => $expYear, # * REQUIRED

# Credit card billing address *PayerEmail is not required-other fields are

"PayerEmail" => $email,

"PayerStreet1" => $street1, # * REQUIRED

"PayerCity" => $city, # * REQUIRED

"PayerState" => $state, # * REQUIRED

"PayerPostalCode" => $zip, # * REQUIRED

"PayerCountry" => "US", # *Two digit country code * REQUIRED

# Shipping address info * These may be REQUIRED

# As a safety measure - if you do not require a shipping address

# Clone the shipping from the credit card details and send them regardless.

"ShipToName" => $ccFName." ".$ccLName,

"ShipToStreet1" => $street1,

"ShipToCity" => $city,

"ShipToState" => $state,

"ShipToPostalCode" => $zip,

"ShipToCountry" => "US",

# Additional fields

"IPAddress" => $_SERVER['REMOTE_ADDR'], # * REQUIRED

"ItemTotal"=>$total, // this must add up to what is below and must be set.

"PaymentDetailsItem"=>array(

	"0" => array("Eflyer"=>$eflyer, "Amount"=>$total, "Credit"=>$purchase)

	)

);



$paypal =& new PayPal();

$paypal->setCall('DoDirectPayment', $vals);

$result = $paypal->getResult();



$acknowledge=$result['Ack'];

$transaction_id=$result['TransactionID'];

$LongMessage=$result['LongMessage'];

$ShortMessage=$result['ShortMessage'];

/*Timestamp

ErrorCode

ErrorCode

FailureArray ( [Timestamp attr] => Array ( [xmlns] => urn:ebay:apis:eBLBaseComponents ) [Timestamp] => 2006-11-16T15:41:37Z [Ack attr] => Array ( [xmlns] => urn:ebay:apis:eBLBaseComponents ) [Ack] => Failure [CorrelationID attr] => Array ( [xmlns] => urn:ebay:apis:eBLBaseComponents ) [CorrelationID] => 1e9e43961eaa [Errors] => Array ( [0 attr] => Array ( [xmlns] => urn:ebay:apis:eBLBaseComponents [xsi:type] => ebl:ErrorType ) [0] => Array ( [shortMessage attr] => Array ( [xsi:type] => xs:string ) [shortMessage] => Invalid Data [LongMessage attr] => Array ( [xsi:type] => xs:string ) [LongMessage] => This transaction cannot be processed. Please enter a valid credit card expiration month. [ErrorCode attr] => Array ( [xsi:type] => xs:token ) [ErrorCode] => 10563 [severityCode attr] => Array ( [xmlns] => urn:ebay:apis:eBLBaseComponents ) [severityCode] => Error ) [1 attr] => Array ( [xmlns] => urn:ebay:apis:eBLBaseComponents [xsi:type] => ebl:ErrorType ) [1] => Array ( [shortMessage attr] => Array ( [xsi:type] => xs:string ) [shortMessage] => Invalid Data [LongMessage attr] => Array ( [xsi:type] => xs:string ) [LongMessage] => This transaction cannot be processed. Please enter a valid credit card expiration year. [ErrorCode attr] => Array ( [xsi:type] => xs:token ) [ErrorCode] => 10562 [severityCode attr] => Array ( [xmlns] => urn:ebay:apis:eBLBaseComponents ) [severityCode] => Error ) ) [Version attr] => Array ( [xmlns] => urn:ebay:apis:eBLBaseComponents ) [Version] => 2.100000 [build attr] => Array ( [xmlns] => urn:ebay:apis:eBLBaseComponents ) [build] => 1.0006 )



*/

if(strtoupper($acknowledge)=='SUCCESS'){



$sql_update_user="update users set  account='".$credits_info."' where user_id='".$_SESSION['userID']."'";

	$res_update_user= mysql_query($sql_update_user)or die("Invalid query: " . mysql_error());



$sql_paymt_update="UPDATE `tblPaymentdetail` SET `transaction_id` = '".$transaction_id."',

`LongMessage` = '".$LongMessage."',

`ShortMessage` = '".$ShortMessage."',

`acknowledge` = '".strtoupper($acknowledge)."' WHERE `payment_id` = '".$paymt_id."' "; 

$res_pymt_update=mysql_query($sql_paymt_update) or die($sql_paymt_update);



	if($eflyer!='Bulk'){

	$foldername=folderMake($eflyer);



	$sql_update_eflyer="update tbleflyer set Eflyer_status='2',Eflyer_edit_request='',Eflyer_folder= '".$foldername."' where Eflyer_Id='".$eflyer."'";

	$res_update_eflyer= mysql_query($sql_update_eflyer)or die("Invalid query: " . mysql_error());



	$sql_insert_History="insert into tblhistoryeflyer (History_user_id ,History_eflyer_id,History_action) values('".$_SESSION['userID']."','".$eflyer."','Update Eflyer To Paid')";

	$res_insert_History= mysql_query($sql_insert_History)or die("Invalid query: " . mysql_error());	



//mail code inserted to send eflyer generation email

$sql_slct="select * from tbleflyer where Eflyer_Id='".$eflyer."'";	

$result=mysql_query($sql_slct) or die($sql_slct);

$row=mysql_fetch_array($result);

$sql_slct_area="select * from tblareadef where area_id in(".$row['Area_Send'].")";

$res_slct_area=mysql_query($sql_slct_area) or die($sql_slct_area);

$area_strng="";

while($row_slct_area=mysql_fetch_array($res_slct_area)){

	$area_strng.=$row_slct_area['area_def'];

}

			$subject="D M T mail - Your E-Flyer Has Been Received";

			$message="Hello ".$_SESSION['user'].",\n



Thank you for your E-Flyer business! Your transaction details are below.

We will send it on the date you provided.

Note. If your E-Flyer is being sent same day, please allow up to 4 hours

for your E-Flyer to be sent out.\n



E-Flyer Details---

Eflyer Name :".$unique_name."\n

Date to send :".$row['Date_Send']."\n

Area to send :".$area_strng."\n



Thank you for your business,



Technical Support

Tech@DMTmail.com

(702) 355-6672



D M T mail, Inc.

2550 E Desert Inn Rd #280

Las Vegas, NV 89121";

			mailfunction($_SESSION['user'],$subject,$message);



			}

//mail code inserted to send eflyer generation email

			$subject="D M T mail - Thank you for your payment";

			$message="Hello ".$_SESSION['user'].",\n



Thank you for your prompt payment! Your transaction details are below.

You will now be able to start using your credit immediately!

If you have any questions about your transaction, please contact us

via any of the contact info below. Thank you again\n



Order Details---\n

Eflyer Name :".$unique_name."\n

Eflyer Credit :".$purchase."\n

Amount :".$total."\n

transaction Id :".$transaction_id."\n

Thank you for your business,\n



Billing Support

Billing@DMTmail.com

(702) 355-6672



D M T mail, Inc.

2550 E Desert Inn Rd #280

Las Vegas, NV 89121";

			mailfunction($_SESSION['user'],$subject,$message);









	//mail code inserted to send eflyer generation email end here		

	header("location:eflyerListing.php");

	exit;



}elseif(strtoupper($acknowledge)=="FAILURE"){

$message="Your are having transaction error , please up credits" ;



$sql_paymt_update="UPDATE `tblPaymentdetail` SET `transaction_id` = '".$transaction_id."',

`LongMessage` = '".$LongMessage."',

`ShortMessage` = '".$ShortMessage."',

`acknowledge` = '".strtoupper($acknowledge)."' WHERE `payment_id` = '".$paymt_id."' "; 

$res_pymt_update=mysql_query($sql_paymt_update) or die($sql_paymt_update);

}

else

{

$message="timed out error , please up credits" ;



$sql_paymt_update="UPDATE `tblPaymentdetail` SET `transaction_id` = '',

`LongMessage` = '',

`ShortMessage` = '',

`acknowledge` = 'timed out' WHERE `payment_id` = '".$paymt_id."' "; 

$res_pymt_update=mysql_query($sql_paymt_update) or die($sql_paymt_update);

}



}



$areaDef=""; 



$sql_state="select * from tblusstates order by id ";

$res_state= mysql_query($sql_state)or die("Invalid query: " . mysql_error());



$num_rows = mysql_num_rows($res_state);

if($num_rows>0){

	//$areaDef.='<table><tr></td>';

	while($rw = mysql_fetch_array($res_state, MYSQL_BOTH)){

		$areaDef.='<div id="state'.$rw['id'].'" style="display: none;">';

		$sql_area="select * from tblareadef where area_state='".$rw['id']."'";

		$res_area= mysql_query($sql_area)or die("Invalid query: " . mysql_error());

		$num_rws=0;

		$num_rws = mysql_num_rows($res_area);

		if($num_rws>0){

			$areaDef.='<table style="width: 405px;"><tbody><tr>';

			while($row = mysql_fetch_array($res_area, MYSQL_BOTH)){

				$areaDef.='<td>'.$row['area_def'].'<br>'.$row['area_cost'].' Credit<br><a href="#" onclick="alert(\''.$row['area_cities'].'\');">[show Cities]</a>

						<input id="lists" name="lists[]" value="'.$row['area_id'].'" onclick="totalCredits()" type="checkbox">

						<input id="name'.$row['area_id'].'" name="name'.$row['area_id'].'" value="'.$row['area_def'].'" type="hidden">

						<input id="cost'.$row['area_id'].'" name="cost'.$row['area_id'].'" value="'.$row['area_cost'].'" type="hidden">

					</td>';

					}

				$areaDef.='</tr></tbody></table>';

			}

		$areaDef.='</div>';

		}

		//$areaDef.='</td></tr></table>';

	}



	$allstate=slctsTATES();



	$creditOpt="";

$sql_slct_credit="select * from  tblcredit ";

$res_slct_credit= mysql_query($sql_slct_credit)or die("Invalid query: " . mysql_error());

while($rw_slct=mysql_fetch_array($res_slct_credit, MYSQL_BOTH)){

	if(isset($_POST['credinfo']) && $_POST['credinfo']==$rw_slct['Credit'])

	$creditOpt.='<option value="'.$rw_slct['Credit'].'" selected>'.$rw_slct['Credit'].' Credit - $'.number_format($rw_slct['Credit_rate'], 2, '.', '').'   '.$rw_slct['Credit_descp'].'</option>';

	else

$creditOpt.='<option value="'.$rw_slct['Credit'].'">'.$rw_slct['Credit'].' Credit - $'.number_format($rw_slct['Credit_rate'], 2, '.', '').'   '.$rw_slct['Credit_descp'].'</option>';

}

// conetent start   	

$data=file_get_contents("template/heade_left_footer.html");

//$data=file_get_contents("template/header_footer.html");

$data=eregi_replace("%%title%%","E-Flyer Credit",$data);





$data2=file_get_contents("template/left.html");

$data=eregi_replace("%%left_table%%",$data2,$data);

$data3=file_get_contents("template/credit.html"); 

$data3=eregi_replace("%%credit%%","credit.php",$data3);

$data3=eregi_replace("%%creditOpt%%",$creditOpt,$data3);

$data3=eregi_replace("%%email%%",$_SESSION['user'],$data3);

if(isset($_POST['eflyer_id']))

$data3=eregi_replace("%%eflyer%%",$_POST['eflyer_id'],$data3);

else

$data3=eregi_replace("%%eflyer%%","Bulk",$data3);



$data3=eregi_replace("%%stateSelect%%",$allstate,$data3);

$data3=eregi_replace("%%areaDef%%","",$data3);



$data=eregi_replace("%%inner_table%%",$data3,$data);

if (isset($message))

{

$data=eregi_replace("<!--MESSAGE","<!--MESSAGE-->",$data);

$data=eregi_replace("MESSAGE-->","<!--MESSAGE-->",$data);

$data=eregi_replace("%%message%%",$message,$data);

}

print $data;

exit();

?>

 

I will post the rest of the code below this in another reply

Link to comment
Share on other sites

<?php
/** -------------------------------------
* @copyright 2005 PayPal, Inc
* @author colson
* @license CPL 1.0
* @link http://opensource.org/licenses/cpl1.0.txt (license link)
* @link http://www.paypaltech.com
* @link http://ospaypal.com (off site development and dev builds)
*/ #-------------------------------------
class PayPal
{
/**
*	Define the class variables.
*
* 	Note: I've forced some variables set to specific values
* 	and items listed below the line in the class, marked "do not edit"
* 	should be left alone.
*/

/**
* @var string - private variable that holds the endpoint URL
*/
  var $_apiURL = "https://api.paypal.com/2.0/";
/**
* @var string - full path to the certificate file
*/
  var $_cert = "includes/cert_key_pem.txt";
/**
* @var string - The username set in the class. In PHP 4 there is no way
* to protect this variable from the outside.
*/
  var $_user = "XXXXXXXXXXXXXXXXXXXX";
/**
* @var string - PayPal API password.
*/
  var $_pwd = "XXXXXXXXXXXXXXXXXXXX";
  #*************************/

/**
* @var string - container for the filename and used to set the paths
* to the template directories
*/
  var $_filename;
/**
* @var string - path to the soap header files
*/
  var $_soapheader = "./paypaltemplates/header.php";
/**
* @var string - path to the soap footer files
*/
  var $_soapfooter = "./paypaltemplates/footer.php";
/**
* @var string - only used when setting up for 3rd party access
*/
  var $_subject = null;
/**
* @var string - a full and complete soap request
*/
  var $_request;
/**
* @var string - the result of the API call
*/
  var $_result;
/**
* @var string
*/
  var $_xmlArray;
/**
* @var string
*/
  var $_values;
/**
* @var string
*/
  var $_call;
/**
* @var string
* @access private - This variable holds error strings to be returned by the parser
*/
  var $_errors;
/**
* @var float - The API version to run calls against. This can remain
* static and will increment on new releases of this SDK
*/
  var $_version = '2.1';

/**
  * @access public
  * @param string $call
  * @param mixed @values
  */

  function setCall($call, $values)
  {
    $this->_filename = "./paypaltemplates/" . $call . "/" . $call .".php";
    $this->_values = $values;
    $this->_call = $call;
  }
/**
* @access public
* @param string $path
*/
  # @private function setCert
  function setCert($path)
  {
    $this->_cert = $path;
  }
/**
  * @access public
  * @param string $user
  * @param string $pwd
  * @param mixed $subject
  */

  function setHeader($user, $pwd, $subject = null)
  {
    $this->_user = $user;
    $this->_pwd = $pwd;
    $this->_subject = $subject;

  }
/**
  * @access private
  */
  function getCall()
  {
    # Make the Soap Header available to us
    require_once("$this->_soapheader");
    # Everything is stored in the $SOAPrequest variable
    require_once("$this->_filename");
    require_once("$this->_soapfooter");
    # A fully stacked XML call
    $this->_request = $SOAPrequest;

  }
/**
  * @access public
  */
  function execute()
  {
  	$this->getCall();
  	$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"$this->_apiURL");
curl_setopt($ch, CURLOPT_SSLCERT, $this->_cert);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POSTFIELDS, "$this->_request");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

// the three curl settings below are for GoDaddy hosted accounts:
// curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, TRUE);
// curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);
// curl_setopt($ch, CURLOPT_PROXY, "http://64.202.165.130:3128");



$xmlResponse = curl_exec($ch);
$this->_result = $xmlResponse;

if (curl_error($ch))
{
	printf("Error %s: %s", curl_errno($ch), curl_error($ch));
}
curl_close ($ch);

return $this->_result;
  }
/**
  * @access private
  * @todo - This method will be replaced in a later version.
  */
  function xml2array ()
  {
  	require_once('./includes/xml2array.php');
  	$this->_xmlArray = XML_unserialize($this->_result);

  }

/**
  * @access public
  * @return array - This method will return a formatted array.
  */
  function getResult()
  {
  	$this->execute();
  	$this->xml2array();
  	
# Log the results.

	# Return the results - SOAP-ENV:Body payload only.

  	if ($this->_call == "SetExpressCheckout")
  	{
  		$rKey = "SetExpressCheckoutResponse";
  		$error = $this->_xmlArray["SOAP-ENV:Envelope"]["SOAP-ENV:Body"][$rKey][Errors];
  	}
  	elseif($this->_call == "GetExpressCheckout")
  	{
  		$rKey = "GetExpressCheckoutDetailsResponse";
  		$error = $this->_xmlArray["SOAP-ENV:Envelope"]["SOAP-ENV:Body"][$rKey][Errors];
  	}
  	elseif($this->_call == "DoExpressCheckout")
  	{
  		$rKey = "DoExpressCheckoutPaymentResponse";
  		# The whole reason for this section of code: DoExpCheckout puts errors a level
  		# deeper. This conditional catches this so that errors are all on the same level
  		# and accessible through the getErrors() method.
  		$error = $this->_xmlArray["SOAP-ENV:Envelope"]["SOAP-ENV:Body"][$rKey][Errors][0];
  	}
  	elseif($this->_call == "DoDirectPayment")
  	{
  		$rKey = "DoDirectPaymentResponse";
  		$error = $this->_xmlArray["SOAP-ENV:Envelope"]["SOAP-ENV:Body"][$rKey][Errors];

  	}
  	elseif($this->_call == "MassPay")
  	{
  		$rKey = "MassPayResponse";
  		$error = $this->_xmlArray["SOAP-ENV:Envelope"]["SOAP-ENV:Body"][$rKey][Errors];
  	}
  	else
  	{
  		die('Invalid Response from class');
  	}

if($this->_xmlArray["SOAP-ENV:Envelope"]["SOAP-ENV:Body"][$rKey][Ack] == "Failure")
{
	$this->_errors = $error;
}
return $this->_xmlArray["SOAP-ENV:Envelope"]["SOAP-ENV:Body"][$rKey];
  }

/**
  * @access public
  * @return array
  */
  function getErrors()
  {
  	return $this->_errors;
  }
# End of Class
}
?>

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.