Jump to content


  • Posts

  • Joined

  • Last visited

  • Days Won


cyberRobot last won the day on October 22 2020

cyberRobot had the most liked content!

1 Follower

About cyberRobot

Contact Methods

  • Website URL

Profile Information

  • Gender
    Not Telling

Recent Profile Visitors

87,148 profile views

cyberRobot's Achievements

Prolific Member

Prolific Member (5/5)




Community Answers

  1. You could use a loop. For example, $mcptitles = array("Volvo", "BMW", "Toyota"); foreach($mcptitles as $mcptitle) { //your existing code here... } Note that I changed the name of variable that holds the array. That way it should hopefully work with your existing code. Also note that I didn't review your code since it sounds like it's working.
  2. I'm not sure why the first URL isn't working. I built a quick test script and that address worked fine for me. I even tried adding the call real_escape_string(), which I thought might be modifying the URL, but everything worked fine. The second "www.google.com" address didn't work for me. However, it worked fine once I added the protocol: https://www.google.com Side note: real_escape_string() is only designed to escape input for use in database queries. If you're looking to escape text for outputting to the screen, you'll want to look into htmlspecialchars() and htmlentities().
  3. When clicking one of the links, does the URL show the correct ID? If so, then the provided code is working fine. As Barand mentioned, we would need to see the code that processes the clicked ID to display the page. Hiding the ID from the URL will prevent people from doing things like bookmarking (or linking) to the pages being generated by the script. So I wouldn't recommend going this route.
  4. Either way works. Once the exit language construct executes, the script stops. It won't do anything with that next if construct when the "user" SESSION variable isn't set. So using else, in this case, is unnecessary. More information about how exit works can be found here: https://www.php.net/manual/en/function.exit.php With that said, if using "else" makes more sense to you...you might consider "elseif" if(!isset($_SESSION['user'])) { exit; } elseif($_SESSION['user'] !== 'SiteOwner') { exit; } And when you get to the stage of blocking multiple user types, you could potentially do something like this: if(!isset($_SESSION['user'])) { exit; } elseif(in_array($_SESSION['user'], array('SiteOwner', 'SiteAdmin'))) { exit; } Note that the above code is untested.
  5. Have you reviewed the information provided by Facebook here: https://developers.facebook.com/docs/sharing/webmasters/ Note that it looks like they have a debugging tool that you can use, under the Testing Your Markup section.
  6. It depends. What are you looking to accomplish? Do you have any experience with HTML? What method of learning works best for you? There are many books that might help, if you're just getting starting. Or I'm sure there are a number of in-depth tutorials online, if you learn better that way. For what it's worth, I regularly use the HTML help docs found on the following Mozilla website: https://developer.mozilla.org/en-US/docs/Web/HTML They do have a few different guides that could get you started here: https://developer.mozilla.org/en-US/docs/Learn/HTML/Introduction_to_HTML
  7. Based on the code provided, $user is only being set if the SESSION variable for "username" is set. If you haven't already, I would check to see what that SESSION variable contains when you're getting the error. It's difficult to tell how you should proceed with the information provided. In the end, you'll likely need to test whether $user is set before trying to use it. How you do that depends on the purpose of the page and how your script is set up.
  8. Those are just sample category names. Yours should be +----+--------------+-----------------+ | id | topic_title | topic_parent_id | +----+--------------+-----------------+ | 1 | Authors | 0 | | 2 | General | 0 | | 3 | People | 0 | | 4 | Celebrities | 3 | | 5 | Historical | 3 | +----+--------------+-----------------+ ...etc.
  9. All you should need is the id, topic_title, and topic_parent_id. Where Barand uses "service", you would use "topic_title". Where Barand uses "parent", you would use "topic_parent_id".
  10. As Barand mentioned, the code (as posted) is technically fine. Just be aware that the missing semi-colon after the line that outputs "Green" may cause errors if you add more code to the PHP block after the final echo statement.
  11. No problem. Glad you got everything figured out!
  12. Does the query return an error? If so, what's the error? Or does the page display "New record has been added successfully !"?
  13. When naming the quantity fields, I would use the row ID from the database as the key that goes between the square brackets. If your "Cherry" product's ID is 5, for example, the input tag for the quantity field in the HTML code would look like this: <input type='number' min='0' max='10' name='quantity[5]' ... That way you don't need to pass the product names and prices with the form submission. And you don't need to worry about the customer trying to change a price on you in the form. Note that the "readonly" flag is very easy to bypass for someone who's familiar with the Console feature built into all the major browsers. After the form is submitted, the ID from the "quantity" array can be used to pull the necessary information from the database. The ID will also make it easier to redisplay the form, because you can access the necessary quantity value with the ID (e.g. $_POST['quantity'][5]). Side note: In case you're not aware, you'll want to use caution with using variables like in the following line: <input type='text' min='0' max='10' name='productName[]' value='$productname' ... Have you tried adding a product name that contains an apostrophe? It's going to cause problems with the form. The problem is potentially worse when that variable contains a value that can be tampered with by the user. See XSS attacks for more information. If you haven't done so already, you'll want to look into escaping variables for output. https://www.php.net/manual/en/function.htmlspecialchars.php
  • 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.