Jump to content

benanamen

Members
  • Content Count

    1,786
  • Joined

  • Last visited

  • Days Won

    32

Everything posted by benanamen

  1. benanamen

    Data is not inserted into db

    Now you tell me! It was an SUV that hit me.
  2. benanamen

    Data is not inserted into db

    Oh my. I have been really off my game lately. I got hit by a car this past November and got a concussion. It has been showing in many of my posts . Thanks @Barand.
  3. benanamen

    Data is not inserted into db

    Ok, I missed it. 😬 The !isset logic is wrong. The $_FILES['userfile'] is always going to be set on POST so that block will never run. You need to check if the userfile name is empty like so... if (empty($_FILES['userfile']['name'])) { Run this with no upload <?php if ($_SERVER['REQUEST_METHOD'] == 'POST') { if (empty($_FILES['userfile']['name'])) { echo 'No File Uploaded'; } if (!isset($_FILES['userfile'])) { echo 'I will never run'; } } ?> <html> <body> <form action="" method="POST" enctype="multipart/form-data"> <input type="file" name="userfile" /> <br> Username: <br> <input type="text" name="username" maxlength="26" placeholder="Username"> <input type="submit"/> </form> </body> </html>
  4. benanamen

    Data is not inserted into db

    By the way, username in the WHERE should not be quoted. I don't used named parameters but that may be the problem.
  5. benanamen

    Data is not inserted into db

    What is the result of var_dump($_FILES); Post your form as well.
  6. benanamen

    Data is not inserted into db

    What would be more helpful is an explanation of what " not working " means.
  7. benanamen

    Data is not inserted into db

    For starters, you have thrown a function right in the middle of where code should be processed. If you moved the function somewhere else you are now faced with a missing closing curly bracket and a call to the function floating in space. Start with NOT having all your code in a function. Saying something "is not working" is not going to help anyone help you. You would do well to read through this page.
  8. That would be the user_id that you should have in the table. This is most commonly an auto-increment column.
  9. benanamen

    PHP Login Form by using PDO connection

    This tutorial should get you on your way with PDO.
  10. The form submitted for me.
  11. benanamen

    Table form input to output to 2nd page table

    Why are you creating a session that you never use?
  12. benanamen

    What is wrong with this line?

    The result is an array. You cant echo an array. Do this.... echo '<pre>', print_r($user, true), '</pre>';
  13. benanamen

    Table form input to output to 2nd page table

    Here is a quickie example. (TMTOWTDI) <?php $array_A = [2, 6, 8, 11, 14, 18, 24]; $array_B = [1, 2, 9, 10, 13, 14, 25, 28]; $array_C = [1, 3, 7, 9, 13, 15, 20, 21, 24]; $array_D = [4, 5, 12, 22, 23, 27, 28, 29]; $input = '2,15,37,13,28'; $parts = explode(',', $input); foreach ($parts as $part) { if (in_array($part, $array_A)) { $group_a[] = $part; } if (in_array($part, $array_B)) { $group_b[] = $part; } if (in_array($part, $array_C)) { $group_c[] = $part; } if (in_array($part, $array_D)) { $group_d[] = $part; } } echo '<pre>', print_r($group_a, true), '</pre>'; echo '<pre>', print_r($group_b, true), '</pre>'; echo '<pre>', print_r($group_c, true), '</pre>'; echo '<pre>', print_r($group_d, true), '</pre>';
  14. benanamen

    Table form input to output to 2nd page table

    I understand what you are asking. What is the purpose of this and where do the four arrays come from?
  15. benanamen

    What is wrong with this line?

    You can always run it and see. It's pretty simple. Look at your query. You are selecting EVERYTHING in the row. You should specify the columns you want instead of SELECT *. Naming it $user would be a bad name since it has more than just the user in the result. How about naming it $result?
  16. benanamen

    What is wrong with this line?

    Allow me to direct you to using PDO. Here is a tutorial to get you going. https://phpdelusions.net/pdo
  17. benanamen

    What is wrong with this line?

    NEVER EVER put variables in your query. Your code is vulnerable to an SQL Injection Attack. Use Prepared Statements.
  18. benanamen

    Query echo works in phpmyadmin, but not php script

    htmlentities is an output function and for HTML output. Why are you using it on your input? What if you need to use the data that is not for HTML Output? Also, you need to use Prepared Statements. Never ever put variables in your query.
  19. benanamen

    Accessing uploaded file data

    You VERY MUCH should be! Anyways, I am sure you have learned things in your quest which is always a good thing and you can't knock a guy for trying. You have to start somewhere. By the way, your response a couple posts back was what I was trying to get at when I was asking what you are really doing instead of how you are trying to do it. It is much better for us to know that as the opener so we can properly respond to you.
  20. benanamen

    Accessing uploaded file data

    The best way to find out if you "missed" anything is to post your code on a repo for peer review. Based on the questions you have been asking I would personally have to question your ability to write a secure encryption algorithm which is no small task, but then you could be a wizard mathematician for all I know. Best thing is to show us the code. EDIT: Nothing personal by the way
  21. Photo? Pictures are for hanging on the wall. Post your code using the code tags (<> on the menu)
  22. benanamen

    Accessing uploaded file data

    Best I can tell is it is some kind of homemade file encrypter.
  23. benanamen

    Accessing uploaded file data

    You still you still haven't told us what your really trying to do. What is the point of all this code?
  24. benanamen

    Accessing uploaded file data

    Tell tell us about the real problem at hand instead of telling us how you're attempting to solve the real problem.
  25. benanamen

    how to select two tables in update query

    You already have the POST variables, just use them. Yes Nothing. Just leave the action= out completely. Because it leaks sensitive info that is only good to hackers and useless to the user. You turn on error reporting in the local dev php.ini and you also log the errors.
×

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.