Jump to content
Larry Ullman's Book Forums

ZTischenko

Members
  • Posts

    4
  • Joined

  • Last visited

ZTischenko's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Hi Larry, Many thanks for your replay, I have following in http.conf : <Directory "C:/websites"> AllowOverride All and this too: DocumentRoot "C:/websites" <Directory /> Options All AllowOverride All </Directory> Still - no luck with rewrite module. Regards Zoryana
  2. Hi Larry, many thanks for your replay, I decided to move on and leave url transformation for later, looks like script passing variables ok, if I am coding brands.php?brand=... instead of brand/canon/ as was intended at the beginning. I am worried about security issues thus I will have to come back to this issue when site goes live. So if you will have a thought why would apache 2.2 reject to obey rewrite rules that i have defined in .htaccess file in root directory - that would be so much appreciated! My directory structure is on image enclosed. Many thanks! Regards Zory
  3. well, I got brands.php to display images for items taken from database OK, my brands.php is in site root directory along with browse.php, everything seems to be working up to the moment when I am passing 'category' and 'id' to browse.php. This is for some reason do not work. I spent last 9 hrs trying to figure out why it is not working, could you (please,please,please) look at my code? regards Zory
  4. Hi Larry, Many thanks for writing such a good book - I am new to e-commerce and found your book to be very helpful. Here is my problem (i have done google search, but didn't work out solution feeling so frustrated:(( ): Software used: Apache 2.2, php 5.3.5, MySql Server 5.1, Windows 7. Working on catalogue, created database, populated tables, slightly modified code since my product has only 1 type (deleted if statements that determine type), even created page which shows me available Brands (I am using brands.php instead of shop.php, I adjusted .htaccess for this file name) so all procedures are working and I am getting info from database ok. Then I have a link which says <a href="browse/'.urlencode($row['brand_name']).'/'.$row['brand_id'].'"> , and when I put my cursor over the link on page in browser, then I can see that link should point to e.g localhost/emacs/html/browse/Canon/1 but when I press link my browser says that link is broken. When I am trying to load browse.php it shows error message (I have an impression that my script in brands.php (analog to your shop.php) do not pass variables to browse.php). On a top of this my Apache totally ignores rules that I set to rewrite url. I google it and everybody say you need to uncomment three lines, from which I have config file only one (and I did uncomment it):LoadModule rewrite_module modules/mod_rewrite.so, by the way I noticed that you use in .htaccess syntax 'mod_rewrite.c' but my apache conf file doesn't have such a file. Here is my htaccess: <IfModule mod_rewrite.so> RewriteEngine on # For sales: RewriteRule ^brands/sales/?$ sales.php # For the primary categories: RewriteRule ^brands/([A-Za-z\+]+)/?$brand.php # For specific products: RewriteRule ^browse/([A-Za-z\+\-]+)/([0-9]+)$browse.php?&brand_name=$1&brand_id=$2 # For HTTPS pages: RewriteCond %{HTTPS} off RewriteRule ^(checkout\.php|billing\.php|final\.php|admin/(.*))$ https://%{HTTP_HOST}/$1 [R=301,L] </IfModule> here is my brands.php (analogue to your shop.php) <?php require('/includes/config.inc.php'); require(MYSQL); $page_title="Brands Catalog - Shopping Area - Based in Dublin - Supplier of wide range of printer cartridges at the lowest prices in Ireland - Free next day delivery and 100% quality guarantee"; include('/includes/header2.html'); $r=mysqli_query($dbc,"CALL select_brands()"); if(!$r) echo mysqli_error($dbc); if(mysqli_num_rows($r)>=1){ include('/views/list_brands.html'); }else{ include('/views/error.html'); } include('/includes/footer2.html'); ?> here is list_brands.html: <div class="main_brand"><fieldset><legend>If you can't find a toner...</legend><p>If you can't find brand that you are looking for in list below, <a href="mailto:ztischenko@emacs-enterprise.ie">email</a> us toner name you are looking for and we will come back to you on possibility to get it.</p></fieldset></div> <div class="brand_d"> <ul class="brand_list"> <?php while ($row=mysqli_fetch_array($r,MYSQLI_ASSOC)){ echo '<li><fieldset><legend>'.$row['brand_name'].'</legend>'.'<div><a href="page.html"><img alt="Click to view all printers in this category" src="products/'.$row['image'].'"/></a>'.'There are toners for <a href="browse/'.urlencode($row['brand_name']).'/'.$row['brand_id'].'">'.$row['printer_count'].'</a>'.' '.$row['brand_name'].' printers listed on our website.</div>'.'</fieldset></li>'; } ?> </ul> </div> and finally here is my browse.php: <?php require('/includes/config.inc.php'); $brand_name=$sp_brand=false; if(isset($_GET['brand_name'],$_GET['brand_id'])&& filter_var($_GET['brand_id'], FILTER_VALIDATE_INT, array('min_range'=>1))){ $brand_name=$_GET['brand_name']; $sp_brand=$_GET['brand_id'];} if(!$sp_brand||!$brand_name){ $page_title='Error!'; include('/includes/header2.html'); include('/views/error.html'); include('/includes/footer2.html'); exit(); } $page_title='Buy'.$brand_name.' at the best prices in Ireland.'; include('/includes/header2.html'); require(MYSQL); $r=mysqli_query($dbc,"call select_printers('$sp_brand')"); if(mysqli_num_rows($r)>=1){ include('/views/list_printers.html'); }else{ include('/views/noproducts.html'); } include('/includes/footer2.html'); ?> When I view browse.php in 'live code' view in Dreamviewer then I see error message from error.html. Could you please help me? I spent smth like 8 hrs in a row and I seem not moving anywhere... Many thanks in advance, Regards Zory
×
×
  • Create New...