Jump to content

adman4054

Members
  • Posts

    68
  • Joined

  • Last visited

Everything posted by adman4054

  1. Thank you Barand for the response -- I do not have the ability to add that right now, when I do I will provide the results, thanks again
  2. Looking for a little help..... Error message --[] operator not supported for strings Error log points to this code: <?php $postnr = 1; $catid = 136; $args = array( 'post__not_in'=> $do_not_duplicate, 'posts_per_page' => $postnr, 'cat' => $catid, ); $wp_query = new WP_Query(); $wp_query->query($args); while ($wp_query->have_posts()) : $wp_query->the_post(); if (of_get_option('of_dnd_simple') == 1) { $do_not_duplicate[] = $post->ID; } ?> <p class="catname"> <?php $catid = $catid; ?> <span><a href="<?php echo get_category_link($catid);?>" data-toggle="tooltip" title="<?php printf(esc_attr__('View all posts filed under %1$s','gabfire'), get_cat_name($catid) ); ?>"><?php echo get_cat_name($catid); ?></a></span> </p> <?php if (function_exists('z_taxonomy_image')) z_taxonomy_image(NULL, 'thumbnail'); ?> Thank you
  3. Hi -- We recently made some PHP changes to a file. in the logs I see the following lines. My question is, because a session has already started and is being ignored, would that the failed to open stream - no such file or directory? I know the folder and file are there, but as it says in fatal error, it couldn't open the file. PHP Notice: A session had already been started - ignoring session_start() in PHP Warning: require(authNet/AuthnetAIM.class.php): failed to open stream: No such file or directory in PHP Fatal error: require(): Failed opening required 'authNet/AuthnetAIM.class.php' (include_path= This is part of a 7 page if that helps. Thanks in advance.
  4. Appreciate the response ginerjm. No the default timezone hasn't changed. As for the embarrassment, not too concerned with that. I own a software development company, but I find coding to be fascinating and trying to learn here and there with people who are gracious enough to spend the time helping people like me. Thanks again.
  5. I recently moved a program from one server to another. The new server has php 5.4, the old one 5.3. I fire a cron job nightly that imports ads from an XML file into a MYSQL db. The code worked flawlessly for about three years. After moving it to the new server, it will not work UNLESS I change the date to the next day. I cant make heads, nor tails of it. So I'm wondering if the new version of PHP might have something to do with it. If I replace the $date in the local_file string with the actual name of the file, it works and like I said if I change the date on the XML file to the next day the script runs fine. Further, I know that the If (date ("1")! ! saturday...... is supposed to make the function not run on Satuday and Sunday, but now I want to run it everyday, so how would I change that? Always appreciate PHP Freaks public function import_ads() { if(date("l")!='Saturday' && date("l")!='Sunday') { //echo "test";die; $file_exists = FALSE; $i = 0; do { $date = date("m-d-y", time()); $local_file = $_SERVER['DOCUMENT_ROOT'].'/ads/import/FGH'.$date.'.xml'; if (file_exists($local_file)) { $this->load->model('Common'); $this->Common->delete_latest_ads(); $xml = simplexml_load_file($local_file);
  6. This is the include page. payment.php I added the $var at the end of the code box. require('../authNet/AuthnetAIM.class.php'); $queryInvoiceId = mysql_query("INSERT INTO invoices (id) VALUES(NULL)"); $invoiceId = mysql_insert_id(); //echo $invoiceId."<br>"; $invoiceId = "DIR-" . sprintf('%1$09d', $invoiceId); //echo $invoiceId;die(); //define variables to send $cardNumber = strip_tags($_POST["CCnum"]); $expirationDate = strip_tags($_POST['CCexpireMonth']) . "-" . strip_tags($_POST['CCexpireYear']); //$amount = $priceToCharge; //sent above $cvv = strip_tags($_POST['CC3digit']); $email = $_SESSION['listContactEmail']; $company = $_SESSION['listCompName']; $company = str_replace("&", " ", $company); $company = str_replace("'", " ", $company); $firstName = $_SESSION['contact_first_name']; $firstName = str_replace("'", " ", $firstName); // $firstName = htmlspecialchars($firstName, ENT_QUOTES); $lastName = $_SESSION['contact_last_name']; $lastName = str_replace("'", " ", $lastName); // $lastName = htmlspecialchars($lastName, ENT_QUOTES); $address = $_SESSION['listAdd1']; $city = $_SESSION['listCity']; $state = $_SESSION['listState']; $zip = $_SESSION['listZip']; $country = $_SESSION['listCountry']; $description = "Directory Listing Payment - Listing: " . $company; /////////////////code try { $email = $email; $product = 'Directory listing RPN'; $firstname = $firstname; $lastname = $lastName; $address = $address; $city = $city ; $state = $state; $zipcode = $zip; $creditcard = $cardNumber; $expiration = $expirationDate; $total = $amount; $cvv = $cvv; $invoice = $invoiceId ; $api_login = $_SESSION['LOGIN']; $transaction_key = $_SESSION['TRANSKEY']; $payment = new AuthnetAIM( $api_login, $transaction_key, true); $payment->setTransaction($creditcard, $expiration, $total, $cvv, $invoice); $payment->setParameter("x_duplicate_window", 180); $payment->setParameter("x_customer_ip", $_SERVER['REMOTE_ADDR']); $payment->setParameter("x_email", $email); $payment->setParameter("x_email_customer", FALSE); $payment->setParameter("x_first_name", 'test'); $payment->setParameter("x_last_name", 'hello'); $payment->setParameter("x_address", $address); $payment->setParameter("x_city", $city); $payment->setParameter("x_state", $state); $payment->setParameter("x_zip", $zipcode); $payment->setParameter("x_description", $product); $payment->process(); if ($payment->isApproved()) { // if success, return array $return_array['amount'] = $total; $return_array['Email'] = $email; if ( isset( $_POST['anonymous'] ) && $_POST['anonymous']==1) { $return_array['anonymous'] = true; } else { $return_array['first_name'] = $firstname; $return_array['last_name'] = $lastname; } $return_array['transaction_nonce'] = $_POST['n']; $return_array['success'] = true; } else if ($payment->isDeclined()) { // Get reason for the decline from the bank. This always says, // "This credit card has been declined". Not very useful. $reason = $payment->getResponseText(); $return_array['error_msg'] = __( 'This credit card has been declined. Please use another form of payment.', 'pfund' ); } else if ($payment->isError()) { // Capture a detailed error message. No need to refer to the manual // with this one as it tells you everything the manual does. $return_array['error_msg'] = $payment->getResponseMessage(); // We can tell what kind of error it is and handle it appropriately. if ($payment->isConfigError()) { // We misconfigured something on our end. //$return_array['error_msg'] .= " Please notify the webmaster of this error."; } else if ($payment->isTempError()) { // Some kind of temporary error on Authorize.Net's end. // It should work properly "soon". $return_array['error_msg'] .= __( ' Please try your donation again.', 'pfund' ); } else { // All other errors. } } } catch (AuthnetAIMException $e) { $return_array['error_msg'] ="There was an error processing the transaction. Please report this CATCH error to administration.<br><br>Error: " . $e->__toString(); } $var1 = $return_array['amount']; This is the editListing.php page where I have tried to echo the var. I have tried it in several places on the editListing.php page. <div id="wrapper"> <div id="header-adt" class="content-width"> <div data-oas-id="x01" data-oas-breakpoint="desktop" class="oas-ad desk tablet-hidden mobile-hidden"></div> <div data-oas-id="x01" data-oas-breakpoint="tablet" class="oas-ad tablet large-hidden mobile-hidden"></div> <div data-oas-id="x01" data-oas-breakpoint="mobile" class="oas-ad mobile"></div> </div> <div id="content"> <div id="main"> <?php echo "$var1"; //display errors or display success message if(isset($_POST['saveListing'])){ if($_POST['payment']=='creditcard'){ echo "<br /><br /><div align='center'><font color='#ff0000'>Changes saved and your credit card has been charged ".'$' .$mybillingamount."</font></div>\n"; } elseif($_POST['payment']=='check'){ echo "<br /><br /><div align='center'><font color='#ff0000'>Changes saved, payment by check ".'$' .$mybillingamount."</font></div>\n"; } else{echo "<br /><br /><div align='center'><font color='#ff0000'>Changes saved, but must be approved by the administrator</font></div>\n";} Thanks for looking
  7. I just cant get this to work. So I change the echo to a variable on the include page. but when I place the variable on the page where I need it to go, it doesn't show and I've been googling for hours. editListing.php page has the include payment.php, I created $var1 = $return_array['amount']; on the included payment.php, but when I try placing the echo $var1 on the editListing.php it doesn't work, what am I missing? Thanks.
  8. First box of code is the include file, I would like the two echo statements to be between the divs in the second box. $api_login = $_SESSION['LOGIN']; $transaction_key = $_SESSION['TRANSKEY']; $payment = new AuthnetAIM( $api_login, $transaction_key, true); $payment->setTransaction($creditcard, $expiration, $total, $cvv, $invoice); $payment->setParameter("x_duplicate_window", 180); $payment->setParameter("x_customer_ip", $_SERVER['REMOTE_ADDR']); $payment->setParameter("x_email", $email); $payment->setParameter("x_email_customer", FALSE); $payment->setParameter("x_first_name", 'test'); $payment->setParameter("x_last_name", 'hello'); $payment->setParameter("x_address", $address); $payment->setParameter("x_city", $city); $payment->setParameter("x_state", $state); $payment->setParameter("x_zip", $zipcode); $payment->setParameter("x_description", $product); $payment->process(); if ($payment->isApproved()) { // if success, return array $return_array['amount'] = $total; $return_array['Email'] = $email; if ( isset( $_POST['anonymous'] ) && $_POST['anonymous']==1) { $return_array['anonymous'] = true; } else { $return_array['first_name'] = $firstname; $return_array['last_name'] = $lastname; } $return_array['transaction_nonce'] = $_POST['n']; $return_array['success'] = true; } else if ($payment->isDeclined()) { // Get reason for the decline from the bank. This always says, // "This credit card has been declined". Not very useful. $reason = $payment->getResponseText(); $return_array['error_msg'] = __( 'This credit card has been declined. Please use another form of payment.', 'pfund' ); } else if ($payment->isError()) { // Capture a detailed error message. No need to refer to the manual // with this one as it tells you everything the manual does. $return_array['error_msg'] = $payment->getResponseMessage(); // We can tell what kind of error it is and handle it appropriately. if ($payment->isConfigError()) { // We misconfigured something on our end. //$return_array['error_msg'] .= " Please notify the webmaster of this error."; } else if ($payment->isTempError()) { // Some kind of temporary error on Authorize.Net's end. // It should work properly "soon". $return_array['error_msg'] .= __( ' Please try your donation again.', 'pfund' ); } else { // All other errors. } } } catch (AuthnetAIMException $e) { $return_array['error_msg'] ="There was an error processing the transaction. Please report this CATCH error to administration.<br><br>Error: " . $e->__toString(); } echo "<br /><div align='left'>Your changes have been saved and your card charged $<font color='#ff0000'>" .$return_array['amount']."</font></div>"; echo "<br /><div align='left'>Error message of some type$<font color='#ff0000'>" .$return_array['error_msg']."</font></div>"; <div id="wrapper"> <div id="header-adt" class="content-width"> <div data-oas-id="x01" data-oas-breakpoint="desktop" class="oas-ad desk tablet-hidden mobile-hidden"></div> <div data-oas-id="x01" data-oas-breakpoint="tablet" class="oas-ad tablet large-hidden mobile-hidden"></div> <div data-oas-id="x01" data-oas-breakpoint="mobile" class="oas-ad mobile"></div> </div> <div id="content"> <div id="main"> <?php //display errors or display success message Thanks for taking a look
  9. How do I place an echo statement from an include page in the proper area of the page I'm calling it from? I need it to appear within two div tags. Right now it just prints at the bottom of the page. <div id="content"> echo content <div id="main"> Thanks for any assistance
  10. Hi -- I was able to make the "isApproved" on the first line of code work, but I don't want to save the changes if the listing is not approved, is there a way to do it here? if(isset($_POST['saveListing'])){ if($_POST['payment']=='creditcard' AND $payment->isApproved){ echo "<br /><br /><div align='center'><font color='#ff0000'>Changes saved and your credit card has been charged ".'$' .$mybillingamount."</font></div>\n"; } elseif($_POST['payment']=='check'){ echo "<br /><br /><div align='center'><font color='#ff0000'>Changes saved, payment by check ".'$' .$mybillingamount."</font></div>\n"; } else{echo "<br /><br /><div align='center'><font color='#ff0000'>Changes saved, but must be approved by the administrator</font></div>\n";} } ?> Thanks
  11. Thanks,I will attempt to look at it in my AM. I just wanted to assure you that I'm not storing any cc information. Been pci compliant for many years with many installs. Thank you for taking the time.
  12. Hi requinix and thank you for taking a look. I cant post the entire page, wish I could. I doubt I'm providing what you would need to help me, but its worth a try. The first code box is where the message appears, the second code box is calling the include file right underneath the submit button. Like I said, appreciate you taking a look <div id="content"> <div id="main"> <?php //display errors or display success message if(isset($_POST['saveListing'])){ if($_POST['payment']=='creditcard' AND $payment->isApproved ){ echo "<br /><br /><div align='center'><font color='#ff0000'>Changes saved and your credit card has been charged ".'$' .$mybillingamount."</font></div>\n"; } elseif($_POST['payment']=='check'){ echo "<br /><br /><div align='center'><font color='#ff0000'>Changes saved, payment by check ".'$' .$mybillingamount."</font></div>\n"; } else{echo "<br /><br /><div align='center'><font color='#ff0000'>Changes saved, but must be approved by the administrator</font></div>\n";} } ?> <br><br> <form id="myform" action="editListing.php" method="post" enctype="multipart/form-data"> <?php <?php $datetime1 = new DateTime($globalExpireDate); $datetime2 = new DateTime(); //$interval = $datetime1->diff($datetime2); //$yearDifference = (int)$interval->format('%y'); $yearDifference = round(($datetime2->format('U') - $datetime1->format('U')) / (60*60*24*365)); if($yearDifference < 1) { ?> <!--<input type="submit" name="renewExpiration" value="Renew">--> <?php } ?> </td> </tr> </table> </form> <br /><br /> </div> <?php if(isset($_POST['saveListing'])){ if($_POST['payment']=='creditcard'){ $sql11="SELECT * FROM `rubber115`.`credit` WHERE `cid`='$companyID'"; echo $chk=mysql_num_rows($sql11); if($chk == 1){ echo 444444444444444; } $cname=$_POST["CCname"]; $ctype=$_POST["CCtype"]; $cnum=$_POST["CCnum"]; $cexpm=$_POST["CCexpireMonth"]; $cexpy=$_POST["CCexpireYear"]; $cthree=$_POST["CC3digit"]; $bfirst=$_POST["billingfirstname"]; $blast=$_POST["billinglastname"]; $bemail=$_POST["billingemail"]; $bphone=$_POST["billingphone"]; $badd=$_POST["billingadd"]; $badd2=$_POST["billingadd2"]; $bcity=$_POST["billingcity"]; $bstate=$_POST["billingstate"]; $bzip=$_POST["billingzip"]; $bcountry=$_POST["billingcountry"]; $bamount=$_POST["billingamount"]; // echo "oopssssss"; include 'payment.php'; die; $sql9="INSERT INTO `rubber115`.`credit` (`cid`, `cname`, `ctype`, `cnum`, `cexmonth`, `cexyear`, `cdigit`, `bfirstname`, `blastname`, `bemail`, `bphone`, `badd`, `badd2`, `bcity`, `bstate`, `bzip`, `bcountry`,`bamount`) VALUES ('$companyID', '$cname', '$ctype', '$cnum', '$cexpm', '$cexpy', '$cthree', '$bfirst', '$blast', '$bemail', '$bphone', '$badd', '$badd2', '$bcity', '$bstate', '$bzip', '$bcountry','$bamount')"; mysql_select_db(rubber115); mysql_query( $sql9, $conn ); } if($_POST['payment']=='check'){ $cfname=$_POST["checkfirstname"]; $clname=$_POST["checklastname"]; $cemail=$_POST["checkemail"]; $cphone=$_POST["checkphone"]; $checkadd=$_POST["checkadd"]; $checkadd2=$_POST["checkadd2"]; $checkcity=$_POST["checkcity"]; $checkstate=$_POST["checkstate"]; $checkzip=$_POST["checkzip"]; $checkcountry=$_POST["checkcountry"]; $sql5="INSERT INTO `rubber115`.`check` (`cid`, `cfname`, `clname`, `cemail`, `cphone`, `checkadd`, `checkadd2`, `checkcity`, `checkstate`, `checkzip`, `checkcountry`) VALUES ('$companyID', '$cfname', '$clname', '$cemail', '$cphone', '$checkadd', '$checkadd2', '$checkcity', '$checkstate', '$checkzip', '$checkcountry')"; mysql_select_db(rubber115); mysql_query( $sql5, $conn ); } }?>
  13. I'm always looking for assistance and PHP Freaks has been my "GoTo" place for many years, but I don't seem to have a way of giving back. I don't know PHP or any other coding language, so I just don't know what else to do but say thank you to all the people who have contributed to my PHP education Today I have a form that uses Authorize.net for processing credit card transactions. The Authorize information is in an include file that is called in to a page I will call edit.php. The form functions fine. It communicates with authorize and will provide me with approval, decline, bad card, etc. The problem I'm having is with the message to the customer. When the customer hits submit and is paying by credit card and the transaction is approved I want to display the message below. I added the AND $payment->isApproved, I'm sure its not the right syntax and I'm not sure what to use. The $_POST ['payment'] called for in the beginning of the IF statement is not Authorize, its where credit card and check is defined. If I uncomment the "print_r" at the bottom of the include file it prints on the edit.php page, but I'm also not sure how to get it to the proper place where the message goes. if(isset($_POST['saveListing'])){ if($_POST['payment']=='creditcard' AND $payment->isApproved ){ echo "<br /><br /><div align='center'><font color='#ff0000'>Changes saved and your credit card has been charged ".'$' .$mybillingamount."</font></div>\n"; } elseif($_POST['payment']=='check'){ echo "<br /><br /><div align='center'><font color='#ff0000'>Changes saved, payment by check ".'$' .$mybillingamount."</font></div>\n"; } else{echo "<br /><br /><div align='center'><font color='#ff0000'>Changes saved, but must be approved by the administrator</font></div>\n";} $payment->process(); if ($payment->isApproved()) { // if success, return array $return_array['amount'] = $total; $return_array['Email'] = $email; if ( isset( $_POST['anonymous'] ) && $_POST['anonymous']==1) { $return_array['anonymous'] = true; } else { $return_array['first_name'] = $firstname; $return_array['last_name'] = $lastname; } $return_array['transaction_nonce'] = $_POST['n']; $return_array['success'] = true; } else if ($payment->isDeclined()) { // Get reason for the decline from the bank. This always says, // "This credit card has been declined". Not very useful. $reason = $payment->getResponseText(); $return_array['error_msg'] = __( 'This credit card has been declined. Please use another form of payment.', 'pfund' ); } else if ($payment->isError()) { // Capture a detailed error message. No need to refer to the manual // with this one as it tells you everything the manual does. $return_array['error_msg'] = $payment->getResponseMessage(); // We can tell what kind of error it is and handle it appropriately. if ($payment->isConfigError()) { // We misconfigured something on our end. //$return_array['error_msg'] .= " Please notify the webmaster of this error."; } else if ($payment->isTempError()) { // Some kind of temporary error on Authorize.Net's end. // It should work properly "soon". $return_array['error_msg'] .= __( ' Please try your donation again.', 'pfund' ); } else { // All other errors. } } } catch (AuthnetAIMException $e) { $return_array['error_msg'] ="There was an error processing the transaction. Please report this CATCH error to administration.<br><br>Error: " . $e->__toString(); } //print_r( $return_array); //die('ookk'); Thanks Again!
  14. Hi, I cant figure out why I keep getting a syntax error. The first "WHERE" works fine, but when I add listing.type it throws an error. Appreciate any help. SELECT * FROM company JOIN listing WHERE company.companyID = listing.companyID AND WHERE listing.type = Supplier LIMIT 0 , 30
  15. public function import_ads() { if(date("l")!='Thursday' && date("l")!='Friday') { //echo "test";die; $file_exists = FALSE; $i = 0; do { $date = date("m-d-y", time()); Hoping for a little help and I know its very basic, but I'm not sure how to do it. I want to remove the line "if(date("l")!='Thursday' && date("l")!='Friday')" Thanks
  16. Thank you for taking the time to help me with this. I learned a lot and truly appreciate your help.
  17. Really appreciate you spending the time. Like I said in my earlier post there are two subdomains in which an administrator can sign in. example.example.com and example1.example.com. The [dot] example being the same domain. if they come in on example1.example.com it seems to work consistently, if they come in on example.example.com, it only works 50% of the time. I can see the cookies and those domains and subs are listed as the cookies. Is there a way to have it validate with just the domain, ie., example.com? at the top of the page is: <?php session_start(); define('example_DIRECTORY',true); include("../inc/common.php"); thanks again!
  18. Thank you for the quick informative reply. I have this software running on a server with 20+ other installations, is there another way to make this entry, ie, htaccess, in the code itself? thanks
  19. Looking for some help with what Im assuming is a session variable. As you can tell, Im not a coder. I have software that checks to see if the user is signed in as an administrator, if they are, then a message should appear. Here is the code: if (isset($_SESSION['un']) && isset($_SESSION['pw']) && $adminFreeListing ) { ?> <td><font color="#FF0000"> Admin - Is this a free listing? </font> </td> <td><input name="free" type="radio" value="N" <?php if (!isset($_POST['free']) OR $_POST['free'] == 'N') { echo " checked"; } ?> > No <input type="radio" name="free" value="Y" <?php if ( $_POST['free'] == 'Y') { echo " checked"; } ?> It works about 50% of the time and Im not sure why. It guessing it might have something to do with multiple copies of the same software (used for different sites) and or the use of subdirectories example.example.com and example1.example.com. Those are just guesses on my part. So my question is how can I make it work all the time. Is there a different method I might be able to use? Im not sure if this is enough information to lend me a hand, regardless, thanks for looking at it.
  20. Thank you requinx for the quick reply. I can use the "in array" in your above code with this: elseif ($subcategory_id == 400) { $this->db->where('number >=', 24); $this->db->where('number <=', 27); $query = $this->db->get('package'); if ($query->num_rows() > 0) { foreach ($query->result() as $row) { $data[] = $row; } return $data; } return array(); Thanks again!
  21. That's right I'm pretty green when it comes to PHP. I googled it, but it looks like there are several ways to achieve this, wondering which is best. elseif ($subcategory_id == 400) I want the code to include a number of subcategory_ids, 400, 450, 500, 760, etc. There isn't a range, so what would be the proper way to include multiple category_ids. Thank you
  22. That's what I needed, thank you Ch0cu3r !
  23. I'm trying to figure out how to add "\fs13" to the base64 encoding. For example, the "ad->text" field would look like this <ad-content type="rtf">ZGZnIGRmZyBkZmcgZGZnIGRmZyBkZmcgZGZnIGRmZyBkZmcgZGZnIGRmZyBkZmcgZGZnIGQ=</ad-content> The code to generate the above is -- <ad-content type=\"rtf\">".htmlentities(base64_encode($ad->text))."</ad-content>"; I need the encoding to include the "\fs13" in front of the encoded ad-content. The "\fs13" is simply a font size that will tell the system what font size to use. <ad-content type="rtf">ZGZnIGRmZyBkZmcgZGZnIGRmZyBkZmcgZGZnIGRmZyBkZmcgZGZnIGRmZyBkZmcgZGZnIGQ=</ad-content> I'm also trying to encode an additional field within the "ad-content type". The present code looks like this: <ad-content type=\"rtf\">".htmlentities(base64_encode($ad->text))."</ad-content>"; I need to add "($ad->photo_file_name)" to the above, so that the "ad->text" and the "ad->photo_file_name" are within the ad-content type that is being decoded. Hope that makes sense, appreciate ant help, Thanks!
  24. Sorry Ch0cu3r, I wasn't aware the you cannot have a <ul> list in tables, but that makes sense. I do have the list within multiple tables, I'll try and sort that out. appreciate your post, thank you.
×
×
  • 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.