Jump to content

CroNiX

Staff Alumni
  • Posts

    1,469
  • Joined

  • Last visited

  • Days Won

    12

Posts posted by CroNiX

  1. You have one image with the ID of "house". It looks like your script is working on that ID. I don't know that script, but it seems if you changed the image to be CLASS=house instead of ID=house, and then have multiple images with CLASS=house, and change the script to work with '.house' instead of '#house' it would work on all images with that class.

  2. Then most likely your query is failing, but you never check for that and just assume it runs .  See how they do it in http://php.net/manual/en/function.mysql-query.php in the first example labeled "Example #1 invalid query"

     

    My guess is because you don't have a space after the WHERE and when you add to the query.

     

    As a side note, mysql is deprecated and will be removed from PHP in the future. You should be using PDO or mysqli if you don't want to have to rewrite all of this for newer upcoming versions of PHP. You're not doing yourself any favors by using something that is already deprecated.

  3. Well it looks like you are already grabbing the product info in AJAX_Quote.php here:

    $SQL_GetEquipment = "SELECT * FROM `new_equip` WHERE `id`='$EID' LIMIT 1;";
    $R_GetEquipment = mysql_query($SQL_GetEquipment, $Link);
    $row = mysql_fetch_assoc($R_GetEquipment);

    So when building the $EmailBody text, you just need to add whatever extra columns you want to output based on what they're called in the db. It should already be present in $row.

     

    Something like:

    $EmailBody = "$Name has requested a quote from NAPE \n
    
    Information on quote request: \n
    Name: $Name \n
    Email: $Email \n
    Company: $Company \n
    Number: $Number \n
    \n
    Location: $Location \n
    Our Price: $OurPrice \n
    \n
    Product Name: {$row['product_name']}\n //display the product name
    Send a quote now: http://www.packagingequipment4sale.com/admin/Admin_Quote.php?Email=$Email&EID=$EID ";
    • Like 1
  4. If you do want multiple projects/sites on your dev box, create a virtual host and you don't need to muck around with that stuff. Each project should have one. Then the url could just be "www.yoursite.dev" or whatever you want the domain name to be on your dev server instead of "localhost/projectname". Then when you create absolute links like "/post/12/postname" it would be correct, like www.yoursite.dev/post/12/postname. You also wouldn't need to alter settings between the dev and live servers.

  5. Define "multi domains".  If you mean www.domain1.com and www.otherdomain.net, then you can't. SSL certs are only good for a single domain.

     

    If you mean www.domain1.com and subdomain.domain1.com (same domain, different subdomains), then you can with a "wildcard" certificate but they're also more expensive, but they'll work for all subdomains of your main domain.

     

    Before giving blanket advice on what kind of certificate for you to get, it's really kind of important to know what it will be used for. Is this just to log into the site? eCommerce? Explain what you need the encryption for.

  6. You use nl2br() when you OUTPUT the stored data from the database. It converts the hidden line breaks (\n) that occur when hitting return in a textarea (and others form controls) back into HTML <br />'s. In your database they are stored as \n but you can't see them when viewing directly, as they're hidden control characters.

  7. You could try shortening all of those variables, but you'd have to recode where they are used in your app too...but a simple find/replace could help with that. They don't need to be "human readable" in the URL. Your app is the only thing than needs to understand them.

    hid = hotel_id

    cc = currency_code

    etc

  8. Try this:

    <?php
    include("AddStats_admin_connect.php");
    //connect to database
    doDB();
    //Function to build select options based on passed array
    function buildSelectOptions($options)
    {
      $optionsHTML = '';
      foreach($options as $id => $label)
      {
        $optionsHTML .= "<option value='{$id}'>{$label}</option>\n";
      }
      return $optionsHTML;
    }
    
    //Run query to get the ID and Name from the table
    //Then populate into an array
    $clist_sql = "SELECT CID, Country FROM Countries";
    $clist_res= mysqli_query($mysqli, $clist_sql) or die(mysqli_error($mysqli));
    if (mysqli_num_rows($clist_res) < 1) {
      //this Country not exist
      $display_block = "<p><em>You have selected an invalid Country.<br/>
      Please try again.</em></p>";
    }
    
    $countries = array();
    while($Ctry_info = mysqli_fetch_array($clist_res))
    {
      $countries[$Ctry_info['CID']] = $Ctry_info['Country'];
    }
    $countryOptions = buildSelectOptions($countries);
    ?>
    
    <!DOCTYPE html>
    <html lang="en">
    <head>
    <title>Stats</title>
    <link rel="stylesheet" href="stylesheets/style.css" />
    <!--[if IE]>
    <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
    </head>
    <body>
      <form action="CountryOptions.php" method="post">
      <!-- You need to set up the select element to house the options. This will be set in $_POST as $_POST['country'] -->
        <select name="country">
          <?php echo $countryOptions; ?>
        </select>
        <input type="submit" value="Submit Choice">
      </form>
    </body>
    </html>
  9. <select name="country"><?php echo $optionsHTML; ?></select>

    You named that $countryOptions here (not $optionsHTML)

    1. $countryOptions = buildSelectOptions($countries);

    So you need to replace $optionsHTML with $countryOptions where you are outputting your <select>

     

    The only place $optionsHTML lives is in your buildSelectOptions() function, so only that function knows what it is.

     

    Do you have error reporting turned on? You should be getting PHP errors/warnings for using things that aren't defined like $optionsHTML where you output it in your <select>.

  10. Yes, if you used hash('sha256', $password) when they registered, and you stored that hash in the db.

     

    Also, these lines are unnecessary and could be causing issues as they can change the value of what you are running them against. They are also unnecessary/useless when using prepared statements:

    $username = mysqli_real_escape_string($conn, $_POST['username']);
    $password = mysqli_real_escape_string($conn, $_POST['password']);

    remove those.

  11. So when the user enters their password in the form, you need to hash their supplied value using the same hashing method as you did to store it in the db when they registered, so that the query will check if (hashed_value === stored_hash_value). Otherwise you're comparing apples to oranges and the password will never match.

     

    so this:

    $password = $_POST['password'];

    should be:

    $password = your_hashing_function($_POST['password']);
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.