Jump to content


  • Posts

  • Joined

  • Last visited

  • Days Won


benanamen last won the day on June 5

benanamen had the most liked content!


Contact Methods

  • Website URL
  • Yahoo

Profile Information

  • Gender
    Not Telling
  • Interests
    Email me at phpfreaks@galaxyinternet.us

Recent Profile Visitors

11,417 profile views

benanamen's Achievements

Prolific Member

Prolific Member (5/5)




Community Answers

  1. No. You are building in a race condition by checking availability.
  2. I was just going to point that out. The if should be if ($e->getCode() == 23000) { // Duplicate user } 1062 is held in the errorInfo array
  3. Stop using the @ error suppressor. Do not put variables in your query. Use Prepared Statements. Your code is vulnerable to an XSS Attack. Never trust user supplied data Stop changing the case of your variables. Just always use lowercase You need to kill the script after a header redirect or the code will keep running that follows.
  4. Why are you adding another array to your post variables/form element names?
  5. Small bit of code but several issues with it. Do not create variables for nothing. You already have the POST variables, just use them You need to check the REQUEST METHOD, not the name of a button. This can completely fail in certain cases. Also, in a properly coded form, ALL form elements save for checkboxes will be submitted (true) A blank space will get past your empty check. You need to trim the entire POST array all at once and THEN check for empty Never ever trust user supplied data. The code is vulnerable to an XSS Attack
  6. You are mixing Database Engines. (MyISAM, InnoDB) Just use InnoDB and add foreign keys while you are at it.
  7. Aside from your posted question, STOP prefixing tables with tbl. Just stop it.
  8. OP, before you post again, I highly recommend you read this page. http://www.catb.org/~esr/faqs/smart-questions.html
  9. Is this "Array" coming from a Database? If so, why are you not just querying the DB for the specific data you want?
  10. mail returns true or false, neither of which you check for.
  11. You are over complicating the whole thing. Simply determine the role on the fly instead of storing it.
  12. You pretty much answered your question. Without seeing what you are actually including it is hard to say if what YOU are doing is good or not. Your repeated code may be a good candidate for a function or a class, or an include may be the right solution. Just cant say without seeing what you have. If you are able, put your project on a public GitHub repo so we can review it as a whole. You will get much better and specific answers to what you are doing.
  13. Take one line at a time....see it? $articleTable new DatabaseTable($pdo, 'article', 'id');
  14. Do these lines look right to you? A lot of careless mistakes. Aside from that, this is a very poorly written class. I suspect you didn't write this. $articleTable new DatabaseTable($pdo, 'article', 'id'); $usersTable new DatabaseTable($pdo, 'users', 'id'); $page = Controller->edit(); $controller = new articleController($articlesTable, $usersTable); $page $Controller->delete(); include __DIR__ '/../classes/controllers/registerController.php'; return $page output = $this->loadTemplate($page['template']);
  • 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.