Jump to content
Larry Ullman's Book Forums
Sign in to follow this  
Silver

Unable To Checkout

Recommended Posts

I have downloaded the coffee example code and it works fine, except:

  1. I am using a virtual host. Every time I go to the cart I see the previous list of items still there, which is acting like a sticky cart. Is this normal for virtual hosts or there is something wrong?
  2. I signed for an Authorize.Net Developer Test Account, and it seems the result was positive because I was given an API Login ID, transaction key, payment gateway, as well as a list of virtual credit cards numbers. But when I click on the Checkout from the cart page, I get ‘Internet Explorer Cannot Display the Webpage’ error message. I checked the Internet Options and found both SSL and TLS protocols enabled under the security section. The URL for the page that fails to connect is:
    https://www.final/local/checkout.php?session=85bcab41b9dc0faa030cfdb608c12b5f

www.final.local is my virtual website.

I would highly appreciate any assistant in checking me out.Both PHP & MySQL are 5+.

Share this post


Link to post
Share on other sites

Hello friends,

 

I forgot to add that the curl looks like:

 

curl

 

cURL support enabled cURL Information 7.20.0 Age 3 Features AsynchDNS Yes Debug No GSS-Negotiate No IDN No IPv6 Yes Largefile Yes NTLM Yes SPNEGO No SSL Yes SSPI Yes krb4 No libz Yes CharConv No Protocols dict, file, ftp, ftps, http, https, imap, imaps, ldap, pop3, pop3s, rtsp, smtp, smtps, telnet, tftp Host i386-pc-win32 SSL Version OpenSSL/0.9.8o ZLib Version 1.2.3

 

Also, I updated the gateway_process.php using the respective values of login and transaction key obtained from Authorize.Net.

My system is Apache, Windows, both PHP & MySQL are release 5+.

Share this post


Link to post
Share on other sites

Well, the main problem is the inability to check out. I wouldn't worry about that cart right now. My suspicion is that your SSL isn't configured correctly. How did you install Apache?

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

Hi, Silver:

 

After I seen your post I tried to test the site (I installed xampp 1.7.7. on window 7) and similar problem you had. The IE9 says it has trouble accessing this site along with the note.

•If this is an HTTPS (secure) address, click Tools, click Internet Options, click Advanced, and check to be sure the SSL and TLS protocols are enabled under the security section.

 

So I went to my IE 9 tool bar clicked "Internet Options" then a dialog box came up, I clicked the advanced tab,

I checked all the following under the security section:

use SSL 2.0 (I checked on this)

use SSL 3.0 (it was the default already checked)

use TLS1.0 (it was the default already checked)

use TLS1.1 (I checked on this)

use TLS1.2 (I checked on this)

 

Then I restarted IE9, it worked (I can see the coffee site and was able to check out) on localhost.

 

My IE address bar still have red highlight says "certificate error", however I just ignor it as I know this is probably has something to do with XAMPP setting. I will post questions on Apache (xampp) forum later. However I think going to IE security setting is the way to get around that. Hope it helps.

 

P. S. I did load the scripts to my own SSL enabled remove server (with Lunarpages). The scripts worked fine in IE.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

sorry Silver I could not be any more help on this. I use Window 7 and downloaded xampp1.7.7. I have not done any other configuration on SSL (it came enabled as is, thank God it worked as I will not know how to figure out how). I am also a beginner, looks like you know more about this.

 

I do have my own remove server with Lunarpages.com, they installed SSL for me so saved me headaches.

 

The checkout.php worked on Firefox, Chrome and Opera (they all give out security warnings I just click proceed), for IE 9 I did what I mentioned above, that is it.

 

Did you at least get it work in Firefox? Is it a browser related issue?

 

P.S. I am a UI designer, I am more a HTML/CSS people, I know some programming php/mysql bare enough to get through the book, that is it. I am trying to read on xampp forum to understand those configuration stuff more, I saw you were there too, good luck.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

I'm glad you were able to get help there. I haven't had the chance to boot up my Windows machine yet to take a look at this myself.

 

As for your problem, you're saying that you know HTTPS is working because you can load the cart.php script through HTTPS? What is the URL that's giving you the "Internet Explorer cannot display the webpage" error message?

 

I can't imagine this has anything to do with Authorize.Net.

Share this post


Link to post
Share on other sites

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 .

Share this post


Link to post
Share on other sites

You're seeing those errors regarding the certificate because you're using a generic certificate. Apache Friends said that warning could appear and now it is. That's not a problem at all. You're browser is just trying to protect you and you just need to click the "continue" option to load the page via HTTPS.

 

As for your actual problem, do you want to, maybe, provide the URL that's giving you that error message, as I asked in my previous post?

Share this post


Link to post
Share on other sites

Okay, so the problem is in your URL. The URLs that are working for you begin final.local/. The URL you've posted begins www.final/local. Most likely the problem is in your code on cart.php, which links to your checkout page.

Share this post


Link to post
Share on other sites

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');

?>

 

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

It wasn't working because it wasn't correct. clearly final.local and final/local are two different things. As for the format, if they're working, they're fine.

Share this post


Link to post
Share on other sites

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.   Paste as plain text instead

  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.

Loading...
Sign in to follow this  

×
×
  • Create New...