Jump to content

DeanWhitehouse

Members
  • Posts

    2,527
  • Joined

  • Last visited

Posts posted by DeanWhitehouse

  1. Yes, that has nothing to do with anything

     

    In the insert code i take it you use a query similar to

     

    mysql_query("INSERT INTO table (row1,row2,dateposted) VALUES ('stuff','stuiff',NOW())");

     

    That would set its time to the time it was run, therefore your order by is working

  2. try , i disabled the header to stop it redirecting and producing errors

    <?php
    session_start();
    session_regenerate_id();
    $logovan = $_GET['ime'];
    $proizvod = $_GET['proizv'];
      if ($logovan != '')
      {
      echo "Session path: ".ini_get('session_save_path');
      $_SESSION['sesija_sesname'] = session_id();
      $_SESSION['sesija_loguser'] = $logovan;
      $_SESSION['sesija_tekuca_kat'] = 0; 
      $_SESSION['sesija_artikal'] = $proizvod;
      $_SESSION['sesija_korpa'] = ''; 
      $_SESSION['sesija_ukupna_cena'] = 0;
      $_SESSION['sesija_ukupno_artikala'] = 0;
      if ($proizvod == '')
      {//header('Location: index.php');}
      else
      {//header('Location: detail.php');}
      }
    ?>
    

  3. Ok, so here are my updated functions

    <?php
    ## Function: BBCode ##
    function bbcode($code)
    {
    	//colors, links, images,email,quotes,block
    	//marquee
    	$code = preg_replace("/\[scroll\](.*?)\[\/scroll\]/","<marquee>\\1</marquee>",$code);
    	//user
    	//$code = preg_replace("/\[user\](.*?)\[\/user\]/","<a href=''>\\1</a>",$code);
    	//strong
    	$code = preg_replace("/\[strong\](.*?)\[\/strong\]/","<strong>\\1</strong>",$code);
    	//definition list
    	$code = preg_replace("/\[dlist\](.*?)\[\/dlist\]/","<dl>\\1</dl>",$code);
    	   //term
    	   $code = preg_replace("/\[term\](.*?)\[\/term\]/","<dt>\\1</dt>",$code);
    	   //definition
    	   $code = preg_replace("/\[def\](.*?)\[\/def\]/","<dd>\\1</dd>",$code);
    	   
    	//unorganized list
    	$code = preg_replace("/\[ulist\](.*?)\[\/ulist\]/","<ul>\\1</ul>",$code);
    	//organized list
    	$code = preg_replace("/\[olist\](.*?)\[\/olist\]/","<ol>\\1</ol>",$code);
    	//list item
    	$code = preg_replace("/\[item\](.*?)\[\/item\]/","<li>\\1</li>",$code);
    	//sub
    	$code = preg_replace("/\[sup\](.*?)\[\/sup\]/","<sup>\\1</sup>",$code);
    	//super
    	$code = preg_replace("/\[sub\](.*?)\[\/sub\]/","<sub>\\1</sub>",$code);
    	//pre
    	$code = preg_replace("/\[pre\](.*?)\[\/pre\]/","<pre>\\1</pre>",$code);
    	//emphazied
    	$code = preg_replace("/\[em\](.*?)\[\/em\]/","<em>\\1</em>",$code);
    	//italic
    	$code = preg_replace("/\[i\](.*?)\[\/i\]/","<i>\\1</i>",$code);
    	//strikethrough
    	$code = preg_replace("/\[s\](.*?)\[\/s\]/","<del>\\1</del>",$code);
    	//bold
    	$code = preg_replace("/\[b\](.*?)\[\/b\]/","<b>\\1</b>",$code);
    	$code = preg_replace("/\<b\>(.*?)\<\/b\>/","<b>\\1</b>",$code);
    	//center
    	$code = preg_replace("/\[center\](.*?)\[\/center\]/","<center>\\1</center>",$code);
    
    	return $code;
    }
    
    ## Function: Secure ##
    	//Custom function to secure limitless(within reason if you want to keep speed up) variables, now supports arrays, single dimension arrays only!!
    	function secure()
    	{
    	    $arg_count = func_num_args();//Get the number of submitted arguments
    		$arg_list = func_get_args();//Store the arguments in a array
    		for ($i = 0; $i < $arg_count; $i++) //Loop through all the arguments
    		{
    			$un_secure = $arg_list[$i];//Store the current argument in a string
    			if(is_array($un_secure))//Check if the argument is an array
    			{
    				foreach($un_secure as $securing)//Loop through the argument array
    				{
    					$securing = htmlentities($securing);//Convert special chars, such as ' " @ etc., into HTML entities
    
    					$securing = trim($securing);//Remove any whitespace either side of the var
    
    					$securing = nl2br($securing);//Convert all /n to <br />, needed for displaying multiple lined vars
    
    					$securing = bbcode($securing);//Apply bbcode to the var
    
    					$un_secured[] = $securing;
    				}
    			}
    			else
    			{
    				$un_secured = htmlentities($un_secure);//Convert special chars, such as ' " @ etc., into HTML entities
    
    				$un_secured = trim($un_secured);//Remove any whitespace either side of the var
    
    				$un_secured = nl2br($un_secured);//Convert all /n to <br />, needed for displaying multiple lined vars
    
    				$un_secured = bbcode($un_secured);//Apply bbcode to the var
    			}
    				if($arg_count == 1)//If their is only one argument store it in a var
    					$secured = $un_secured;
    				else //If there are multiple arguments store it in an array so it can be used again in the loop
    					$secured[] = $un_secured;
    		}	
    		return $secured;//Return the secured argument(s)
    	}
    
    ?>
    

     

    And still when i do

     

    echo secure("[b]test[/b]");//this works
    //but
    $str = "
    [b]
    test
    [/b]
    ";
    echo secure($str);//this doesn't
    

     

    Also for that secure function i have, anyone know how i can make it support limitless arrays?

     

    Would that be the best way, below?

    	function secure()
    	{
    	    $arg_count = func_num_args();//Get the number of submitted arguments
    		$arg_list = func_get_args();//Store the arguments in a array
    		for ($i = 0; $i < $arg_count; $i++) //Loop through all the arguments
    		{
    			$un_secure = $arg_list[$i];//Store the current argument in a string
    			if(is_array($un_secure))//Check if the argument is an array
    			{
    				foreach($un_secure as $securing)//Loop through the argument array
    				{
    					$securing = htmlentities($securing);//Convert special chars, such as ' " @ etc., into HTML entities
    
    					$securing = trim($securing);//Remove any whitespace either side of the var
    
    					$securing = nl2br($securing);//Convert all /n to <br />, needed for displaying multiple lined vars
    
    					$securing = bbcode($securing);//Apply bbcode to the var
    					if(is_array($securing)){$un_secured[] = secure($securing)}
                                                    else
    					   $un_secured[] = $securing;
    				}
    			}
    			else
    			{
    				$un_secured = htmlentities($un_secure);//Convert special chars, such as ' " @ etc., into HTML entities
    
    				$un_secured = trim($un_secured);//Remove any whitespace either side of the var
    
    				$un_secured = nl2br($un_secured);//Convert all /n to <br />, needed for displaying multiple lined vars
    
    				$un_secured = bbcode($un_secured);//Apply bbcode to the var
    			}
    				if($arg_count == 1)//If their is only one argument store it in a var
    					$secured = $un_secured;
    				else //If there are multiple arguments store it in an array so it can be used again in the loop
    					$secured[] = $un_secured;
    		}	
    		return $secured;//Return the secured argument(s)
    	}
    

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