Jump to content

PFMaBiSmAd

Staff Alumni
  • Posts

    16,734
  • Joined

  • Last visited

  • Days Won

    9

Everything posted by PFMaBiSmAd

  1. It would probably help if you posted the actual error message with the line number it is referring to ("Unknown variable" isn't exactly a one of the php error messages.)
  2. The GD image functions operate on an uncompressed bitmap version of the image (jpg, gif, png use data compression to reduce the file size) and require a relatively large amount of memory. Each of your image resources $im, $newimage, and $thumb should be destroyed, see imagedestroy, immediately after you are finished with each of them in the loop so that the memory taken by them is available for the rest of the code and for the next iteration of the loop.
  3. Since your code is running (no fatal parse errors), add the following two lines of code immediately after the first opening <?php tag on the main page - ini_set("display_errors", "1"); error_reporting(-1); You should probably troubleshoot why your magicquotes_inc.php code is not working (it's probably related to not having a database connection.)
  4. In your previous thread on this, someone mentioned the spaces (they show up as + characters in the submitted URL) in the submitted data values and that you should find and eliminate the cause of them. Your $team_id values have a space in front of each of them and since you are comparing them to the team_id column as as string in the query (surrounded by single-quotes), they don't match the values in your team_id column - WHERE team_id = '$team_id' "; In the value="space..." attributes in your form, you have a space after the initial ", that is adding a space before each value.
  5. You would use str_pad
  6. ^^^ It's likely that your magicquotes_inc.php code is wiping out your $_POST data, so the rest of the logic that is testing for $_POST variables is false and is skipping over the code. Did you ever turn on the error_reporting/display_errors settings as was suggested -
  7. You probably have another form field later in the form using that same name="...." (the last one wins.) What's your entire form?
  8. move_uplaoded_file does what it's name indicates. It moves the uploaded file from the tmp/temp folder to the destination. Because you are reading the tmp/temp file - $_FILES["image_id"]["tmp_name"][$j] to resize it after you have executed the move_uplaoded_file statement, the file no longer exists and you would be getting a message something like the following (along with a few other related messages), if you had php's error reporting and display errors turned on - Warning: getimagesize(tmp\php1C.tmp) [function.getimagesize]: failed to open stream: No such file or directory in ... In your previous thread on this, you were apparently trying to use the destination where you moved the uploaded file to as the source for the resize logic. Why did you change to using the tmp/temp image?
  9. The mysql_select_db statement is probably failing. Is "thrrive2_dbUsers" the actual name of your database? When you put in the ini_set('display_errors', 1); error_reporting(E_ALL); statements, did you put those before the include ("dbConfig.php"); statement so that any php detected errors in the dbConfig.php code would be reported and displayed?
  10. That means the the mysql_insert_id() was a zero (no auto-increment generated by the insert query) or a FALSE (the query failed due to an error or there is no connection to the database server.) Unfortunately, the code has no error checking logic to pin down if the query executed with an error or not before it attempted to check if the INSERT worked. Use the following code to determine what is happening with the query. The first statement (four lines setting the $q query variable) and the last statement ( } // end if ) are your existing code. Everything in between those two statements should be replaced - $q = "INSERT INTO `dbUsers` (`username`,`password`,`email`) " ."VALUES ('".$_POST["username"]."', " ."PASSWORD('".$_POST["password"]."'), " ."'".$_POST["email"]."')"; if(!$r = mysql_query($q)){ // query error, display debugging information - die("Query failed with an error: " . mysql_error()); } else { // query executed without any error // Make sure query inserted user successfully if ( !mysql_insert_id() ) { die("Error: User not added to database."); } else { // Redirect to thank you page. Header("Location: register.php?op=thanks"); exit; } } } // end if
  11. There's nothing in the original that would produce the posted error - Notice: Use of undefined constant r - assumed 'r' in /home1/thrrive2/public_html/fledgepress/register.php on line 52 Without the actual line 52 code, cannot help you.
  12. I would probably be a good idea to post the current register.php code or use the original unmodified version (I tested what you posted, as best as possible without a database, and it should 'work' the way it was.)
  13. You are including the code using a URL. That doesn't include the php code into the main page, it includes the OUTPUT from the php code, the same as if you browsed to that file being included. You need to use a file system path to include php code so that it becomes part of the main page. Edit: Also by using a URL, each include statement takes about 200+ ms. Using a file system path will only take about 10-20ms at the most.
  14. It would probably be a good idea if you posted ALL the code on the page or you need to make a page that just consists of the code that you posted at the start of this thread. Edit: Also tell us which browser you are using because the page you posted a link to and the form code you posted here contain a far number of HTML markup errors that could prevent the form from being seen as a form by the browser.
  15. Put the suggested code starting right after the line with the <?php tag.
  16. The only way the posted form processing code will redisplay the form is if the GET parameter on the end of the URL is not seen by the php code. Are you doing an URL rewriting that might be not be carrying the the GET parameters on the end of the URL? What do you get after the form has been submitted from the following code - echo "<pre>"; echo "GET:"; print_r($_GET); echo "POST:"; print_r($_POST); echo "</pre>";
  17. You also need to correct your usage of the two different database connections. Besides consuming two available connections in each invocation of your script, you are leaving yourself open to sql injection because the character encoding might be different between the mysql and the mysqli connection and your usage of mysql_real_escape_string (on the mysql connection) might permit sql to be injected on the query being performed over the mysqli connection.
  18. Without all the relevant code (you didn't post the form processing code, where the problem is most likely at), no one here can really help you with what your code is doing. What have you done to troubleshoot and find what execution path your code is taking? For all we know, you don't have a database entry with the admin's information in it.
  19. I have serious doubts that your code really works on your local system, because you are using both mysql and mysqli functions within the code performing each query. For your code to work correctly, that would imply that you have both a mysql and mysqli connection. Are you developing and debugging your code on a system (both your local development system and the live server) with error_reporting set to E_ALL and display_errors set to ON so that php would report and display all the errors it finds?
  20. There should be no single-quotes around the EOF
  21. file_exists uses stat to get the file information. http/https doesn't support stat.
  22. Your $filename isn't a filename, it's a URL. You cannot use a http URL in the file_exists function. You must use a file system path as an argument to the file_exists function. Is this image located on your server or some other server?
  23. The uploaded file information will be available in the $_FILES array, not the $_POST array. I recommend that you read the file upload handling section of the php documentation - http://us2.php.net/manual/en/features.file-upload.php
  24. Taken out of context, just the code you posted produces the following error - Parse error: syntax error, unexpected '%' in your_file.php on line 13 That's pretty specific to what is wrong in that block of code (the problem on line 12 in what you posted is on line 13 in the error message because of a <?php tag on line one.) If you are getting other syntax errors, it's likely your actual code that contains the posted code, also contains other syntax errors. The language parser doesn't know what you (the programmer writing the code) intends. When you leave out some syntax or use the wrong syntax, the parser doesn't know what you were trying to do at that point. What you typed 'could' have been valid, depending on what else you did or didn't do in the following code. For the specific example you posted, maybe you were trying to start another if() test with a % mod operator in it, but left off or cut off the leading part of the line. How could the parser possibly know what you left out or typed incorrectly? So yes, a lot of reported syntax errors cannot be more specific than "something was wrong before this point in the code." It's up to you (the programmer) to proofread through your code, prior to where the error is reported, to make sure you typed what you intended. My advice, don't write huge blocks of code all at once, then try to see if the whole thing works. Write code in smaller blocks, testing your code as you create each block or section. Use an incremental approach, rather than an all at once approach.
  25. You would 'remember' what the last value was using a variable ($last_type) and when you detect a change in the value, close any previous section and start a new section - <?php $sql = "SELECT * FROM items ORDER BY clothingtype"; // get the data you want in the order that you want it $result = mysql_query($sql) or die ("Couldn't get results."); $num = mysql_num_rows($result); $last_type = NULL; // initialize to a value that will never exists as data while($row = mysql_fetch_assoc($result)){ // detect if there is a change in the type if($last_type != $row['clothingtype']){ // detect if not the first section if($last_type != NULL){ // this is not the first section, code to close out the previous section goes here... } // code to start a new section goes here... $last_type = $row['clothingtype']; // remember the new type } // code to output the data within the section goes here... } // detectif there were any sections at all and close out the last one if needed if($last_type != NULL){ // code to close out the last section goes here... } ?>
×
×
  • 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.