Jump to content

premiso

Members
  • Posts

    6,951
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by premiso

  1. http://us.php.net/manual/en/ref.ftp.php It all depends on what you want to do. All the information you need is provided there. I would expect, you will want to ftp_rawlist then loop through that and use ftp_fget or ftp_get and save the files you want via that way. Give it a try and see what you can come up with.
  2. mysql_real_escape_string any string data going in and validate your data. If you expect an ID, make sure that it is numeric and not a string/anything else. etc.
  3. Should not be any difference, honestly. I do notice you are not setting a domain, that may have something to do with it. Try setting the domain in the cookie and see if it works. That is the only change in setcookie to PHP5, which does not effect you with the code provided.
  4. // signifies comments. It is not executed it is used to describe code or in debugging by commenting out possible problematic code.
  5. Why not just use array_rand? <?php $images = array('pic1', 'pic2', 'pic3'); $image = $images[array_rand($images)]; $selectedImage = "images/{image}.jpg"; ?> EDIT: Fixed example.
  6. php tidy will not help. Chances are you code has loops that are not necessary etc. Stuff that can be condensed down and made to work more efficiently. The size, as stated by wild, does not effect how fast the script runs. It is all about how it is coded.
  7. umm no...did you not read how I wrote it? $query = "SELECT * FROM events WHERE `type` = 'Pay Per View' ORDER BY `showname`"; $result = mysql_query ( $query ); // Run The Query $rows = mysql_num_rows($result); if ($rows > 0) { // Fetch and print all records. $i = 0; while ( $row = mysql_fetch_array ( $result, MYSQL_ASSOC ) ) { $sClass = 'row2'; if ($i ++ & 1) { $sClass = 'row1'; } printf ( "<tr class=\"%s\">", $sClass ); print "<td valign=\"top\" align=\"center\" width=\"30\"><a href=\"#\" onclick=\"editbooker('editbooker', 'content' , '". $row ['showname'] ."'); return false;\">Edit</a></td>"; printf ( "<td valign=\"top\">%s</td>", $row [showname] ); printf ( "<td align=\"center\" width=\"80\">%s</td>", $row [airs] ); printf ( "<td align=\"center\" width=\"50\">%s</td>", $row [matches] ); printf ( "<td align=\"center\" width=\"100\">%s</td>", $row [status] ); print '</tr>'; } }else { echo 'No rows to display.'; }
  8. $result = mysql_query ( $query ); // Run The Query $rows = mysql_num_rows($result); if ($rows > 0) { }else { echo 'No rows to display.'; }
  9. One single quotes interpret the $ literally, so it is print "$loc", you want to use double quotes. If this is a template, it seems like you need to make $loc into a template variable and call it with {loc}.
  10. Post more code. There are a few different reasons this can be happening. And without the code you get guessed answers.
  11. addslashes is going to be depreciated, it is better to use mysql_real_escape_string to escape data. For the password, you do not need add slashes, since you are converting it to MD5. Although if you started doing that, you should keep doing that, I would suggest changing it however. Why not do one query to pull out the username? WHERE ID = ID AND password = password there is no need to pull them both out separately. Basically remove those two single mysql's and just use the $sql = select from clients, if the num_rows of that return > 0 then you have a valid user. You are doing redundant, unnecessary checking. As for why the password is bad, no clue, how is it being entered into the DB, if you are adding slashes here and not when entering it, that could cause issues. Also MD5 will be case sensitive. One final suggestion, properly indent your code. It will make it a ton easier to debug it.
  12. html_entity_decode
  13. You could use .htaccess to always redirect to www. which a howto can be found here if you want to force one or the other. If not: $hostname = str_replace("www.", "", $_SERVER['SERVER_NAME']); Should work, however. EDIT: =\ beaten to it. However, posting for the .htaccess info.
  14. You are going to need to use a fopen fwrite fclose Since you just have the file you want created, try figuring out those methods then when you get help up post your current code and ask for help.
  15. actually i want run the localhost witout internet connection...what shall i do? mozilla cannot use witout internet? Disconnect your internet then run mozilla to localhost. What it seems like is you were browsing the internet, or did not have xampp turned on after your internet connection was offline, which caused Mozilla to go into offline mode To fix it, uncheck the offline mod. The offline mode means it is just going to use a cached version. You do not want that. The "Online" mode will work just fine without an internet connection on Localhost.
  16. You never check if the session variable isset. If that variable isset then the user is logged on, so show them their options. You check for $_POST, but if the user is just browsing pages, $_POST is not going to help you, you need see if $_SESSION['login'] has been set etc.
  17. Check for a whitespace between the top of the file and the <?php any type of character (even whitespace) send to the browser will cause this error. Here is an example: <?php The above is bad, it should be: <?php However, you should get this with the session_start, but I get the feeling it is never being initiated with how you attempt to start it. Start the session no matter if $_SESSION is there, your check is not really doing any good. EDIT: Added more.
  18. The first, since you were just dong $allitems = $rowentry you were assigning that a new variable each time. You expected it to keep the results, but the = is an assignment operator, so it was being overwritten. What I did there was make $allitems and array so we could store each entry as an element of an array then I used the implode outside of the loop to combine the elements of an array with a , spliiting them. This was because the IN function in my sql can take multiple items as long as they are split by a comma. This allowed for the search to actually works, since you will not just be searching the last item obtained from the first sql, instead it pulled where all the IDs were in the $allitems. Next, moving the echo inside the first while, is more or less just common coding. Why have 2 loops when one will suffice. Since you were not doing anything else with the return from the DB but echoing it was better/easier just to put that inside that while loop.
  19. You are not setting $num to be anything for the last while statement. Since it would be looked at as "0" this is never ran. What is $num support to be? Also $description = $allrows['description']; Each time the loop is ran that is overwritten. Why not move the data from the third loop into the second... while($allrows = mysql_fetch_array($searchitems, MYSQL_ASSOC)) { $numrows = mysql_num_rows($searchitems); $name1 = $allrows['name1']; $displayid = $allrows['displayid']; $requiredlevel = $allrows['requiredlevel']; $unique = $allrows['Unique']; $quality = $allrows['quality']; $description = $allrows['description']; echo "Name: $name1<br /> Display ID:$displayid<br /> Required Level: $requiredlevel <br /> Unique: $unique <br /> Quality: $quality <br /> Description: $description <br /> "; } Give that a try and see what comes of it.
  20. Are you calling the function?
  21. Sorry, small change: $allitems = array(); while($items = mysql_fetch_array($getitems, MYSQL_ASSOC)) { $allitems[] = $items['itemid']; } $allitems = implode(', ', $allitems); // changed this to allitems $searchitems = mysql_query("SELECT * FROM items WHERE entry IN( $allitems)");
  22. Try this: $allitems = array(); while($items = mysql_fetch_array($getitems, MYSQL_ASSOC)) { $allitems[] = $items['itemid']; } $items = implode(', ', $allitems); $searchitems = mysql_query("SELECT * FROM items WHERE entry IN( $allitems)"); And see if that solves your issue.
  23. Write your code properly and do any headers before output is printed to the screen. Either store output into a variable and print it when necessary or put a "bandaid" on it with ob_start
  24. Not possible, that is what AJAX is for to check if the DB changed. They would have to manually refresh the page every x minutes or you would have to force it. The other options are JAVA with IRC, just plain JAVA and no IRC, frames with the chat display frame refreshing every x seconds.
  25. Yea, that was just bad wording. I should have worded it more of, MSSQL is not my preference to start learning SQL on. That was my bad with poor choice of words. I just have had bad experiences with that in the past, so yea.
×
×
  • 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.