Jump to content

Carterhost

Members
  • Posts

    60
  • Joined

  • Last visited

    Never

Posts posted by Carterhost

  1. I would probably use FTP_BINARY as the mode, unless the only thing you're uploading is Text files.

     

    Text files can be uploaded in binary mode no problem.

    Binary files (including JPGs) will not transfer correctly in FTP-ASCII Mode.

     

     

  2. Create a new file: phpinfo.php

    Put this inside it:

    <?php
    echo phpinfo();
    ?>

    View that in a browser, then look through that for these:

    upload_max_filesize

    post_max_size

    max_input_time

    max_execution_time

    memory_limit

     

  3.  

    I don't know what database object your using... but does it have a numrows() or simular method? Something like....

     

     

    Yeah, Couldn't even find matching commands in the php manual.

     

    ???? what

    the commands is inside the class

     

    Eek, My Bad.

     

    Edit... it's too late for me. Roll on 1am when I can finish work!

  4. use this instead:

    $sql = "SELECT * FROM ipsr_garage WHERE userid = $userid";
        
    $result = $db->sql_query($sql);
    $num_rows = mysql_num_rows($result);
    if ($numrows == 0) {
    
    		echo "You currently have no cars in your garage.";
    
    }else {
    
    	while ($row = $db->sql_fetchrow($result)) {
    
    		$year = $row['year'];
    		$make = $row['make'];
    		$model = $row['model'];
    
    		echo "$year $make $model";
    
    	}
    }
    
    

    It counts the number of results, instead of pulling the first result for the test.

  5. Example from php.net which could be useful:

    <?php
    $lastthurs=strtotime("last Thursday",mktime(0,0,0,date("n")+1,1));
    ?>
    

    Returns the last thursday of this month.

    <?php
    $firstthurs=strtotime("next Thursday",mktime(0,0,0,date("n"),1));
    ?>
    

    Returns the first thursday of this month.

     

    So if I didn't need more coffee to stay awake, I'd work out the code for you.

    1. Test whether you're past the first thursday of the month

    2. If yes, get the date of the last thursday. If no, get the date of the first.

    3. Convert it to a nice format

    4. Echo it

  6. Quick and Dirrty:

    redirect.php:

    <?php
    $year = $_GET['year'];
    $month = $_GET['month'];
    $url = "http://invincible.comics-database.com/database/comicsByReleaseDate/".$month."-".$year;
    header('Location:'.$url);
    ?>
    

     

    Use this as the whole page. You should expand on it to do some input checking on your $_GET variables, but this should basically be it.

    Remember, no spaces or HTML before this code or you'll get the dreaded "Headers already sent" Error.

     

  7. Hi.

    I want to be able to store HTML input from a text field, and I wanted to encode it when it went in, so that it didn't break the PHP as it was assigning it to the variable. so I used URLEncode and URLdecode, but thenin text, "you'll" ends up as "you�ll", which is not what I want.

     

    Is there something else I could use? I've looked at a few functions in the man pages, but I don't think they're what I need.

     

    Cheers muchly.

  8. $query = "SELECT * FROM sports s, categories c, sport_catog sc WHERE s.SportId = sc.SportId AND c.CategId = sc.CategId AND c.CategId = ".$_GET['catog'] . " ORDER By s.SportTitle ASC";
    

     

    If Someone entered 1 OR 2 = 2 into the catog parameter, what would that make your SQL statement?

    This:

    WHERE s.SportId = sc.SportId AND c.CategId = sc.CategId AND c.CategId = 1 OR 2 = 2 ORDER By s.SportTitle ASC";

     

    Which would nicely return every row in your database, because 2 will always equal 2....?

     

     

    Just check that your $_GET['catog'] is what you want it to be before you start pumping it into SQL statements

×
×
  • 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.