Jump to content
Larry Ullman's Book Forums

Silver

Members
  • Posts

    52
  • Joined

  • Last visited

  • Days Won

    1

Silver last won the day on September 17 2011

Silver had the most liked content!

Silver's Achievements

Newbie

Newbie (1/14)

1

Reputation

  1. Many thanks, HartleySan. In fact there is much code to it, but I am good to go now.
  2. Dear HartleySan, You are right, however, though the select element will be there in the final code, I ignored it here because I am able to manage it separately. I now want to do what I explained only, which I am unable to yet.
  3. Hi everyone. I'm trying to echo the values of an array inside HTML's <option> tag. The following should be echod: <option value="Moose Jaw,SK,Canada">Moose Jaw,SK,Canada</option> <option value="Prince Albert,SK,Canada">Prince Albert,SK,Canada</option> <option value="Regina,SK,Canada">Regina,SK,Canada</option> <option value="Saskatoon,SK,Canada">Saskatoon,SK,Canada</option> The code I attempted was: <!DOCTYPE html> <html> <body> <?php $sk=array("Saskatoon","Regina","Moose Jaw", "Prince Albert"); sort($sk); foreach ($sk as $value) { echo '<option value="'.$value.',SK,Canada">'.$value.',SK,Canada</option>'; echo "<br>"; } ?> </body> </html> Pls. note that the values of the array are not sorted alphabetically. The output, however, should be sorted in ascending format and be within the <option> tag after adding the province and country. Any help will be highly appreciated.
  4. Page 92, item 5 = should be added after >
  5. define ('BASE_URI', 'C:/xampp/htdocs/site/final/'); define ('BASE_URL', 'www.final/local/'); define ('MYSQL', '../mysql.inc.php'); Above were my config settings. Now I changed the base URL to 'www.final.local/' and it worked. Why wasn't working for the first setting? Is the BASE_URI & BASE_URL now in their best format or there could be a better way of writing them? Many many thanks, Larry.
  6. Dear Larry, Here are the tow cart scripts. As you see, both are downloaded from the forum. I am unsble to figure out where the problem is, and I would therefore appreciate your help. Many thanks. cart.html Note: begins with normal html view and table (not included here), which appears as designed. </table><br /><p align="center"><input type="submit" value="Amend Quantity" class="button" /></form></p><br /><p align="center"><a href="https://<?php echo BASE_URL; ?>checkout.php?session=<?php echo $uid; ?>" class="button">Checkout</a></p></div> Note: ends with the normal html view (not included here), which appears as designed. cart.php <?php require ('./includes/config.inc.php'); if (isset($_COOKIE['SESSION'])) { $uid = $_COOKIE['SESSION']; } else { $uid = md5(uniqid('biped',true)); } setcookie('SESSION', $uid, time()+(60*60*24*30)); $page_title = 'Your Shoppping Cart’; include ('./includes/header.html'); require (MYSQL); include ('./includes/product_functions.inc.php'); // If there's a SKU value in the URL, break it down into its parts: if (isset($_GET['sku'])) { list($sp_type, $pid) = parse_sku($_GET['sku']); } if (isset ($pid, $sp_type, $_GET['action']) && ($_GET['action'] == 'add') ) { // Add a new product to the cart: $r = mysqli_query($dbc, "CALL add_to_cart('$uid', '$sp_type', $pid, 1)"); } elseif (isset ($sp_type, $pid, $_GET['action']) && ($_GET['action'] == 'remove') ) { // Remove it from the cart. $r = mysqli_query($dbc, "CALL remove_from_cart('$uid', '$sp_type', $pid)"); } elseif (isset ($sp_type, $pid, $_GET['action'], $_GET['qty']) && ($_GET['action'] == 'move') ) { // Move it to the cart. // Determine the quantity: $qty = (filter_var($_GET['qty'], FILTER_VALIDATE_INT, array('min_range' => 1))) ? $_GET['qty'] : 1; // Add it to the cart: $r = mysqli_query($dbc, "CALL add_to_cart('$uid', '$sp_type', $pid, $qty)"); // Remove it from the wish list: $r = mysqli_query($dbc, "CALL remove_from_wish_list('$uid', '$sp_type', $pid)"); } elseif (isset($_POST['quantity'])) { // Update quantities in the cart. foreach ($_POST['quantity'] as $sku => $qty) { // Parse the SKU: list($sp_type, $pid) = parse_sku($sku); if (isset($sp_type, $pid)) { // Determine the quantity: $qty = (filter_var($qty, FILTER_VALIDATE_INT, array('min_range' => 0)) !== false) ? $qty : 1; // Update the quantity in the cart: $r = mysqli_query($dbc, "CALL update_cart('$uid', '$sp_type', $pid, $qty)"); } } // End of FOREACH loop. }// End of main IF. // Get the cart contents: $r = mysqli_query($dbc, "CALL get_shopping_cart_contents('$uid')"); if (mysqli_num_rows($r) > 0) { // Products to show! include ('./views/cart.html'); } else { // Empty cart! include ('./views/emptycart.html'); } include ('./includes/footer.html'); ?>
  7. I do not know why the posted URL was incomplete. Here it is again: https://www.final/local/checkout.php?session=9a31881e6c08e8277b133e22794a0042
  8. Regret missing that out, Larry. It's: https://www.final/local/checkout.php?session=9a31881e6c08e8277b133e22794a0042
  9. Thanks Larry. Here is the details of what happens: In IE, typing https://final.local/ in the URL gives this message: “There is a problem with this website’s security certificate. The security certificate presented by this website was not issued by a trusted certificate authority. The security certificate presented by this website was issued for a different website address. … Continue to this website (not recommended)”. Apache Friends said a warning message could appear. Maybe they were referring to such a message. I also never assigned the certificate to a different website; I do not know if the message here could mean assigning the certificate to the same website but with the http protocol. Clicking on Continue to this website (not recommended) as appears in the above message, takes me to the index page of my website. The URL reads: https://final.local/ I then can move from the index page to browse products. For Kona coffe, e.g.,the URL reads: https://final.local/browse/coffee/Kona/3 When I click on add to cart, it adds my products and moves me to the cart page. The URL of the cart page reads: https://final.local/cart.php As you know, to go to the next page from this cart page I have to click on Checkout. When doing so, it does not take me to the next page but rather gives ‘Internet Explorer Cannot Display the Webpage.’ In Chrome, it does the same but the message is error 105, and in FF the error is server is not available .
  10. I am writing an e-commerce website in multiple languages, including some eastern languages that have numerals in their languages different than the Arabic numerals used worldwide. To give an example: Arabic Numerals: 0 1 2 3,… Urdu Numerals: ٠ ١ ٣ ٤,… In countries using such Urdu, Persian, etc. numbers, PC keyboards are configured differently, some keyboards are configured to enter the Arabic numerals, while the majority of keyboards are configured to enter their native numbers. This invited a need to design my website so that credit card numbers, address and phone numbers can accept different forms of numerals. Since orders, users, … tables should have one form of numbers only, I am thinking of a script in which the user can enter credit card numbers, address and phone numbers in multiple form numbers and then all forms are translated in the tables to be in one form only, Arabic numerals. I would appreciate sharing any ideas, scripts, etc. to achieve this.
  11. Dear Larry, I got some help and guidance from Apache Friends forum, which thankfully you recommended us in the book to turn to for server-related issues, and they managed to provide a better revised code for virtual host and certificate folders. Now the https works in the website, see this below working URL for the cart page: https://final.local/cart.php?action=add&sku=C4 Clicking on the Checkout from the cart page (the page in the above URL), however, does not take me to the next page but rather gives the same old error message of: Internet Explorer cannot display the webpage. I think now the server issue is over but there could be an error somewhere in the script which does not allow proper checkout. The code I am using is downloaded from your forum. Below is what Apache Friends provided: httpd-vhosts.conf NameVirtualHost *:80 NameVirtualHost *:443 <VirtualHost *:80> DocumentRoot "C:/xampp/htdocs" ServerName localhost </VirtualHost> <VirtualHost *:80> ServerName final.local ServerAlias www.final.local DocumentRoot "C:/xampp/htdocs/site/final" <Directory "C:/xampp/htdocs/site/final" > Options Indexes FollowSymLinks Includes ExecCGI AllowOverride All Order allow,deny Allow from all </Directory> ServerAdmin admins@final.local CustomLog final_local_access.log combined ErrorLog final_local_error.log LogLevel debug </VirtualHost> <VirtualHost *:443> ServerName final.local ServerAlias www.final.local DocumentRoot C:/xampp/htdocs/site/final <Directory "C:/xampp/htdocs/site/final" > Options Indexes FollowSymLinks Includes ExecCGI AllowOverride All Order allow,deny Allow from all </Directory> SSLEngine on SSLCertificateFile conf/ssl.crt/server.crt SSLCertificateKeyFile conf/ssl.key/server.key ServerAdmin admins@final.local CustomLog final_local_access_ssl.log combined ErrorLog final_local_error_ssl.log LogLevel debug </VirtualHost> Windows host file 127.0.0.1 localhost #::1 localhost 127.0.0.1 final.local 127.0.0.1 www.final.local For https connection, the above code relies on the default certificate came with the installation of Xampp 1.7.7, while in the script code, I updated the gateway_process.php using the respective values of login and transaction key obtained from Authorize.Net. If this could be the problem, how to resolve it? If something is the problem, kindly advise. My test certificate and key from Authorize.Net are about 10 days old. PHP 5.3.8, MySQL 5.5.16. Many thanks Larry.
  12. Many thanks for your support and advice, Zhaopeterson. It’s not a browser problem because I tried Chrome, FF, and IE but all gave the same result, which is fine in http but not checking out to https. I am still in need of assistance, therefore, any help from anybody is greatly appreciated.
  13. Many thanks Zhaopeterson for your support. I installed Xampp 1.7.7 and have IE9, however, my OS is vista pack2. In my system TLS 1.1, 1.2 are no there. By default, SSL 3 & TLS 1 are checked and I checked TLS 2 and restarted IE9 but it did not work. I am afraid there could be something else related to improper configuration of the SSL. I followed a number of tutorials on how to configure SSL on windows but none worked for me so far. Then I deleted Xampp and freshly installed Xampp 1.7.7. I am just a beginner on server/security, and would certainly need some help to get me pass this step. I am now trying to rely on the default certificate and key of the Xampp server, therefore, I did not make any changes to the directories and files of the Xampp 1.7.7. I would highly appreciate showing me what you have amended, enabled or disabled, added or deleted in your Xampp and Windows files to get your site working on the https protocol. Once more, I would really appreciate your support and step by step guidance because I am not strong on server/security and SSL issues. Presently the following are the only changes I made on the files: httpd-vhosts.conf (available on: C:/xampp/apche/conf/extra I made a virtual host as follows: NameVirtualHost *:80 <VirtualHost *:80> DocumentRoot C:/xampp/htdocs ServerName localhost </VirtualHost> NameVirtualHost *:80 <VirtualHost *:80> DocumentRoot C:/xampp/htdocs/site/final ServerName www.final.local </VirtualHost> Windows hosts (available on: C:/Windows/System32/drivers/etc 127.0.0.1 localhost ::1 localhost 127.0.0.1 www.final.local 127.0.0.1 https://www.final.local Config.inc.php (available on: C:/xampp/phpMyAdmin) Added my root password inside the quotation marks of: $cfg['Servers'][$i]['password'] = ''; My cURL is enabled, and I even switched off firewalls from windows and McAfee, but still I am unable to check out. Many thanks.
  14. I clicked on Xampp administration, and on its homepage is the following sentence: For OpenSSL support please use the test certificate with https://127.0.0.1 or https://localhost I clicked on the link and got the following error: "SSL connection error Unable to make a secure connection to the server. This may be a problem with the server, or it may be requiring a client authentication certificate that you don't have. Error 107 (net::ERR_SSL_PROTOCOL_ERROR): SSL protocol error." While I am still searching online for how to remedy this error, any quick guidance would be highly appreciated. In Windows my SSL 3 is selected.
  15. I tried but pages of local websites are not accessible via https--it gives the same generic message: Internet Explorer Cannot Display the Web Site.
×
×
  • Create New...