justsomeguy

Moderator
  • Content count

    29,689
  • Joined

  • Last visited

  • Days Won

    331

Everything posted by justsomeguy

  1. Then it's the same answer. Find out what else is using port 80 on your computer. Or, change xampp to use a different port.
  2. There's no problem with passing values to the onclick function, although the variables need to be in the correct scope. Another way to do it is to put everything in data attributes on the button, and then pass the entire button to the function where you can access its attributes and values. e.g.: <button data-id="some id" data-value2="some other value" onclick='myModal(this)'>Show modal</button>
  3. The forum decided that it wanted that to be a 2-part post for whatever reason.
  4. That code is a little easier to read when it's object-oriented, but if you're using a tutorial that doesn't teach prepared statements then ignore it and find one that does. As far as storing passwords in your database, PHP has several built-in functions that you can use to also do that the right way: http://jeremykendall.net/2014/01/04/php-password-hashing-a-dead-simple-implementation/ Other than that, just start at the beginning. The first thing you need is a way to add users, so create a page to add a new user and save them in the database. Later you can come back to that page and add permission checking so that only an administrator can add a new user, for example, but just start there and then do the login page where the users can log in, and just go from there.
  5. In general, start with prepared statements when you're using the database. It's the right way to do it, there's no reason to learn the wrong way and have to unlearn and relearn that stuff. This is wrong: $result = mysqli_query("SELECT * FROM users WHERE username='$username'"); Variables never go inside a query string. Instead you prepare the statement first, then pass the data to it. $stmt = mysqli_prepare("SELECT * FROM users WHERE username=?"); mysqli_stmt_bind_param($stmt, 's', $username); mysqli_stmt_execute($stmt);
  6. It's fine if you want to use a text file as your data store, although if you're going to do any searching or filtering on that data then you're wrong about a database being slower. Text files can also have consistency issues if you need to save new data back to the text file, because you could get into a condition where two people are using the site at exactly the same time and one person saves their data right before the second person saves their data, and the second person's data doesn't include the first person's data. You end up with only the second changes saved and you've lost the first changes. It's fairly rare for that to happen because it requires very specific timing, but it's a possibility when you're reading and writing to files. As far as passing data to another page, with HTML in general you can either pass data through a post form or through the URL, or you can use a cookie. With PHP you can also use the session for storing data, but in order for that to happen you need to send the data to PHP through a form submission or ajax request or through the URL.
  7. The WHERE clause probably doesn't match any rows. Or maybe there's a database error that you're not checking for, I can't tell with just those 2 lines. You should use prepared statements for that though, mysqli supports them and you should use a prepared statement any time you need to put any data in a query.
  8. Of course you can do it, it just takes practice and study.
  9. If it's the same error then you need to figure out what else is using port 80. Do you have another web server installed?
  10. If you want to use a database as the data store then that's one route to take, but if the data is static then you could get away with a CSV file or something. You wouldn't even necessarily need to use a server-side language like PHP to build the table (although you could), you could just send an ajax request in Javascript to get the CSV file and parse it in Javascript and go through it to build the table dynamically. Once the table is built and on the page then you'll probably just want to use a jQuery plugin or something for sorting and filtering.
  11. You might need to configure Apache to use ports other than 80 and 443, if you have Skype installed for example it will use port 80. Or, you can disable Skype.
  12. You're welcome to contact the people who pay the bills if you'd like to ask why they decided to upgrade the software. Personally, now that we have a working admin control panel I tend to think it was a good move.
  13. It was an upgrade, unless someone decided to hack into the server and upgrade the software. That would be a rather strange goal for a hack I would think though. I don't see a version number readily available but it looks like it was a major version upgrade.
  14. Hopefully you don't just put an OR between those 2 queries and try to run that as one query, that won't work. I'm not sure what you're going for though, but you can verify what you're telling it to search through by just printing that out: SELECT REPLACE(searchfield, '\', '') FROM field You can verify that what you're telling it to search in is what you expect that to be. That's going to be a very slow query with a lot of data though, which is one of the reasons why it's not a good idea to try and store multiple values in one field.
  15. The admin control panel has a long list of things that it looks like it needs to rebuild, and it's almost 2/3 done with the first one. I don't know if that will impact the friends system or not.