Jump to content

thilakan

Members
  • Posts

    20
  • Joined

  • Last visited

thilakan's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thank you for your answer. Why you think is heard part, would you please give me more information.
  2. Thank you for your answer. My biggest problem is how can I get hold of the daily/weekly/monthly price list from the supermarket. Is there a way, I can access their website? Like supper market price comparing site,
  3. return (int) $value VS return $value What is the purpose of using int in a bracket? return (int) $value Which is the best and safest method? Thank you
  4. I am building cooking website. If the users want to check the price of the ingredients in different supermarkets they can do so. Button one for supermarket one Button two for supermarket two Once the click button; it will show the ingredients list with the current price. How would I go about doing this? How do I get the current price from the supermarket? Do I need to get permission from the supermarket? Check this web site http://www.jamieoliver.com/recipes/vegetables-recipes/corn-chowder-with-a-homemade-chilli-cracker/ THANK YOU
  5. $ error = trim( strip_tags($_GET['error']) ); VS $strip_error = strip_tags($_GET['error']) ; $trim_error = trim($strip_error); Which method is correct way? Also I am first striping and trimming is it wright way. could you please advice me. Thank you
  6. PDO-Prepared Statements using mysqli_real_escape_string Is it a good Idea to use mysqli_real_escape_string for extra security In the Prepared Statements <?php try { require_once '../includes/pdo_connect.php'; $make = mysqli_real_escape_string($_GET['make']); $sql = 'SELECT * FROM cars WHERE make LIKE :make AND yearmade >= :yearmade AND price <= :price ORDER BY price'; $stmt = $db->prepare($sql); $stmt->bindValue(':make', '%' . $make . '%'); $stmt->bindParam(':yearmade', $_GET['yearmade'], PDO::PARAM_INT); $stmt->bindParam(':price', $_GET['price'], PDO::PARAM_INT); $stmt->execute(); $errorInfo = $stmt->errorInfo(); if (isset($errorInfo[2])) { $error = $errorInfo[2]; } } catch (Exception $e) { $error = $e->getMessage(); }
  7. Undefined error Why I am getting this error? What I am trying archive - I want to get the client location and stored in the database Please advise me. Thank you. <!DOCTYPE html> <html> <body> <script> function geoFindMe() { var output ; if (!navigator.geolocation){ output.innerHTML = "<p>Geolocation is not supported by your browser</p>"; return; } else { function success(position) { var latitude = position.coords.latitude; var longitude = position.coords.longitude; return(output.innerHTML = '<p>Latitude is ' + latitude + '° <br>Longitude is ' + longitude + '°</p>'); }; function error() { output.innerHTML = "Unable to retrieve your location"; }; navigator.geolocation.getCurrentPosition(success, error); } } var x = geoFindMe(); alert(x); </script> </body> </html>
  8. Thank you for your answer. In the learning process of PHP, if I have question it is good to ask and have clear answer. THANK YOU ALL!
  9. Thank you for your answers. 1. mogosselin, As you said that “returned value is something unexpected, you should kill your app” Are you telling me that I need to check the return value? 2. Before we return the value we are checking it then returning it. How is it secure?
  10. TRY include("httpdocs/new_folder/header.php");
  11. In a function; I am expecting a return value. I cannot assume that it will always run successfully. So I want to check the return value is the one I expected.
  12. Where should I validate the return value? In the function should I validate the value before returning it. Or once the value has been returned, should I check it? Is it really necessary to validate the return value? Thank you.
  13. Thank you for your answer. Now I am going to place the password_needs_rehash code in the login file. My code looks like this: if (password_verify('password', $hash)) { echo 'Password is valid!'; // CHECK TO SEE PASSWORD NEED REHASH if (password_needs_rehash($hash, $algorithm, $options)) { $hash = password_hash($password, $algorithm, $options); /* Store new hash in db */ } } else { echo 'Invalid password.'; }?> Is this the right method ? Here, am I supposed to rehash the old password stored in the database or should I ask the user to enter a new 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.