-
Posts
2,527 -
Joined
-
Last visited
Everything posted by DeanWhitehouse
-
I didn't delete anything
-
so you didn't read my first reply
-
[SOLVED] Social network profile.php need to be made how do i ?
DeanWhitehouse replied to jamesxg1's topic in PHP Coding Help
And your telling us why? -
Or just read my first reply
-
Then i take it you aren't showing us the full code
-
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
-
Change database field name to a different word during query?
DeanWhitehouse replied to hominid4's topic in PHP Coding Help
Yep, the last str_replace should do it $fieldArr = str_replace('_',' ',$fieldArr); -
Works, that's the string modifier right?
-
Edit: that should be limitless dimensions in an array that i am trying to get.
-
Is that because it is posted when it is inserted into the db?
-
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');} } ?>
-
mysql_real_escape_string is the best and most common way and is good to use in conjunction with other security
-
Lol, better not shout it out then
-
[SOLVED] How do I iterate over array of associative arrays?
DeanWhitehouse replied to devdavad's topic in PHP Coding Help
I would do <?php $i = 0; $array = array(array("test"),array("test2")); foreach($array as $new_array) { echo $array[$i]; $i++; } ?> -
add or die
-
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) }
-
CODE HELP PLEASE!!! ITS FOR A FORM IM USING ON MY WEBSTE
DeanWhitehouse replied to thaiceman's topic in PHP Coding Help
Yes use code tags, and example $name should be $_POST['name_of_text_field']; You are trying to use undeclared vars -
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?
-
[SOLVED] Social network profile.php need to be made how do i ?
DeanWhitehouse replied to jamesxg1's topic in PHP Coding Help
What did i say -
[SOLVED] Social network profile.php need to be made how do i ?
DeanWhitehouse replied to jamesxg1's topic in PHP Coding Help
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 -
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
-
[SOLVED] Social network profile.php need to be made how do i ?
DeanWhitehouse replied to jamesxg1's topic in PHP Coding Help
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. -
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); }
-
[SOLVED] Social network profile.php need to be made how do i ?
DeanWhitehouse replied to jamesxg1's topic in PHP Coding Help
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 -
Is the IF statement being run, try putting an echo in the statement.