Jump to content

ohno

Members
  • Posts

    127
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by ohno

  1. Hi, can't get my head around this one! I have this code :- if (isset($_SESSION['cartid']) && !isset($_SESSION['lockedcard']) && isset($_POST['cartitem']) && isset($_POST['quantity']) && is_numeric($_POST['quantity'])) { if ($_POST['quantity'] > 0) { Which I need to add an OR statement to : - (!isset($_SESSION['lockedpaypal']). Both SESSION ID's are either a 1 or 0 so not sure why the original coder used isset but in any case how do I code this so it evaluates whether locked card or locked paypal are either NOT a 1 or ARE a 0? I tried this but it does not work:- if (isset($_SESSION['cartid']) && ($_SESSION['lockedpaypal'] != '1' || ['lockedcard'] != '1') && isset($_POST['cartitem']) && isset($_POST['quantity']) && is_numeric($_POST['quantity'])) { if ($_POST['quantity'] > 0) { Thanks!
  2. Maybe this will help, this is the orders.php file. "All"(!) I wish to do is update the table fields Order Number, Payment Type, Current Progress, Viewing Delivery Options?, Cart Locked & Total. As I said if I refresh the whole page the scripts that send email etc stop working during a refresh, & as I wanted this to update quickly (so every few seconds) it basically breaks the page. <?php session_start(); include_once("configio.php"); include_once("top.php"); // **** Country detection via IP code start **** include_once("../../ip_files/countries.php"); function iptocountry($ip) { $numbers = preg_split( "/\./", $ip); include("../../ip_files/".$numbers[0].".php"); $code=($numbers[0] * 16777216) + ($numbers[1] * 65536) + ($numbers[2] * 256) + ($numbers[3]); foreach($ranges as $key => $value){ if($key<=$code){ if($ranges[$key][0]>=$code){$two_letter_country_code=$ranges[$key][1];break;} } } if ($two_letter_country_code==""){$two_letter_country_code="UNKNOWN";} return $two_letter_country_code; } // **** Country detection via IP code end **** if ( (!isset($_SESSION['aloggedin'])) || ($_SESSION['aloggedin'] != 1) ) { include_once("login.php"); } else { echo ' <h1>Orders Area - '.$companyname.' Shopping Cart System</h1> <table width="500" border="0"> <tr> <td><form method="post" action="s_findorder.php" target="_blank"> Order ID<br /> <input type="text" name="orderno" /> <input type="submit" name="submit" value="Search" /> </form></td> <td><form method="post" action="findorderresults.php" target="_blank"> IP Address or E-mail Address<br /> <input type="text" name="searchterm" /> <input type="submit" name="submit" value="Search" /> </form></td> </tr> </table> '; $sql = "SELECT COUNT(cartid) FROM carts"; $result = $mysqli->query($sql); while ( $row = @$result->fetch_array(MYSQLI_BOTH) ) { $numorders = $row[0]; } if ( $numorders == 0 ) { echo "There are no orders in the system."; } else { $sql = "SELECT orderno, datestarted, ipaddress, progress, locked, deloptions, total, cartid, invoiced, invoiceid, email, deliveryoption, trackingno, card FROM carts WHERE archived='0' ORDER BY cartid DESC"; $result = $mysqli->query($sql); echo ' <table border="1"> <tr align="center"> <td class="tableheader">Order<br />Number</td> <td class="tableheader">Date &amp; Time Started</td> <td class="tableheader">IP Address</td> <td class="tableheader">Country</td> <td class="tableheader">Email Address</td> <td class="tableheader">Save</td> <td class="tableheader">Payment Type</td> <td class="tableheader">Current Progress</td> <td class="tableheader">Viewing Delivery Options?</td> <td class="tableheader">Cart Locked</td> <td class="tableheader">Total</td> <td class="tableheader">Archive</td> <td class="tableheader">More...</td> <td class="tableheader">E-mail<br />Info</td> <td class="tableheader">Confirm<br />PP</td> <td class="tableheader">Confirm<br />Card</td> <td class="tableheader">Confirm<br />Bank</td> <td class="tableheader">Clear<br />Confirm</td> <td class="tableheader">Create<br />Invoice</td> </tr> '; while ( $row = @$result->fetch_array(MYSQLI_BOTH) ) { // **** Country detection via IP code start **** $two_letter_country_code=iptocountry($row['ipaddress']); $three_letter_country_code=$countries[ $two_letter_country_code][0]; $country_name=$countries[$two_letter_country_code][1]; // To display flag $file_to_check="../../flags/$two_letter_country_code.gif"; if (file_exists($file_to_check)){ $flag = "<img src=$file_to_check width=30 height=15><br>"; }else{ $flag = "<img src=../../flags/noflag.gif width=30 height=15><br>"; } //End flag // **** Country detection via IP code end **** $year = substr($row['datestarted'], 0, 4); $month = substr($row['datestarted'], 5, 2); $day = substr($row['datestarted'], 8, 2); $hour = substr($row['datestarted'], 11, 2); $min = substr($row['datestarted'], 14, 2); $sec = substr($row['datestarted'], 17, 2); $rowbackground = ''; if ( $row['deliveryoption'] != '0' ) { $rowbackground = ' style="background-color: #00FFFF;"'; } $date = $day.'/'.$month.'/'.$year.' '.$hour.':'.$min.':'.$sec; echo ' <tr align="center"'.$rowbackground.'> <td>'.$row['orderno'].'</td> <td>'.$date.'</td> <td>'.$row['ipaddress'].'</td> <td>'.$flag.''.$country_name.'</td> <form method="post" action="s_updateorderemail.php"><td><input type="text" name="email" value="'.$row['email'].'" /></td><td><input type="submit" name="submit" value="Save" /></td><input type="hidden" name="cartid" value="'.$row['cartid'].'" /></form> <td align="center"> <div class="payment-type" id="'.$row['cartid'].'"> '; if ( $row['card'] == '31' ) { echo '<img src="https://www.site.com/images/visa.png" height="47" width="75" alt="Paid via Visa Card" />'; } elseif ( $row['card'] == '32' ) { echo '<img src="https://www.site.com/images/mastercard.png" height="47" width="75" alt="Paid via MasterCard" />'; } elseif ( $row['card'] == '33' ) { echo '<img src="https://www.site.com/images/amex.gif" height="47" width="74" alt="Paid via Amex Card" />'; } elseif ( $row['card'] == '34' ) { echo '<img src="https://www.site.com/images/maestro.png" height="47" width="75" alt="Paid via Maestro Card" />'; } elseif ( $row['card'] == '35' ) { echo '<img src="https://www.site.com/images/solo.gif" height="47" width="77" alt="Paid via Solo Card" />'; } elseif ( $row['card'] == '36' ) { echo '<img src="https://www.site.com/images/discover.gif" height="47" width="74" alt="Paid via Discover Card" />'; } elseif ( $row['progress'] == '1' ) { echo '<img src="https://www.site.com/images/pp.gif" height="26" width="100" alt="Paid via PayPal" />'; } elseif ( $row['progress'] == '2' ) { echo '<img src="https://www.site.com/images/pp.gif" height="26" width="100" alt="Paid via PayPal" />'; } elseif ( $row['progress'] == '6' ) { echo '<img src="https://www.site.com/images/pp.gif" height="26" width="100" alt="Paid via PayPal" />'; } elseif ( $row['progress'] == '38' ) { echo '<img src="https://www.site.com/images/banktransferinvoice.png" height="46" width="70" alt="Paid via Bank Transfer" />'; } elseif ( ($row['card'] == '0' ) && ($row['progress'] == '14' || $row['progress'] == '21' || $row['progress'] == '23' || $row['progress'] == '25') ) { echo '<img src="https://www.site.com/images/paidbycard.gif" height="43" width="43" alt="Paid via Card" />'; } else { echo ''; } echo' </div> <td align="center"> <div id="progress"> '; if ( $row['progress'] == '1' ) { echo 'PayPal Failed'; } elseif ( $row['progress'] == '2' ) { echo 'PayPal Success'; } elseif ( $row['progress'] == '3' && $row['locked'] == '0') { echo 'Delivery Options'; } elseif ( $row['progress'] == '3' && $row['locked'] == '1') { echo 'Delivery Options-Locked'; } elseif ( $row['progress'] == '4' ) { echo 'Checkout Selected'; } elseif ( $row['progress'] == '5' ) { echo 'Payment Gateway'; } elseif ( $row['progress'] == '6' ) { echo 'Sent to PayPal'; } elseif ( $row['progress'] == '7' ) { echo 'Sent to GoogleCheckout'; } elseif ( $row['progress'] == '8' ) { echo 'Nochex Success'; } elseif ( $row['progress'] == '9' ) { echo 'Nochex Failed'; } elseif ( $row['progress'] == '10' ) { echo 'Sent to Nochex'; } elseif ( $row['progress'] == '11' ) { echo 'Sent to PP Pro'; } elseif ( $row['progress'] == '12' ) { echo 'Processing PP Pro'; } elseif ( $row['progress'] == '13' ) { echo 'PP Pro Failure'; } elseif ( $row['progress'] == '14' ) { echo 'PP Pro Success'; } elseif ( $row['progress'] == '15' ) { echo '3Ds iframe Page'; } elseif ( $row['progress'] == '16' ) { echo 'Sent to Pro Hosted'; } elseif ( $row['progress'] == '17' ) { echo 'iFrame Address Page'; } elseif ( $row['progress'] == '18' ) { echo 'PP Pro Card Selection'; } elseif ( $row['progress'] == '19' ) { echo 'iFrame Payment Page'; } elseif ( $row['progress'] == '20' ) { echo 'PP Pro 3Ds Page'; } elseif ( $row['progress'] == '21' ) { echo 'Pro Hosted Success'; } elseif ( $row['progress'] == '22' ) { echo 'Pro Hosted Failed'; } elseif ( $row['progress'] == '23' ) { echo 'PP iFrame Success'; } elseif ( $row['progress'] == '24' ) { echo 'PP iFrame Failed'; } elseif ( $row['progress'] == '25' ) { echo 'PP Pro Success'; } elseif ( $row['progress'] == '26' ) { echo 'PP Pro Failed'; } elseif ( $row['progress'] == '27' ) { echo 'PP Pro Address Page'; } elseif ( $row['progress'] == '31' ) { echo 'PP Pro Address Page - Visa'; } elseif ( $row['progress'] == '32' ) { echo 'PP Pro Address Page - MasterCard'; } elseif ( $row['progress'] == '33' ) { echo 'PP Pro Address Page - Amex'; } elseif ( $row['progress'] == '34' ) { echo 'PP Pro Address Page - Maestro'; } elseif ( $row['progress'] == '35' ) { echo 'PP Pro Address Page - Solo'; } elseif ( $row['progress'] == '36' ) { echo 'PP Pro Address Page - Discover'; } elseif ( $row['progress'] == '37' ) { echo 'Cart Unlocked'; } elseif ( $row['progress'] == '38' ) { echo 'BANK TRANSFER'; } else { echo 'Active'; } echo' </td> <td align="center"> '; if ( $row['deloptions'] == '1' ) { echo '<img src="images/invoicesent.png" alt="Viewing Del Options" border="none" /> <td align="center"> '; } else { echo '<img src="images/invoicenotsent.png" alt="Not Viewing Del Options" border="none" /> <td align="center"> '; } if ( $row['locked'] == '1' ) { echo '<a href="s_unlockcart.php?id='.$row['cartid'].'"><img src="images/invoicesent.png" alt="Cart Locked" border="none" /> '; } else { echo '<img src="images/invoicenotsent.png" alt="Cart Not Locked" border="none" /> '; } echo' </td> <td><div id="total-price">&pound;'.$row['total'].'</td> <td><a href="s_archiveorder.php?id='.$row['cartid'].'"><img src="images/archive.png" alt="Archive Order Info" border="none" /></a></td> '; echo' <td><a href="'; echo "javascript: window.open('order.php?id=".$row['cartid']."','','status=yes, width=700,height=800,scrollbars=1'); void('');"; echo '"><img src="images/more_button.gif" alt="More Order Info" border="none" /></a></td> <td align="center"><a href="s_emailorderinfo.php?id='.$row['cartid'].'"><img src="images/email.gif" alt="E-mail Order Info" border="none" /></a></td> <td align="center"><a href="s_confirmpp.php?id='.$row['cartid'].'"><img src="images/paypal.gif" alt="Confirm PayPal Payment" border="none" /></a></td> <td align="center"><a href="s_confirmpppp.php?id='.$row['cartid'].'"><img src="images/cards.gif" alt="Confirm Pay Pal Pro Payment" border="none" /></a></td> <td align="center"><a href="s_confirmbk.php?id='.$row['cartid'].'"><img src="images/banktransfersmall.png" alt="Confirm Bank Payment" border="none" /></a></td> <td align="center"><a href="s_clearconfirm.php?id='.$row['cartid'].'"><img src="images/removeconfirmpayment.png" alt="Remove Confirm Payment" border="none" /></a></td> <td align="center"><a href="s_createinvoice.php?id='.$row['cartid'].'"><img src="images/invoice.gif" alt="Create Invoice" border="none" /></a></td> </tr> '; } echo ' </table> '; } } include_once("bottomio.php"); ?>
  3. With my original code :- $(document).ready(function(){ setInterval(function(){ $("#progress").load(window.location.href + " #progress" ); }, 3000); }); </script> I can get the first part to work , so after the refresh the page updates but obviously it is finding all divs that contain "progress" & then displaying it again (hope this makes sense, I've confused myself big time here!). What I think I need is this :- $("#progress-ID123").load(window.location.href + " #progress-ID123" ); < Is it even possible to link these two parts together via the ID123 part? If yes what code is required?! So in the PHP each div contains "progress" with a unique ID tagged on so progressID123 in my example. I then want a script that will refresh each of those divs every 10 seconds. I know the post above says do this properly but if there is just a simple way (NOT a whole page refresh though) that will do at the moment. If anyone can help it would be great. Thanks
  4. Hi, yes, the page consists of a table where a user can run another script, eg, to change the carts shipping option. If the whole page refreshes the scripts do not always run. Hence I just wanted to update certain elements that report on the carts progress in the checkout flow. Hope this makes sense?
  5. I found this guide :- https://kodesmart.com/kode/working-with-json-jquery-php-and-mysql/ I made some test files, test.php :- <?php session_start(); include_once("configio.php"); //MSG $sql = "SELECT * FROM carts LIMIT 20"; $result = $mysqli->query($sql); //Add all records to an array $rows = array(); while($row = $result->fetch_array()){ $rows[] = $row; } //Return result to jTable $qryResult = array(); $qryResult['logs'] = $rows; echo json_encode($qryResult); ?> & test2.php :- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="css/style.css" /> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"></script> <script type="text/javascript" src="js/script.js"></script> <title>Test Page</title> <script> $(document).ready(function(){ var formhtml = "logreq=1"; var postURL= "test.php"; $.ajax({ type: "POST", url: postURL, data: formhtml, success: function(html){ var output= "<table><tbody><thead><th>cartid</th><th>orderno</th><th>Date</th><th>Browser</th></thead>"; var logsData = $.parseJSON(html); for (var i in logsData.logs){ output+="<tr><td>" + logsData.logs[i].cartid + "</td><td>" + logsData.logs[i].orderno + "</td><td>" + logsData.logs[i].datestarted+ "</td><td>" + logsData.logs[i].browser+"</td></tr>"; } $("#log_container").html(output); }, error: function (html) { alert("Oops...Something went terribly wrong"); } }); }); </script> </head> <body> <div id="log_container"> </div> </body> </html> Which gives me a screen that looks like the example. But I haven't got a clue how this would be implemented in my scenario!
  6. I guess I need a coder to come up with this then The page in question is a PHP page full of tables, does that make any difference?
  7. So in the PHP we would have <div id=123order-no</div><div id=456order-no</div><div id=789-orderno</div> etc, I'm not understanding what would be required in the JS, sorry. The example looks along the lines of what I need but I've no idea how to tie it in with the existing JS, any help would be much appreciated!
  8. Thanks, I'll take a look....
  9. Please go gentle as I'm no coder (& finding someone to do these small things seems next to impossible). I have this JS code which is updating a div :- <script> $(document).ready(function(){ setInterval(function(){ $("#order-no").load(window.location.href + " #order-no" ); $("#date").load(window.location.href + " #date" ); $("#ip").load(window.location.href + " #ip" ); $("#country").load(window.location.href + " #country" ); $("#payment-type").load(window.location.href + " #payment-type" ); $("#progress").load(window.location.href + " #progress" ); $("#delivery-options").load(window.location.href + " #delivery-options" ); $("#cart-locked").load(window.location.href + " #cart-locked" ); $("#total-price").load(window.location.href + " #total-price" ); }, 3000); }); </script> & in my PHP each div has an ID, eg :- <div id="order-no">'.$row['orderno'].'</div> All working fine. However the PHP page in question can have multiple orders on it so each div needs to be unique. I can do that easily on the PHP side, eg :- <div id="'.$row['orderno'].'-order-no">'.$row['orderno'].'</div> So now the order no div becomes the "order ID-order-no". But how to I then get this info into the JS? I found some info elsewhere which seems to suggest it's possible but it's well over the top of my head Any help would be MUCH appreciated. Thanks
  10. Thanks, I'll give it a go
  11. #cart_change_card a :hover { -webkit-animation: spin 2s; -moz-animation: spin 2s; -o-animation: spin 2s; animation: spin 2s; } @-moz-keyframes spin { from { -moz-transform: rotate(0deg); } to { -moz-transform: rotate(360deg); } } @-webkit-keyframes spin { from { -webkit-transform: rotate(0deg); } to { -webkit-transform: rotate(360deg); } } @keyframes spin { from {transform:rotate(0deg);} to {transform:rotate(360deg);} }
  12. I have tried that and it doesn't seem to work (unless I got the CSS wrong!) Thanks for your reply.
  13. I have the following html :- <div id="cart_change_card" <label>You have selected: <img src="{$smarty.const.SITE_ROOT}{$smarty.const.IMG_DIR}/{$cart->mCardImage}" alt="{$cart->mCard}" height="60" /><br /> <a class="red" href="{$smarty.const.SITE_ROOT}/cart/payment/card/"><i class="fa fa-refresh fa-2x fa-spin-hover"></i> Change Card Type</a></label> </div> & the following CSS :- #cart_change_card .fa-spin-hover:hover { -webkit-animation: spin 2s; -moz-animation: spin 2s; -o-animation: spin 2s; animation: spin 2s; } @-moz-keyframes spin { from { -moz-transform: rotate(0deg); } to { -moz-transform: rotate(360deg); } } @-webkit-keyframes spin { from { -webkit-transform: rotate(0deg); } to { -webkit-transform: rotate(360deg); } } @keyframes spin { from {transform:rotate(0deg);} to {transform:rotate(360deg);} } #cart_change_card a { color: #118df2; font-weight: 700; } #cart_change_card a:hover { color: #1BC1FF; text-decoration: none; -webkit-transition-duration: 0.2s; } This works as expected, you can click on the text link or the fontawesome icon or the text & be taken to the correct page. However, what I wanted to happen was the font awesome icon spin if the mouse is over the icon OR the text (currently it only animates if the mouse is over the icon). Is that possible? Thanks for any help...
  14. I use this script to detect a browser IP, however it doesn't work with IPv6. http://phptutorial.info/iptocountry/the_script.html Any ideas what is required to make it work with both IPv4 & IPv6? Thanks
  15. I backed up the DB and changed them so they are all utf8mb4_unicode_ci. I also changed this line :- if (!$this->db->set_charset("utf8")) { to this :- if (!$this->db->set_charset("utf8mb4")) { And it seems to have fixed the fault Thanks for your help.
  16. OK, this is how it looks now:- class DbManager { public $db; function __construct() { mysqli_report(MYSQLI_REPORT_ERROR|MYSQLI_REPORT_STRICT); $this->db = new mysqli(DB_SERVER, DB_USERNAME, DB_PASSWORD, DB_DATABASE); if ($this->db->connect_errno) { die("Failed to connect to MySQL: (" . $this->db->connect_errno . ") " . $this->db->connect_error); } if (!$this->db->set_charset("utf8")) { die("Error loading character set utf8: " . $this->db->error); } else { } } The error log now gives this :- Uncaught mysqli_sql_exception: Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation 'like' in /home/website/public_html/include/database.php:30 Looking at the DB it seems some columns have collation set to utf8mb4_unicode_ci while others are latin1_swedish_ci! I guess I just need to change the collation of those so they are all utf8mb4_unicode_ci?
  17. I don't see mysqli_connect() :- class DbManager { public $db; function __construct() { $this->db = new mysqli(DB_SERVER, DB_USERNAME, DB_PASSWORD, DB_DATABASE); if ($this->db->connect_errno) { die("Failed to connect to MySQL: (" . $this->db->connect_errno . ") " . $this->db->connect_error); } if (!$this->db->set_charset("utf8")) { die("Error loading character set utf8: " . $this->db->error); } else { } }
  18. Hi everyone, Happy New Year in advance! I have the following error occurring :- PHP Fatal error: Uncaught Error: Call to a member function fetch_assoc() on bool in /home/website/public_html/include/database.php:31 Line 31 :- while ($row = $query_result->fetch_assoc()) { $result[] = $row; } Which is in this query :- public function DbGetAll($queryString) { $query_result = $this->db->query($queryString); $result = array(); while ($row = $query_result->fetch_assoc()) { $result[] = $row; } return $result; } I'm guessing it's a problem with the sql query but I'm not sure how to fix? The error log also references this file :- #0 /home/website/public_html/data_objects/do_catalogue.php(68): DbManager->DbGetAll('SELECT p.code, ...') #1 /home/website/public_html/smarty_plugins/function.load_search.php(38): DoCatalogue->SearchProducts(Array) #2 /home/website/public_html/smarty_plugins/function.load_search.php(5): Search->init() But I ***think*** that is just because the above query is incorrect? Thank you for any help in fixing this error.
  19. As above, the script came with a file "unknown.php" which is just empty, I can't see how the code would ever use the file as I can't see it referenced in the code anywhere? What I did was modify "countries.php" by adding this code :- "UNKNOWN" => array("Undeclared","an undeclared location"), It all works as it should, if the IP is from an unknown location the text I added to countries.php is displayed. It just seems odd the original author had "unknown.php"? Thanks
  20. Anyone? Here's the original authors site again :- http://phptutorial.info/iptocountry/the_script.html
  21. Fixed I was on the right tracks but had put the code in the wrong place, oops. Anyway, many thanks for helping to sort it. On a side note the script came with a file "unknown.php" which is just empty, I can't see how the code would ever use the file as I can't see it referenced in the code anywhere? Anyway, what I did was modify "countries.php" by adding this code :- "UNKNOWN" => array("Undeclared","an undeclared location"), It all works as it should, if the IP is from an unknown location the text added to countries.php is displayed. It just seems odd the original author had "unknown.php"? Thanks again for your valued help
  22. Thanks. I'll give that a go in the morning
  23. Hi guys, hope someone can help? I noticed an error in my logs & upon digging it seems this script is causing the issue:- <?php error_reporting(E_ALL); //$IPaddress=$_SERVER['REMOTE_ADDR']; $IPaddress='45.152.180.38'; $two_letter_country_code=iptocountry($IPaddress); include("ip_files/countries.php"); $three_letter_country_code=$countries[ $two_letter_country_code][0]; $country_name=$countries[$two_letter_country_code][1]; print "Two letters code: $two_letter_country_code<br>"; print "Three letters code: $three_letter_country_code<br>"; print "Country name: $country_name<br>"; // To display flag $file_to_check="flags/$two_letter_country_code.gif"; if (file_exists($file_to_check)){ print "<img src=$file_to_check width=30 height=15><br>"; }else{ print "<img src=flags/noflag.gif width=30 height=15><br>"; } function iptocountry($ip) { $numbers = preg_split( "/\./", $ip); include("ip_files/".$numbers[0].".php"); $code=($numbers[0] * 16777216) + ($numbers[1] * 65536) + ($numbers[2] * 256) + ($numbers[3]); foreach($ranges as $key => $value){ if($key<=$code){ if($ranges[$key][0]>=$code){$two_letter_country_code=$ranges[$key][1];break;} } } if ($two_letter_country_code==""){$two_letter_country_code="UNKNOWN";} return $two_letter_country_code; } ?> This script was originally from here http://phptutorial.info/iptocountry/the_script.html The error I'm getting is :- [28-Nov-2019 16:57:56 UTC] PHP Notice: Undefined variable: two_letter_country_code in /home/drgl1966/testing.site/testinguser/test.php on line 35 I'm ***guessing*** this may be caused by my newer version of PHP (7.3, although I must admit I didn't look at old logs to see if the problem exists with older PHP version). I hard coded the made up IP in the code above as the problem only happens if the IP address is not known. Any idea's how to fix? As you can probably gather I'm not a PHP coder! I've searched online for answers but all the things I've found & tried have failed Thanks in advance for any help with this...
  24. Excuse my ignorance but what is "PDO"? Can someone who works with PHP update this code so it will all work with the newer versions of PHP? Will we HAVE to upgrade to newer versions of PHP? Thanks
  25. //Add to cart, view cart, cart summary, xselling all in one enhancement. Requires product ID $sql = "SELECT code FROM products WHERE productid='".mysql_real_escape_string($_GET['id'])."'"; $result = mysql_query($sql); while ( $row = @mysql_fetch_array($result, MYSQL_BOTH) ) { $prodcode = $row['code']; } $data = '<table border="0"><tr><td colspan="2"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"color="#000000"><form method="post" action="https://www.domain.com/s_addtocart.php" target="_blank"><input type="hidden" name="code" value="'.$prodcode.'" /><input type="image" src="images/add.png" name="Submit" alt="Add To Cart" style="vertical-align:middle; border: none;" hspace="2" /> Quantity: <input type="text" name="quantity" size="3" value="1" /></form></font></td></tr><tr><td><font size="2" face="Verdana, Arial, Helvetica, sans-serif"color="#000000"><a href="https://www.domain.com/cart.php" target="_blank"><img src="images/viewcart.png" alt="View Cart" border="0px" style="vertical-align:middle" hspace="2" /></a></font></td><td>'; $data .= '<font size="2" face="Verdana, Arial, Helvetica, sans-serif"color="#000000">'; if ( !(isset($_SESSION['cartid'])) || ($_SESSION['cartid'] == "") ) //if ( (!isset($_COOKIE['RITD_Cart_ID'])) || ($_COOKIE['RITD_Cart_ID'] == '') ) { $data .= 'No items have been added to the cart yet.'; } else { $sql = "SELECT sub FROM carts WHERE cartid='".$_SESSION['cartid']."'"; //$sql = "SELECT orderno, sub FROM carts WHERE cartid='".$_COOKIE['RITD_Cart_ID']."'"; $result = mysql_query($sql); while ( $row = @mysql_fetch_array($result, MYSQL_BOTH) ) { if ( $row['sub'] == "" ) { $row['sub'] = "0.00"; } $orderno = $orderpre . ($orderstart+$_SESSION['cartid']); $data .= 'Order Number: '.$orderno.' with Sub-Total: £'.$row['sub']; $data = str_replace("&", "&", $data); } } $data .= '</font></td></tr></table>'; break; I should add, I know NOTHING about PHP! This was written for me about 7 years ago. It all works I'm just trying to modify that one section. I've since worked out that it is just this section of code that needs modifying.
×
×
  • 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.