-
Posts
15,232 -
Joined
-
Last visited
-
Days Won
427
Everything posted by requinix
-
Typically the template does that logic, along the lines of {{if show_time eq "on"}} {{time}} {{/if}}
-
How do you feel about picking one tag format and sticking with it? I see three in there. {}s are traditional so maybe {include block=dim_header} {start block=welc} {$dimphrase.welc_msg|replace values="mooo,ererer"} {welc_msg|replace values="ya,yahoo"} {end block=welc} {start block=welc_msg2} {$dimphrase.welc_msg} {welc_msg|str_replace values="1,2,12"} {start block=UY} hii 6 {end block=UY} {start block=GO} hii 5 {end block=GO} {end block=welc_msg2} {include block=news_important} {*TEMPLATE ZONE START:DONT REMOVE NEXT LINE*} {includezone block=Important_block_module} {*TEMPLATE ZONE END*} {start code=php} echo "ahmoodi"; {end code=php} {start code=php} echo 'yoyoyo'; {end code=php} {gogogo|replace values="hi,hello dimofinf"|replace values="hell,hmooda"} {function: randomcolor} {function:calc name="row" values="1,5,8" sign="+"} {includescript block=./news} {if " eq '1'" - not sure what youre trying to show here} ahmed {endif}
-
Turn off the magic_quotes php.ini setting. Then do a pass over any other code you might have to make sure you are being safe with SQL queries and the like (which addslashes() doesn't count towards).
-
Yes, then you do a mysqli::prepare(), mysqli_stmt::bind_param(), and mysqli_stmt::execute(). (Then fetch the results.) Take a look at mysqli in the manual. Besides the documentation there's plenty of examples and user comments.
-
Yes, it will list mysql and possibly PDO and/or mysqli. Also note if it mentions "mysqlnd" anywhere.
-
First is to make sure you're using the PDO or mysqli extensions. Not the mysql extension (whose functions are all named mysql_*) because it's old and not as useful. Once you've switched, PDO and mysqli both support prepared statements where you can write a query with variables select items from table_name where state = ? (mysqli) select items from table_name where state = :state (pdo)and then bind the state name to that variable. Then you don't have to worry about SQL injection at all: no need to quote stuff, no need to escape stuff.
-
Load up the HTML in DOMDocument, then do a getElementsByTagName() to find that link. If you know the URL will always follow some structure then you can "find that link" by checking all the hrefs until you get the right one. Otherwise you can look for a target=_blank attribute and inner HTML of "Continue". Both methods can break if they change the site enough. So... what's this for? It's odd that they're changing the link you need so often.
-
SoapServer - how to add namespace to response
requinix replied to immortallch's topic in PHP Coding Help
The only difference between the two is that the "proper response" includes an xmlns for a namespace that isn't used anywhere. It doesn't matter. So are you trying to do this for cosmetic purposes or is there a functional problem somewhere? -
display duplicate values in multidimensional array
requinix replied to cristyen's topic in PHP Coding Help
array_count_values() should work at that point, except it doesn't work on non-string, non-integer array items (because they end up as array keys). So you have two options: 1. Multiply everything by some constant so that everything is an integer (like 2 or 10), then count. $TableauNotesCounts = array_count_values(array_map(function($a) { return $a * 2; }, $TableauNotes)); 2. Since 6 is apparently the magic number, do this work in that code you had earlier that calculated the totals. At its simplest, keep an array of counts $TableauNotesCounts = array(); and add to it when you calculate something for $j=6. It's trickier because you can't just use 6.0 or 4.5 as array keys... if ($j == 6) { if (isset($TableauNotesCounts[$Note * 2])) { $TableauNotesCounts[$Note * 2]++; } else { $TableauNotesCounts[$Note * 2] = 1; } } In both cases, when you loop over the array of counts you'll need to divide the key by the constant (eg, 2) to get the original score. -
... What you posted is way too specific to be actual input from a user. Also doesn't make sense to enter search terms like that when you can run arbitrary SQL. So that's the SQL generated by your site, which you are supposed to be familiar with, including information provided by the user. The spam information. I can't know more about your site than you do but I can tell you with reasonable certainty that it was neither an attack nor was putting your site at risk. With that said, go learn how your own site works.
-
Converting string to a number for calculation
requinix replied to mcmuney's topic in Javascript Help
When I asked what you needed the width for I wasn't looking for an answer like "to do stuff with it". What is "do X"? What is "do Y"? Are you absolutely positive that you can't do both, conditionally, client-side? Because if not then you have to display a page first, use Javascript to get the screen dimensions, then reload the page passing along the numbers. -
display duplicate values in multidimensional array
requinix replied to cristyen's topic in PHP Coding Help
How about posting some more code? Like the stuff that queries the database, loads the numbers into the array, and outputs it all. -
count coding is working in localhost but in 000webhost i get error
requinix replied to Spraban9's topic in PHP Coding Help
As long as the query worked, $profile will be set to something. empty($profile) won't tell you if there were any results, and you won't get an error trying to fetch from a (successful) resultset even if it's empty. -
Converting string to a number for calculation
requinix replied to mcmuney's topic in Javascript Help
You can't mix and match PHP with Javascript like that. What do you need the width for? It might have to wait until the page has been displayed - you can't get the screen width any earlier than that, but you might be able to do something else that doesn't require having the numbers in front of you. -
count coding is working in localhost but in 000webhost i get error
requinix replied to Spraban9's topic in PHP Coding Help
That means the query failed. Use mysql_error to find out why. -
Then find a regular expression for emails, names, and numbers, probably looking like (email|name|number), then stick (?at the very beginning.
-
Find a regular expression for emails then stick (?at the very beginning.
-
Ah, okay, it makes sense now. If you can safely array_filter $_POST, which will automatically prune out empty array values, then it's as simple as $required = array("A" => "Field A", "B" => "Field B", "C" => "Field C"); $diff = array_diff_key($required, array_filter($_POST)); Otherwise $required = array("A" => "Field A", "B" => "Field B", "C" => "Field C"); $missing = array(); foreach ($required as $name => $label) { if (empty($_POST[$name])) { $missing[] = $label; } } (assuming I understand you correctly this time) [edit] #$^(*@#, code tags are killing my indentation again
-
So... you're not asking about how to provide a "default" value for something in case one wasn't provided in the form? Because that's really what it sounded like.
-
display duplicate values in multidimensional array
requinix replied to cristyen's topic in PHP Coding Help
-- Are you getting this array from a database? -
Have you considered using both the key and the value in that foreach? You were so close. // $_POST = array("A" => "", "B" => "Original B"); $defaults = array("A" => "ValueA", "B" => "ValueB", "C" => "ValueC"); $items = array(); foreach ($defaults as $key => $value) { if (empty($_POST[$key])) { $items[$key] = $value; } else { $items[$key] = $_POST[$key]; } }Or you can just use one array.$items = array("A" => "ValueA", "B" => "ValueB", "C" => "ValueC"); foreach (array_keys($items) as $key) { if (!empty($_POST[$key])) { $items[$key] = $_POST[$key]; } }
-
You have placeholders in the query but you never bind anything to them. Gotta put values in there.