Jump to content

PFMaBiSmAd

Staff Alumni
  • Posts

    16,734
  • Joined

  • Last visited

  • Days Won

    9

Everything posted by PFMaBiSmAd

  1. What exactly do you get as output that tells you this? Is that all the code on the page? Because, without a connection to your database, the code cannot work. Where is $cid being set? Have any mysql_ functions successfully worked on your server in the past or is this the first time you have attempted to run any code using mysql_ functions? There are also a couple of issues with the code - 1) You should not supply the table name from external data as that will allow a hacker to UPDATE any table he wants. It is also not possible to prevent sql injection where $table is being used in the query by using mysql_real_escape_string() so you must validate that $table only contains specific values that are allowed. 2) mysql_db_query() was depreciated long ago, throws a depreciated error in php5.3, and has been completely removed in php6. You should use mysql_select_db and mysql_query
  2. That's not something you could do with a session. All the person would need to do is drop the session id and get a new session and they could vote again. To do what you state would require that you remember the last time they voted using a database of some kind (mysql, flat-file...)
  3. Only if you are skilled enough to make a wheel at all. If not, then your wheel will end up worse, not better, than all the wheels that have been built before. Too many people jump into programming and attempt to make a whole multi-thousand line application (a whole wheel) as their first project, when in fact they don't have the knowledge to even define and identify what the wheel that they are trying to build looks like or what shape it should be. You have to first learn how to build the individual parts that go into making an entire programming application before you can build a whole wheel.
  4. SELECT `qid`, COUNT(*) AS 'Last24Hours' FROM `lost_records` WHERE `time` BETWEEN '1257721753' AND '1257808153' GROUP BY `qid` HAVING Last24Hours = (SELECT COUNT(*) FROM `lost_records` WHERE `time` BETWEEN '1257721753' AND '1257808153' GROUP BY `qid` ORDER BY COUNT(*) DESC LIMIT 1)
  5. The target of your login form is action="user_home.php" It goes to user_home.php directly without passing through the login code that checks the user/password that is in login.php.
  6. You are creating a mysqli connection but using mysql_ functions. You cannot mix the connection/function types between mysqli and non-mysqli
  7. See example #3 at the following link for how you would process multiple uploaded files - http://us3.php.net/manual/en/features.file-upload.post-method.php
  8. If the function you are expecting to call is a php function, please be advised that browsers can only make HTTP/HTTPS requests for web pages, they have no way of 'calling' a php function directly. You must put php code on your web page to test the values that the browser submits and take appropriate action in the code.
  9. Is $_POST[adimg] even set? The first step in troubleshooting any piece of code is to determine if it is receiving the expected data. The form code you have posted anywhere in this thread does not have a field that would set $_POST[adimg]. To see exactly what your code is receiving, use the following - echo "<pre>"; echo "POST:"; print_r($_POST); echo "FILES:"; print_r($_FILES); echo "</pre>"; Edit: And I have to ask, are you developing and debugging php code on a system with error_reporting set to E_ALL and display_errors set to ON in your master php.ini to get php to help you by displaying all the errors that it detects? You will save a ton of time. Stop and start your web server to get any changes made to php.ini to take effect and confirm that the settings are actually changed using a phpinfo() statement in case the php.ini that you are changing is not the one that php is using.
  10. We would need to see your code in order to help you with what it is doing or not doing.
  11. The name="..." of your form field no longer matches the name being used in the php code, hence the Undefined index: uploadedfile message. The form is not setting uploadedfile. You need to match the names where data is produced and where it is used.
  12. And since the error message states where the output is occurring at that is preventing the setcookie/header from working, it would take seeing at least the part of the error message that states where that output was started at (i.e. (output started at ....\page2.php:x) where x is the line number) for any one to be able to specifically help you with the problem in your code.
  13. Or name the file .php (there is nothing magic about .js for an extension name.)
  14. Not until you tell us what symptoms or errors you get. There are at least a dozen different things that could prevent the code you posted from working on your server and with the input you supplied it and unless you state what it does when you try it, no one can tell you which of the possible things is preventing it from working. BTW - The code worked for me. The selected file was uploaded and the INSERT query was formed the way the code intends. Edit: And I have to ask, are you developing and debugging php code on a system with error_reporting set to E_ALL and display_errors set to ON in your master php.ini to get php to help you by displaying all the errors that it detects? You will save a ton of time. Stop and start your web server to get any changes made to php.ini to take effect and confirm that the settings are actually changed using a phpinfo() statement in case the php.ini that you are changing is not the one that php is using.
  15. Is the \ present in the file when you open it directly using a programming editor? If the \ is in the file, the problem is because of magic_quotes_gpc being on (the \ was added when the form was submitted.) If the \ is not in the file, the problem is because of magic_quotes_runtime being on (the \ was added when the file was read.) In either case, the best solution is to turn off all the magic_quotes_xxxxx settings if you can (they have been completely removed in php6 due to the problems they cause.) magic_quotes_gpc can only be turned off in the master php.ini. magic_quotes_runtime can be turned off any way you want (from the master php.ini all the way down to a command in your script.) If the issue is due to magic_quotes_gpc and you don't have the ability to turn the setting off, you will need to test if it is on in your code (see get_magic_quotes_gpc) and use stripslashes on the data if the setting is on in order to remove the \.
  16. You already have an existing thread where someone posted a link to the php.net manual that shows how you access the uploaded file information for multiple uploads - http://www.phpfreaks.com/forums/index.php/topic,276300.0.html
  17. Huh? Just opening and saving the file using a text/programming editor could have caused the line-endings to be changed from what they were originally.
  18. The problem is the line ending. The file has \r\n, so LINES TERMINATED BY should be '\r\n'
  19. That error generally only occurs when you try to use the instance of the class as though it was a string, such as - echo $news[$i]; Are you sure about the line where the error is occurring? Any chance that $i is an instance of a class? Your posted code does not produce any php error under php5.2.11 (I don't have php5.2.9 to test with.)
  20. You cannot do greater-than/less-than comparisons on dates unless the format can be compared by magnitude. This either requires using a Unix timestamp or the fields making up the date must be ordered left-right Year - month - day and the length of the corresponding field in each value is the same (you need leading zeros.)
  21. Probably. Is there some reason you are using odbc_result_all() more than once on the same result set?
  22. Your code inside of the while() loop is reusing the $result variable, so the next time the while() condition is evaluated, you have a TRUE/FALSE value instead of the original result resource. Please be careful when reusing variables.
  23. For debugging, add the following two lines of code immediately after your first opening <?php tag - ini_set("display_errors", "1"); error_reporting(E_ALL);
  24. That's clearly not all your code that is producing the posted output. Best guess is that you are adding up the value returned by odbc_result_all()
  25. You need to identify what unique condition is present in the row(s) that are not being inserted.
×
×
  • 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.