-
Posts
2,527 -
Joined
-
Last visited
Posts posted by DeanWhitehouse
-
-
Show the insertion code and where you are using the str_replace
-
Lol ,that is what Ajax is used for to run php pages on the server.
-
Ahh my bad, just googled it
should be
ini_get('session.save_path');
-
-
I didn't delete anything
-
so you didn't read my first reply
Is that because it is posted when it is inserted into the db?
-
And your telling us why?
-
Or just read my first reply
try putting session start at the top of the code, make sure it is before everything else (including any PHP or html code)
-
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
-
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
-
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) }
-
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?
-
-
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
[SOLVED] PHP Mysql query help
in PHP Coding Help
Posted
What are you expecting it to echo exactly?
That is just the query to select the rows, once selected they need to be retrieved.