Jump to content

DeanWhitehouse

Members
  • Posts

    2,527
  • Joined

  • Last visited

Everything posted by DeanWhitehouse

  1. I didn't delete anything
  2. so you didn't read my first reply
  3. Or just read my first reply
  4. Then i take it you aren't showing us the full code
  5. 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
  6. Yep, the last str_replace should do it $fieldArr = str_replace('_',' ',$fieldArr);
  7. Works, that's the string modifier right?
  8. Edit: that should be limitless dimensions in an array that i am trying to get.
  9. Is that because it is posted when it is inserted into the db?
  10. 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');} } ?>
  11. mysql_real_escape_string is the best and most common way and is good to use in conjunction with other security
  12. Lol, better not shout it out then
  13. I would do <?php $i = 0; $array = array(array("test"),array("test2")); foreach($array as $new_array) { echo $array[$i]; $i++; } ?>
  14. add or die
  15. 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) }
  16. Yes use code tags, and example $name should be $_POST['name_of_text_field']; You are trying to use undeclared vars
  17. It means you are trying to re-declare a function you have already declared (i think, pretty sure). Are you including a page with this function declared or included on it?
  18. Really yet you managed to write an file upload script fine? (google) And you have more than 1000 pages for your site, yet you don't understand $_GET http://forum.free-php.org.uk/index.php/topic,488.msg2491.html http://www.google.com/search?ie=UTF-8&oe=UTF-8&sourceid=navclient&gfns=1&q=jamesxg1
  19. Quick way to do it if you don't have access to php ini echo ini_get('session_save_path'); I think that is correct
  20. Considering someone has already told you what you need to do you should of tried that way and came back when you get stuck instead of waiting for code, which is most likely what you will do like some of your other threads. No you like to do the subtle approach and wait until someone just writes it for you.
  21. do for($i=0;$i<count($category);$i++) { if($i == 0) $sql = "CREATE VIEW items_temp AS SELECT * FROM items WHERE cat_id=".$category[$i]; else $sql = "INSERT INTO items_temp (column1,column2) VALUES ('value','')"; mysql_query($sql); }
  22. I have better things to do than find excuses why you can't be bothered to try and do work on your own. If you want examples use google
  23. Is the IF statement being run, try putting an echo in the statement.
×
×
  • 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.