Jump to content

PFMaBiSmAd

Staff Alumni
  • Posts

    16,734
  • Joined

  • Last visited

  • Days Won

    9

Everything posted by PFMaBiSmAd

  1. Your code does not contain any method of causing the result produced on one page request to be available on another page request so you will get a different result on every page refresh. Can you list the procedure or post the code showing how you are determining this problem is occurring? Your code also has some logic error concerning incorrect indexing in the following line, because it throws hundreds of error messages when the code executes (might be relevant to your problem because $squareChosen is used as an index for $grid to set the values) - $squareChosen = $freeBlockSquares[$rSquare];
  2. What does the code in the first post in this thread have to do with this problem? It is not present in any of the other code you have posted. Given the line number mentioned in the error message, that is not all of the code that is relevant to this problem and the problem might in fact not have anything to do with the code posted in reply #2. About the only affect the code in reply #2 (and the minor change in the code in reply #3 would have no appreciable impact on this problem) would have on total memory usage is if the result resource is referenced later in the code so that the built-in resource garbage collector is not freeing up the memory used by that code. You can add a mysql_free_result after that code to see if it helps. You are having a memory usage problem on your page. Either your code just naturally requires that amount of memory or your code is not efficiently using memory or freeing up memory after it is no longer needed. It would take seeing the code on your page to determine which of these things are the cause of the problem. Through I'm not sure anyone wants to see 900+ lines of code that is already using 15mb of memory and just attempted to allocate 6mb more...
  3. What does using var_dump() on the 212'th element of $stopWords show for the value?
  4. If you form the query in a variable first, so you can echo it to see exactly what it is, you will probably find that $bookKey is empty.
  5. Key is a reserved mysql keyword. Change it to something else or enclose it in back-ticks.
  6. Start by using HTML arrays - http://us2.php.net/manual/en/faq.html.php#faq.html.arrays
  7. After changing httpd.conf, did you stop and start the web server to get the change to take effect?
  8. Your first occurrence of //bunch of stuff goes here for pagination is probably fetching a row from the result set. It will take seeing your actual code to directly help you with the problem.
  9. There's approximately 10 different values present in the code. It would certainly help if you narrowed down the problem by telling us which one exhibits the problem. We are not standing right next to you.
  10. If you can use echo the_ID(); and it works, then you can assign that to a variable and use that variable. If that variable then does not have the expected value in it, your code has done something to that variable between the point where it was assigned a value and where you are using it. You will need to post your actual code if you want help with why it is not working.
  11. Echoing a FALSE value generally does not echo anything. You can try var_dump($id); to determine exactly what is in the variable.
  12. The following is the equivalent logic with a few things cleaned up (tested) - <?php $errorMsg = ''; // define empty error message if(!empty($_POST['accountUser']) && !empty($_POST['accountPassword'])){ include("dbase.php"); include("settings.php"); if ($_POST['accountType']=="member"){ $database="chatusers"; } else if ($_POST['accountType']=="model"){ $database="chatmodels"; } else if ($_POST['accountType']=="studioop"){ $database="chatoperators"; } $_POST['accountUser'] = mysql_real_escape_string($_POST['accountUser']); $query = "SELECT id,status FROM $database WHERE status NOT IN ('pending','rejected') AND user = '{$_POST['accountUser']}' AND password = MD5('{$_POST['accountPassword']}')"; $result = mysql_query($query); if($result){ if(mysql_num_rows($result)){ // query matched a row, username/password exists $row = mysql_fetch_assoc($result); if ($row["status"]=="blocked"){ $errorMsg="Account is blocked, please contact the administrator for more details"; } else { // exists and is not blocked mysql_query("UPDATE $database SET lastLogIn=UNIX_TIMESTAMP() WHERE id = {$row['id']}"); setcookie("usertype", $database, time()+3600); setcookie("id", $row['id'], time()+3600); header("Location: cp/$database/"); exit; } } else { // no matching row (usename and/or password does not match) $errorMsg="Wrong Username or password"; } } else { // the query failed to execuite due to an error - do error reporting/logging here - trigger_error(mysql_error()); } } else if (isset($_GET['from']) && $_GET['from']=="recoverpass"){ $errorMsg="Your new password has been sent to your mail"; } else { $errorMsg="Please complete username and password fields"; } include("_main.header.php"); ?> <table width="720" height="200" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td align="center" valign="middle"><form action="" method="post" name="form1"> <p> </p> <table width="720" border="0" align="center"> <tr> <td colspan="2"><p align="left"> <span class="error"><?php if ( isset($errorMsg) && $errorMsg!=""){ echo $errorMsg; } ?></span> <br> <br> </p></td> </tr> <tr> <td width="210" align="right" valign="top" class="form_definitions"><div align="right">Username:</div></td> <td align="left" valign="top"><input name="accountUser" type="text" id="accountUser" size="24" maxlength="24"></td> </tr> <tr> <td align="right" valign="top" class="form_definitions"><div align="right">Password:</div></td> <td align="left" valign="top"><input name="accountPassword" type="password" id="accountPassword2" size="24" maxlength="24"></td> </tr> <tr> <td align="right" valign="top" class="form_definitions"><div align="right">Account type:</div></td> <td align="left" valign="top"> <select name="accountType" id="select"> <option value="member" selected>Member</option> <option value="model">Model</option> <option value="studioop">Studio Operator</option> </select> <div align="left"></div></td> </tr> <tr> <td align="right" valign="top" class="form_definitions"> </td> <td align="left" valign="top"> <input type="submit" name="Submit" value=" Log In to your account"> </form> <div align="left"></div></td> </tr> <tr> <td align="right" valign="top" class="form_definitions"> </td> <td align="left" valign="top"><a href="lostpassword.php" class="left">Lost Password? Press Here!</a></td> </tr> </table> <br> <br> <?php include("_main.footer.php"); ?> Edit: If you determine that your code is executing the setcookie() statements when using IE, you might want to consider the possibility that you have configured IE to reject cookies, but have forgotten that you did this.
  13. You can also greatly simplify your logic if you put all the conditions you are testing into the WHERE clause in the query so that the query only returns row(s) that match the values you have. You then only need to test if a matching row was found. Any time you find yourself looping through the result set of a query, testing values to find a match, you are not using the database efficiently.
  14. If you actually look that the results (and count the characters) you will notice that there is probably a space on the end of the first value that will make the file_exists test fail.
  15. It likely means that when you first installed php you copied the msyql client library files to a different location on your computer instead of leaving them in the default location, then when you upgraded you did not copy the new mysql client library files over the old ones and/or you did not restart the web server to get all updated files to take effect. It would take knowing what method and steps you took when you first installed php and knowing what method and steps you took when you upgraded to provide more specific help.
  16. The whole point of programming is to produce code that efficiently accomplishes a specific task. Without knowing the reason why you don't want to select the three columns is not actually possible to give you the best answer. However, if you have a table with over 100 columns, you likely have a bad table design and need to normalize the data first before you worry about the affect of not selecting just three of them or how you would ignore those three when you process the results in your presentation code.
  17. After commenting out everything I don't have that your code needs to run (includes, database statements...), the cookies are set in IE8. You have not stated what it actually does do when it 'does not work'? A blank screen? The form is just redisplayed? It redirects to cp/$database/ (which by the way is not the URL of a .php page unless you are doing some url rewriting or have default documents set up.) Best guess is there is there is something in the various include files that are preventing the form in the posted code from being valid and submitting data. What have you done to determine what execution path the code IS taking and what values are in the variables and what data is being retrieved from the database and is being used in the comparisons?
  18. You can force it into a DATE format by applying almost any function that returns a DATE value (tested for a date like 2008-1-9) - ORDER BY DATE(CONCAT_WS('-',year,month,day))
  19. It depends on exactly what format is in month and day. The code I posted assumes leading zero's so that the resulting format is yyyy-mm-dd, which is what is necessary to order dates correctly.
  20. Untested, but should work - ORDER BY CONCAT_WS('-',year,month,day)
  21. This - enctype="application/x-www-form-urlencoded" is an invalid enctype to list for a form (Edit: because it is the default.) Remove it to get your form to work in all browsers. Your issue is not that the cookie is not working, it is that your form is not submitting any data and you are skipping over all the form processing code.
  22. The session cookie lifetime determines how long the session id cookie will remain valid after all instances of the browser is closed. A zero value (the default setting) means "until the browser is closed". A non-zero value means that the session id cookie expiration time will be set to that number of seconds added to the current server's time. A session will exist as long as the browser supplies a valid session id and the corresponding session data file exists on the server. To extend a session, you would either need to periodically 'refresh' the last access time of the session data file (by executing a session_start() statement) to prevent session garbage collection from deleting the session data file or you would need to extend the session.gc_maxlifetime value. On a shared web server where you are using the default/common tmp session.save_path setting, the shortest session.gc_maxlifetime setting of all the scripts running on the server will win. So, you also need to set the session.save_path to be to a 'private' folder within your account's folder tree if you want you session settings to apply only to your session data files. All values affecting the session id cookie or the session data files must be set before every session_start() statement. It is usually best to globally set them in the master php.ini (when you have access to it), in a .htaccess file (when php is running as a Apache Module), or in a local php.ini (when php is running as a CGI application.)
  23. Your code is using two different result sets $amount and $result. I'll guess one is all the posts and one is just those matching a specific thread.
  24. Are you really sure they don't allow include/require? The above quote came directly from yahoo's information - http://help.yahoo.com/l/us/yahoo/smallbusiness/webhosting/php/php-37.html
  25. That would indicate that the session variable is NOT set and that you would need to troubleshoot the code that is supposed to be setting it.
×
×
  • 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.