Jump to content
Larry Ullman's Book Forums

vikky

Members
  • Posts

    27
  • Joined

  • Last visited

Posts posted by vikky

  1. Hi Greetings,

        Yes Sir, this is the registration script. There are two fields for the password in the registration script (1) for the password and another (2) for the confirm password. I had posted only the modified password part of the script above. Now the complete modified password part of the script is:

    // Check for a password and match against the confirmed password:
        if (preg_match('/^(\w*(?=\w*\d)(?=\w*[a-z])(?=\w*[A-Z])\w*)
    {8,}$/', $_POST['pass1']) ) {
            if ($_POST['pass1'] === $_POST['pass2']) {
                $p = $_POST['pass1'];
            } else {
                $reg_errors['pass2'] = 'Your password did not match the confirmed password!';
            }
        } else {
            $reg_errors['pass1'] = 'Please enter a valid password!';
        }

    Many Thanks,

  2. Sir,
        
        As mentioned in your book the strong password system is good. So I increased the characters required for the password from 6 to 8.

    if (preg_match('/^(\w*(?=\w*\d)(?=\w*[a-z])(?=\w*[A-Z])\w*){8,}$/', $_POST['pass1']) ) {
            

        }

    To test the modification I tried to register with 6 characters password but it had not showed any error and I got registered. Then I cleared the browser's cache and restarted the Apache xampp, but again it had not showed any error and I got registered.

    Then I decreased the number of password characters to 4 - it had not showed any error and I got registered.

    Please guide me about this.

    Thanking You,

  3. Case 1

    --- With the below rule :

    RewriteRule ^browse/(coffee|goodies)/([A-Za-z0-9\+\-]+)/([0-9]+)/?$ browse.php?type=$1&category=$2&id=$3

    if I type URL - Just by taking out the % sign -

    localhost/browse/goodies/Books+26+DVDs/3

    --- The page is loading perfectly

    On the window's tab it is showing Goodies to Buy::Books 26 DVDs


    Case 2

    --- With the below rule :

    RewriteRule ^browse/(coffee|goodies)/([A-Za-z0-9\%\+\-]+)/([0-9]+)/?$ browse.php?type=$1&category=$2&id=$3


    if I type URL - Just by taking out the % sign -

    localhost/browse/goodies/Books+26+DVDs/3

    --- The page is loading perfectly

    On the window's tab it is showing Goodies to Buy::Books 26 DVDs

     

    Case 3

    --- With the below rule :

    RewriteRule ^browse/(coffee|goodies)/([A-Za-z0-9\&\+\-]+)/([0-9]+)/?$ browse.php?type=$1&category=$2&id=$3

    --- With or Without escaping ampersand

    if I type the URL as given below :

    localhost/browse/goodies/Books+%26+DVDs/3

    --- The page is loading perfectly

    But

    On the window's tab it is showing Goodies to Buy::Books

    Not Books & DVDs

     

    Case 4

    If I type the URL directly as localhost/browse.php?type=goodies&category=Books+%26+DVDs&id=3

    --- The page is loading perfectly

    On the window's tab it is showing Goodies to Buy::Books & DVDs

    And

    The browse script is also working for the other categories.

    Sir you can also check the script at your end just add another category Books & DVDs

    Sir Case 3 is not completely solving the issue - what are your views ?

    In your Book on page no. 91 you have mentioned about the zero-width positive lookahead assertion can that be helpful in this situation.

    Thank You,

  4. Hi Greetings,

    Sir What I have done is:

    1) I have created a category named Books & DVDs.

    2) I have modified my htaccess file as mentioned above.

    So my FULL URL is localhost/browse/goodies/Books+%26+DVDs/3

     

    I am receiving this general message -

    Object not found!

    The requested URL was not found on this server. The link on the referring page seems to be wrong or outdated. Please inform the author of that page about the error.

    If you think this is a server error, please contact the webmaster.

    Error 404

    localhost
    Apache/2.4.23 (Win32) OpenSSL/1.0.2h PHP/7.0.13

     

    This is very important because numerous books titles and Brand names have  -------- & -------- sign as their identity.

    Thank You,

  5. Hi Greetings,

    Thank You Sir for the great support in the learning process.

    My question is - On the browse page I wanted to give a category name Books & DVDs for the non-coffee products. But when the page is loaded it is not displayed.

    If I URL ENCODE this name it will become Books+%26+DVDs.

    And my htaccess file is

    # For specific products:
    RewriteRule ^browse/(coffee|goodies)/([A-Za-z\+\-]+)/([0-9]+)/?$ browse.php?type=$1&category=$2&id=$3

    I have tried         RewriteRule ^browse/(coffee|goodies)/([A-Za-z0-9%\+\-]+)/([0-9]+)/?$ browse.php?type=$1&category=$2&id=$3

    but it is working. I have tried other patterns also.

    I don't know how to modify it.

    Please provide the guidance.

    Thank You,

  6. Greetings,

    Sir I asked you about the use of SSL in the site now I want to know how can I use it in the entire site.

    Below is the given my HTACCESS FILE as it is now - Please guide me how can I modify it so my site can not be accessed without the SSL anywhere.

     

    <IfModule mod_rewrite.c>
    Options -MultiViews
    RewriteEngine on
    
    # For the primary categories:
    RewriteRule ^shop/(coffee|goodies)/?$ shop.php?type=$1
    
    # For sales:
    RewriteRule ^shop/sales/?$ /sales.php
    
    # For specific products:
    RewriteRule ^browse/(coffee|goodies)/([A-Za-z\+\-]+)/([0-9]+)/?$ browse.php?type=$1&category=$2&id=$3
    
    # For HTTPS pages:
    RewriteCond %{HTTPS} off
    RewriteRule ^(checkout\.php|billing\.php|final\.php|admin/(.*))$ https://%{HTTP_HOST}/$1 [R=301,L]
    
    </IfModule>

     

    Thank You Very Much,

  7. Thank you very much for the solution and the time you took to debug this problem.

     

    Steps taken:

     

    1. Open product_functions.inc.php under includes directory.

    2. This is my modified get_just_price() function.

    function get_just_price($regular, $sales) {

     
    // Return the sale price, when appropriate:
    if ((0 < $sales) && ($sales < $regular)) {
    return $sales/100;
    } else {
    return $regular/100;
    }
     
    }

     

    Now its showing the correct prices.

     

    Second problem which daddytiger has mentioned.

     

    Steps taken:

     

    1. Increased the quantity of the specific_coffees to 300 in the phpmyadmin.

    2. Clicked add to cart in the http://localhost/browse/coffee/Kona/3.

    3. Increased the quantity in the cart.php from 1 to 277 but it is showing only 127.

    So there is a problem.

     

    Looking in the SQL table structure:

     

    carts - `quantity` TINYINT(3) UNSIGNED NOT NULL.

     

    non_coffee_products - `stock` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0'.

     

    order_contents - `quantity` TINYINT(3) UNSIGNED NOT NULL.

     

    specific_coffees - `stock` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0'.

     

    wish_lists - `quantity` TINYINT(3) UNSIGNED NOT NULL.

     

    It seems there is a mismatch between `quantity` and `stock`.

     

    I am not very sure about the stored procedures.

     

    Your opinions are very important.

  8. When I run this query:

     

    CALL get_shopping_cart_contents('8fffa77c5b12ea1aa09922e1053aa52a');

     

    sku   quantity    category     name                                         price     stock sale_price
    C3         21        Kona          Half Pound - decaf - ground       5000    200   NULL
    C6         2          Kona          1 lb. - caf - whole                      75000    50     NULL
    C4         1          Kona          1 lb. - caf - ground                  800000    50     NULL
    C5         2          Kona          1 lb. - decaf - ground              850000    20     NULL
     
    I think the prices are correct.
     
    And there is not any sale item in the cart right now.
     
    And thanks to daddytiger so much I will surely look into the codes. But can you provide me the step by step details because I am still in a learning phase.
  9. I have run the stored procedure.

     

    Call select_products('coffee', 3);

     

     
     
     
     
     
     
     
    description image sku name stock price sale_price   A real treat! Kona coffee, fresh from the lush mou... kona.jpg C4 1 lb. - caf - ground - $8,000.00 50 800000 NULL A real treat! Kona coffee, fresh from the lush mou... kona.jpg C6 1 lb. - caf - whole - $750.00 50 75000 NULL A real treat! Kona coffee, fresh from the lush mou... kona.jpg C5 1 lb. - decaf - ground - $8,500.00 20 850000 NULL A real treat! Kona coffee, fresh from the lush mou... kona.jpg C7 1 lb. - decaf - whole - $8.00 20 800 700 A real treat! Kona coffee, fresh from the lush mou... kona.jpg C8 2 lbs. - caf - whole - $15.00 30 1500 NULL A real treat! Kona coffee, fresh from the lush mou... kona.jpg C9 2 lbs. - decaf - whole - $15.50 15 1550 NULL A real treat! Kona coffee, fresh from the lush mou... kona.jpg C1 2 oz. Sample - caf - ground - $2.00 20 200 NULL A real treat! Kona coffee, fresh from the lush mou... kona.jpg C10 5 lbs. - caf - whole - $32.50 5 3250 NULL A real treat! Kona coffee, fresh from the lush mou... kona.jpg C2 Half Pound - caf - ground - $4.50 30 450 NULL A real treat! Kona coffee, fresh from the lush mou... kona.jpg C3 Half Pound - decaf - ground - $50.00 200 5000 NULL

     

    It is showing the correct prices.

     

    But I don't know how to debug this problem correctly. It would be highly appreciated if you solve it.

     

     
     
     
     
     
     
     
    description image sku
     
     
     
     
     
     
     
    description image sku name stock price sale_price   A real treat! Kona coffee, fresh from the lush mou... kona.jpg C4 1 lb. - caf - ground - $8,000.00 50 800000 NULL A real treat! Kona coffee, fresh from the lush mou... kona.jpg C6 1 lb. - caf - whole - $750.00 50 75000 NULL A real treat! Kona coffee, fresh from the lush mou... kona.jpg C5 1 lb. - decaf - ground - $8,500.00 20 850000 NULL A real treat! Kona coffee, fresh from the lush mou... kona.jpg C7 1 lb. - decaf - whole - $8.00 20 800 700 A real treat! Kona coffee, fresh from the lush mou... kona.jpg C8 2 lbs. - caf - whole - $15.00 30 1500 NULL A real treat! Kona coffee, fresh from the lush mou... kona.jpg C9 2 lbs. - decaf - whole - $15.50 15 1550 NULL A real treat! Kona coffee, fresh from the lush mou... kona.jpg C1 2 oz. Sample - caf - ground - $2.00 20 200 NULL A real treat! Kona coffee, fresh from the lush mou... kona.jpg C10 5 lbs. - caf - whole - $32.50 5 3250 NULL A real treat! Kona coffee, fresh from the lush mou... kona.jpg C2 Half Pound - caf - ground - $4.50 30 450 NULL A real treat! Kona coffee, fresh from the lush mou... kona.jpg C3 Half Pound - decaf - ground - $50.00 200 5000 NULL name stock price salghghgghhge_price   A real treat! Kona coffee, fresh from the lush mou... kona.jpg C4 1 lb. - caf - ground - $8,000.00 50 800000 NULL A real treat! Kona coffee, fresh from the lush mou... kona.jpg C6 1 lb. - caf - whole - $750.00 50 75000 NULL A real treat! Kona coffee, fresh from the lush mou... kona.jpg C5 1 lb. - decaf - ground - $8,500.00 20 850000 NULL A real treat! Kona coffee, fresh from the lush mou... kona.jpg C7 1 lb. - decaf - whole - $8.00 20 800 700 A real treat! Kona coffee, fresh from the lush mou... kona.jpg C8 2 lbs. - caf - whole - $15.00 30 1500 NULL A real treat! Kona coffee, fresh from the lush mou... kona.jpg C9 2 lbs. - decaf - whole - $15.50 15 1550 NULL A real treat! Kona coffee, fresh from the lush mou... kona.jpg C1 2 oz. Sample - caf - ground - $2.00 20 200 NULL A real treat! Kona coffee, fresh from the lush mou... kona.jpg C10 5 lbs. - caf - whole - $32.50 5 3250 NULL A real treat! Kona coffee, fresh from the lush mou... kona.jpg C2 Half Pound - caf - ground - $4.50 30 450 NULL A real treat! Kona coffee, fresh from the             
  10. The column definition for the price currently is INT UNSIGNED NOT NULL which is 4,294,967,295 and my current prices are below this numeral.

     

    For example: (1) When I increased the price of the Kona::Half Pound - decaf - ground from $5.00 to $50.00 (added one 0). It is showing the correct result. $50.00 x 21 (qty) = $1,050.00.

     

    (2) When I increased the price of Kona::1 lb. - caf - whole from $7.50 to $750.00. It is giving the correct answer. $750.00 x 2 = $1,500.00. BUT

     

    (3) When I increased the price of Kona::1 lb. - caf - ground from $8.00 to $8,000.00. It is not giving the accurate answer.

     

    (4) When the price of Kona::1 lb. - decaf - ground is increased from $8.50 to 8,500.00 and the quantity is increased from 1 to 2. It is showing $16.00 instead of $17,000.00.

×
×
  • Create New...