Jump to content

benanamen

Members
  • Posts

    2,134
  • Joined

  • Last visited

  • Days Won

    42

Everything posted by benanamen

  1. DO NOT SET THE PASSWORD IN A SESSION NEVER EVER EVER! It would also appear that you are storing plaintext passwords. VERY VERY BAD! You are also not even setting anything at all to those sessions anyways. On top of that you keep changing the username/password names. You have FOUR variations. If you had error reporting turned on like you should, you would be getting errors. It seems you are hacking away at this one piece at a time. You would do well to study a few PDO login/reg systems to see how things are being done. You are not even close to doing this right.
  2. Also Use of session_register() is deprecated, use $_SESSION DEPRECATED as of PHP 5.3.0 and REMOVED as of PHP 5.4.0.
  3. You didnt use session_start at the top of your code. And all this: $username = $_POST['user']; $password = $_POST['pass']; $username = stripslashes($username); $password = stripslashes($password); Could simply be: $username = stripslashes( $_POST['user']); $password = stripslashes($_POST['pass']); Dont create variables for no reason.
  4. After all this dont you think you should tell us what was wrong?
  5. I know a record id is needed. What I am saying is you don't need to create an extra variable unless you are transforming it somehow. If $_POST is true, your form has been submitted so no need to see if submit isset. Less code, much cleaner and does the same exact thing. Yes, but no. You dont want to display the system error messages to the user. The way I handle errors is display some generic message to the user, log the error to my error log and have the system email me the details as soon as there is an error. I have an option to turn debugging on in which case it will display the full errors in the app during development. If you use set_exception_handler you don't have to keep writing try/catch blocks all over.
  6. Most likely {$row['id']} Whatever your ID column is named. echo "<tr><td><a href=\"kf_orders_entered_detail.php?id={$row['id']}\">{$row['ompCreatedBy']}</td>";
  7. FYI: This is completely unnecessary. Don't create extra code that does nothing. $record_id = $_GET['record_id']; You dont need all this either: if(isset($_POST['submit']) Just use: if ($_POST) Also, all the following is unnecessary. Just put your query in a try/catch block. If the query fails you will catch the error. For a global solution to catching errors you can use set_exception_handler. What you have below will not tell you anything about the error should you have one. if($insertStmt == true) { echo 'success'; } else { echo 'false'; }
  8. if ($_POST) { $insertStmt = $db->prepare("INSERT INTO datatable (record_id, field1, field2) VALUES (?,?,?)"); for ($i = 0; $i < count($_POST['field1']); $i++) { $insertStmt->execute(array( $_POST['record_id'], $_POST['field1'][$i], $_POST['field2'][$i] )); } }
  9. if ($_POST) { $insertStmt = $db->prepare("INSERT INTO datatable (field1, field2) VALUES (?,?)"); for ($i = 0; $i < count($_POST['field1']); $i++) { $insertStmt->execute(array( $_POST['field1'][$i], $_POST['field2'][$i] )); } }
  10. I am not having any problems. first you load into zodiacyears, then zodiac but are selecting from zodiac1 You are all over the place with tables. Delete all but ONE table, empty it and load fresh Then use a mysql gui like phpmyadmin and look at your table as soon as you do the import and make sure the data is getting imported. This is so not a complicated situation.
  11. Is your data separated by tabs or spaces?
  12. There is nothing wrong with the connection code. If the same username, password and DB name works in your other code it should work in this code.
  13. Post your entire connection code. Hide your username and password
  14. Your connecting to the wrong database. replace mysql with YOUR database name $db = new PDO("mysql:host=$hostname;dbname=mysql", $username, $password);
  15. It means the user/password you are connecting to the DB with does not have permission to access. Possible wrong username and/or password.
  16. Whatever your trying to accomplish, your doing it wrong. Something like $temp_errors = array(); if (empty(cust_add1)) { $temp_errors[] ='Address Required'; } Then if (count($tmp_errors)) { echo "<div class='error'>"; foreach($tmp_errors AS $error) { echo "$error<br>"; } echo '</div>'; }
  17. 3. A lot of it is simply using the right tool for the job which means understanding the strengths and weaknesses of each language. You can pound nails with screw driver but a hammer is the best tool for the job.
  18. The IN operator allows you to specify multiple values in a WHERE clause. SQL IN Syntax SELECT column_name(s) FROM table_name WHERE column_name IN (value1,value2,...); ExampleSELECT * FROM Customers WHERE City IN ('Paris','London');
  19. I will leave the logic part to someone else to answer. But for my contribution... Your code is vulnerable to SQL Injection. You NEVER EVER send user supplied data directly to the database. You are also using deprecated code that will not work at all in the latest version of Php. You need to use PDO with prepared statements.
  20. You have several issues. First, you are using deprecated code. You need to use PDO with prepared statements. Next, you are setting post variables outside of your isset post check so you have errors there. If you turned on error reporting you would see that as well as any other errors You are also mixing mysql with mysqli. You cant do that. Your code is also vulnerable to SQL Injection. You NEVER EVER send user supplied data directly to the database. You need to rewrite the whole thing. None of your code is any good.
  21. I have to agree with @Jaques1. This: "I'm not a jquery person myself" pretty much disqualifies you to say this: "buggy and unreliable" Jquery is VERY stable.
  22. So that's what you call correct expert advice huh? Your gonna go far as programmer. Since, as you said, the enum is for a dropdown, you are already showing yet another flaw in that you are going to store the actual make names as repeated data in some table as the dropdown choice, yet another wrong programming move, but I know, you just don't care about doing anything right.
  23. @ronc0011, All of what you just said makes absolutely NO DIFFERENCE about using enum. You seem plenty determined to do things wrong so why ask for experts help? It already has but you refuse to accept it. Apparently the company has no idea you don't know what your doing and are not willing to listen to people that know much, much more than you. I sure wouldn't want MY fleet maintained with what you are doing.
  24. For starters, your if(post) and if(submit) is the same exact thing but you have separated them as though they are separate actions. Your $year !="2015" is outside of both of those, so it is undefined. Why do you have $services array? It does absolutely nothing in the code you posted. You also have a random opening label tag. And then, you create all those extra post variables but use the actual POST for the insert which wont work anyways as you have it written. You are also vulnerable to SQL Injection. You NEVER EVER send user supplied data directly to the database. You are also using deprecated code. You need to use PDO with prepared statements. The whole thing is pretty much junk and needs to be re-written from the ground up.
×
×
  • 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.