Jump to content
Larry Ullman's Book Forums

Dar3D3vil

Members
  • Posts

    7
  • Joined

  • Last visited

Everything posted by Dar3D3vil

  1. Thank you Larry for your response. Good point. One of our classmates found the issue. So it's an issue in our Microsoft IIS v. 7+ remote server. The urlencode( ) method used to print to the URL the $categories query parameter converts the whitespace character into a + sign, but Microsoft IIS 7+ considers the "+" character in url queries a security risk and so the server removes it and breaks the link to "Dark Roast" category products. The solution is to add a DoubleEscaping= attribute to the <security></security> xml tag in the web.config file. Just sharing if anybody else runs into a similar issue. Source: https://stackoverflow.com/questions/4604392/symbol-problem-in-url-in-iis-7-x
  2. Hello administrators, I would like to request for some help please. I am Web developer in training at college. Using your book for our e-commerce course. I am using a Microsoft IIS server to host the ex2 website example. Unfortunately I do not know server version. And don't have someone to contact. The professor imported .htaccess file rewrite rules into the Microsoft IIS rewrite module which converted the rules to be used in a Microsoft IIS server in a live environment. The file is now a web.config file in xml markup. The following was the Rewrite rules conversion into the xml document (i can provide the entire xml file code if needed): <rewrite> <rules> <rule name="Imported Rule 1-1"> <match url="^shop/sales/?$" ignoreCase="false" /> <action type="Rewrite" url="sales.php" /> </rule> <rule name="Imported Rule 2-1"> <match url="^shop/([A-Za-z\+]+)/?$" ignoreCase="false" /> <action type="Rewrite" url="shop.php?type={R:1}" appendQueryString="false" /> </rule> <rule name="Imported Rule 3"> <match url="^browse/([A-Za-z\+\-]+)/([A-Za-z\+\-]+)/([0-9]+)$" ignoreCase="false" /> <!-- url format browse/type/categoryName/id --> <action type="Rewrite" url="browse.php?type={R:1}&amp;category={R:2}&amp;id={R:3}" appendQueryString="false" /> </rule> <rule name="Imported Rule 4" stopProcessing="true"> <match url="^(checkout\.php|billing\.php|final\.php|admin/(.*))$" ignoreCase="false" /> <conditions logicalGrouping="MatchAll"> <add input="{HTTPS}" pattern="off" ignoreCase="false" /> </conditions> <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="Permanent" /> </rule> </rules> </rewrite> I had a question about the "specific products" Rewrite rule regex characters. The whitespace character " \+ " will not convert appropriately in my live environment for a category GET request from the part of the Rewrite rule below " browse/ ..... /([A-za-z\+\-]+/ ..... " <match url="^browse/([A-Za-z\+\-]+)/([A-Za-z\+\-]+)/([0-9]+)$" ignoreCase="false" /> url to match: < browse/type/categoryName/id > When i click on the "View all Dark Roast Products" link or any "View All products" link, whose $category value has two words with a whitespace in between , I get a runtime error whenever the GET request tries to access that $category from my database. The affected link comes from the list_categories.html view file in the following code: echo '<ul class="items-list">'; while ($row = mysqli_fetch_array($r, MYSQLI_ASSOC)) { // Fetch each item. // Print the item within some HTML: echo '<li><h3>' . $row['category'] . ' </h3> <p><img alt="' . $row['category'] . '" src="/studentOne/web260/ex2/html/products/' . $row['image'] . '" />' . $row['description'] . '<br /> <a href="/studentOne/web260/ex2/html/browse/' . $type . '/' . urlencode($row['category']) . '/' . $row['id'] . '" class="h4">View All ' . $row['category'] . ' Products</a></p> </li>'; } echo '</ul>'; When I click on that <li><h3><p><img><a> View All $category Products</a> link i receive this error page: Server Error in '/******/******' Application. Runtime Error Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine. Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off". <!-- Web.Config Configuration File --> <configuration> <system.web> <customErrors mode="Off"/> </system.web> </configuration> Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's <customErrors> configuration tag to point to a custom error page URL. <!-- Web.Config Configuration File --> <configuration> <system.web> <customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/> </system.web> </configuration> NOTE: The title "Server Error in: ....", at the top of the error page, the actual directory of the server are omitted to ensure I am not releasing any confidential information about the server. Any suggestions are appreciated. I thought of substituting the " \+ " with " \s " or " %20 " to translate the whitespace character to the appropriate regex character for a Microsoft IIS server, but I still receive the same runtime error as above, and the browser continues to redirect to the web.config file. Thanks for any help you may provide.
  3. Thanks Larry! and good tip! I'll do that. I thought it was saving space, but I forgot other users may find the information useful and easier to look at on the post versus a download.
  4. Larry thank you so much. I used your suggestions and they helped to me to work out the references for specific products in the Coffee and Sales content: http://web260.local/homework/ex2/html/shop/coffee/ http://web260.local/homework/ex2/html/shop/sales/ When I looked further into the sales.php and shop.php scripts require(./views/list_categories.html) and require(./views/list_sales.html) I found the html references to append "/homework/ex2/html" in those html files, located in the views directory. I will continue on debugging the goodies,wishlist, and cart sections. If I do run into issues with those would it be better to create another post for that inquiry? Best, Kristian
  5. Thank you for responding to my post. By secondary links I mean the coffee site sections: Coffee, Goodies, Sales, Wishlist, Cart. The URL that works is my index.php page that includes the Sales items image from the /view/home.html page in the index.php: http://web260.local/homework/ex2/html/shop/sales/#O2 The images in the coffee shop.php url : are broken. I can see that part of the reference is missing which is "/homework/ex2/html/ " , but I do not understand where they are being referenced. Please excuse my lack of debugging experience I am new at web development. http://web260.local/products/dark_roast.jpg
  6. Sorry please disregard the attachment Chapter 7 bugs to fix, that is only a check list for myself. Please consider the following file attachments for the questions I asked in my post that refer the files: Files-modified-ex2site.zip URL path trouble ex2 Site.zip
  7. Hello Larry, Thank you for the publishing of your book. We are using it at school to learn development of an e-commerce site. I wanted to share with you an issue me and some of my classmates have run into in chapter 7. I am testing the ex2 site locally with the following specs: PHP 7.1.33 MySQL 5.7.28 using Local.app by flywheel to run local Apache server Using PHPStorm to run and debug my code. It seems like my .htaccess rules are not working, but I am not sure why the rules are not redirecting correct, Kind of having a hard time understanding if it's the htaccess file or my headers.html, or home.html files? I attached a zipped file of my configurations. The code in my htaccess file is just like the Ex2 2016 code download, except I have subdirectories "/homework/ex2/html/" as the rewriteBase value (2nd edition book, page 201, Using Subdirectories). We were asked to place our site files into a subdirectory. I'll attach my htaccess file, headers.html, and home.html in a separate zip file (Files-modified-ex2site.zip). The main issues is that my secondary links to the site sections are producing broken images. I explain this in more detail in the Chapter 7 bugs zip file. I have tried multiple relative and absolute path edits, but the current set up is the best I could figure out to access most of the files on my local test browser. Any help is appreciated. Chapter 7 Bugs to fix.zip Files-modified-ex2site.zip Chapter 7 Bugs to fix.zip
×
×
  • Create New...