Jump to content

rarebit

Members
  • Posts

    1,002
  • Joined

  • Last visited

Posts posted by rarebit

  1. The 'isset' is checking for a GET variable, probably from a submit button from a form. And for the other variable, put in any address you want, it's just something to display if the submit button wasn't used to access the page.

  2. This should help inform you:

    <?php
    
    
    if(isset($_POST['test']))
    {
    echo "passed<br>";
    }
    if ($_POST['test'] == NULL)
    {
    echo "something<br>";
    }
    if(empty($_POST['test']))
    {
    echo "pass<br>";
    }
    
    print "<html><head></head><body>";
    
    print "<form action='test2.php' method='POST'><input type='text' name='test'><input type='submit' value='send'></form>";
    
    print "</body></html>";
    
    ?>

  3. It works!

     

    <?php
    function bbcode_format($post)
    {
    
    $post = htmlentities($post);
    
    $simple_search = array(
                                    '/\[b\](.*?)\[\/b\]/is',                                
                                    '/\[i\](.*?)\[\/i\]/is',                                
                                    '/\[u\](.*?)\[\/u\]/is',
                                    '/\[center\](.*?)\[\/center\]/is',
                                    '/\[right\](.*?)\[\/right\]/is',
    			'/\[img=(.*?)\]/is',
    			'/\[(.*?)\](.*?)\[\/url]/is',
    			'/\[colour=(.*?)\](.*?)\[\/colour]/is',
    			'/\[quote\](.*?)\[\/quote]/is',
    			'/\[br]/is',
    			'/\[hr]/is',
    			'/\[h1](.*?)\[\/h1\]/is',
    			'/\[h2](.*?)\[\/h2\]/is',
    			'/\[h3](.*?)\[\/h3\]/is',
    			'/\----/is',
    			'/\----/is',
    			'/\----/is',
    			'/\----/is'
                                    );
    
            $simple_replace = array(
                                    '<strong>$1</strong>',
                                    '<em>$1</em>',
                                    '<u>$1</u>',
                                    '<center>$1</center>',
                                    '<right>$1</right>',
    			'<img src="$1">',
    			'<a href="$1">$2</a>',
    			'<font color=$1>$2</font>',
    			'<br><table border=0 bgcolor=#000000><td>$1</td></table><br>',
    			'<br>',
    			'<hr>',
    			'<h1>$1</h1>',
    			'<h2>$1</h2>',
    			'<h3>$1</h3>',
    			'f***',
    			's***',
    			't***',
    			'c***'
                                    );
    
            // Do simple BBCode's
            $post = preg_replace ($simple_search, $simple_replace, $post);
    
            return $post;
    }
    
    $post = "[b]hello[/b]";
    $p = bbcode_format($post);
    
    echo $post."<br>";
    echo $p."<br>";
    ?>
    

  4. Easiest way is to store date as you get it from time(), e.g. as a unix timestamp. This is basically returns an int, which is great for comparing things to. Then when you wish to show the user, then you format it to a specific format, this is because it may be different depending upon timezone etc...

     

    The way your doing it is ordering them by the the numeric value of the character string and the way they sum up is not in the same order as the way the months, days, etc are spelled! (if that's clear?)

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