Jump to content

batwimp

Members
  • Posts

    319
  • Joined

  • Last visited

Everything posted by batwimp

  1. Header redirects won't work after you echo something out to the screen (see the sticky at the top of this forum about headers). It doesn't do you any good anyway to redirect right after you echo something out to the screen, because the screen will clear and reload the new location before the user can read it (but it won't work because of the header thing). You need to remove that echo.
  2. It's because you are immediately re-directing after the echo. Just for debugging purposes, kill the script right after the echo: echo "<br />Count: ".$count."<br />"; exit;
  3. xyph, could it be a register_globals thing?
  4. Can you post a screen capture of your form?
  5. Try using move_uploaded_file() instead of copy() http://us.php.net/manual/en/function.move-uploaded-file.php
  6. It looks like it. Do you have a text editor that shows you where your brackets mate up? Though I closed the blocks and it still gave me the error, so, hmmm....
  7. Looks like you forgot to close your while() and your switch() blocks.
  8. You obviously didn't post all of your code, but you are probably missing a ; or } somewhere.
  9. What kind of problem is it? Is the table not displaying correctly? Is it showing any data from the variables at all? What do you remember about the error? Can you just re-load the page and get the error back?
  10. If you're going to stripslashes from them, you need to do it after you assign the POST variables to them: if(isset($_POST['username'])){ $username= $_POST['username'] ; } if(isset($_POST['password'])){ $password= $_POST['password'] ; } $username = stripslashes($username); $password = stripslashes($password);
  11. You should put it right after it's initialized: $count=odbc_num_rows($rs); echo "<br />Count: ".$count."<br />";
  12. Where is your images directory in relation to your php file?
  13. Create a new directory and copy 20 or so files into there. Change the path in your code, and run it against a directory that doesn't have 100,000 files in it.
  14. Oh, I forgot to tell you, I also changed the $path variable to suite my needs for testing. You will need to change that back to what you had.
  15. Let us know what kind of problems you are having. The code works fine on my machine.
  16. You need to have <tr> and </tr> INSIDE your while loop. Also, Is one of those brackets } without a mate?
  17. You've got a couple of problems with your code. First, you want to check and make sure $system[1] is actually set (in case you get a file in your directory that doesn't have an extension, or it runs across a directory). Second, you want to take the time test out of the while statement and check for it on its own. This bit of code is just confusing the system. Third, you don't want to check $system[1] for the file extension, because some files may have multiple periods in them, i.e. cat.home.jpg. Use array_pop instead to get the last index of the array, which should contain the extension. Here is your code after I included all of the above changes: <?php $path = '.'; function directory($dir,$filters) { $handle=opendir($dir); $files=array(); if ($filters == "all"){while(($file = readdir($handle))!==false){$files[] = $file;}} // 'all' filter is if you set to list ALL files and folders. if ($filters != "all") { $filters=explode(",",$filters); while (($file = readdir($handle))!==false) { if(filemtime($file) >= strtotime('2010-04-12')){ for ($f=0; $f < sizeof($filters); $f++): $system=explode(".",$file); if(isset($system[1])){ if (array_pop($system) == $filters[$f]){$files[] = $file;} } endfor; } // end if(filetime...) } // end while($file...) } closedir($handle); return $files; } $files = directory($path, "jpg"); //for multiple file types just separate the file extensions by commas foreach ($files as $value) { echo $value.'<br>'; } ?>
  18. echo $count; should work fine. It could be getting lost on the rest of your page, so consider adding a line brake before and after, plus a label: echo "<br />Count: ".$count."<br />"; so it stands out a little better. It will be blank if there is nothing in the variable. If so, that could also be part of your problem. stripslashes() is usually used when getting data out of the databases after addslashes() has been used to escape out quotes or other characters. If your goal is to sanitize your database input, consider using something like mysql_real_escape_string(), which is just used for mysql. I don't know what you would use to sanitize Access database inputs. Maybe one of the gurus can chime in and tell you. Muddy_Funster has a good point. I know you can't just walk away from this teacher, but realize that an Access database with PHP is a horrible idea. In the future, if you plan on doing more PHP programming, you really should use MySQL, as it is the standard for use with PHP, and you can get a LOT more help in forums like these.
  19. You could just create a third table and do a one-to-many or many-to-many relationship between them. Something like: playergameID (int) player_id (int) game_id (int) confirmed (tinyint) anyotherdata (varchar, etc.) Are you familiar with relational databases?
  20. if(isset($_POST['password'])){ $TABLE= $_POST['password'] ; } Did you mean: if(isset($_POST['password'])){ $password= $_POST['password'] ; } and then you're nulling them both out before checking them? $username = null ; $password = null ; Also, this is in the PHP manual: You may want to echo out your $count variable to see if it is -1. You should delete the lines where you null out your $username and $password variables, or at least set them to empty strings (''), but BEFORE you assign the POST variables to them.
  21. You're right. Sorry, I didn't copy and paste the entire block. I'll keep looking.
  22. (isset($_POST['Login'])) { doesn't have a closing bracket. You need to close it somewhere. I assumed you wanted to either set a variable there, or wrap the other POST checks inside those brackets. Either way, you need to close it. This could be causing your problems down the line. Fix this, then see if it works. If not, post here what happened, as well as your updated code.
  23. A couple of things: You have a dangling IF statement, sitting there all by its lonesome. What's up with that? Secondly, MySQL is preferred over a MS Access database when using PHP. I don't know if you know much about MYSQL, but it is well worth looking into. and C: if you want to pass the failed username/password info to the next page, include the message in the URL when you redirect: } else { $_SESSION['loggedIn'] = "false"; header("Location: index.php?message=Login failed"); } Then on the index.php page, check for the message: if(isset($_GET['message'])){ echo $_GET['message']; } You can pass any number of messages this way. *This code is not tested. You may need to tweak it some.
  24. I'm assuming you're using a Linux OS. Do you have error reporting turned on?
×
×
  • 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.