-
Posts
15,262 -
Joined
-
Last visited
-
Days Won
431
Everything posted by requinix
-
The expression needs ^ and $ anchors at the beginning and end, respectively.
-
One thing that hasn't been pointed out yet: $_FILES[foo]["type"] is not secure because it is provided by the browser, not by PHP. You need to figure the type out by yourself (like with getimagesize()).
-
SELECT player_id FROM x WHERE -- "all the nt_caps=0" also means "there aren't any nt_caps!=0" player_id NOT IN ( -- these are players to *exclude* SELECT player_id FROM x WHERE nt_caps != 0 -- however not all nt_caps!=0 are bad - only the ones that aren't nat=68 too AND nat != 68 )
-
What's your exact code and are you sure that the stuff is real XML?
-
It'd be whatever generates the content. Like PHP. First item it prints has one color. Next one has the other. Next one has the first. And so on.
-
Are you talking about alternating coloring? [edit] There's a pure CSS way but it isn't supported everywhere yet. Otherwise whatever code generates the list also decides the coloring for each item in it.
-
Your second example is screwed up in a few ways. Did anybody notice that SimpleXMLElement can take a URL as an argument? Or that the third argument is only true if the $data is a URL? $url = "http://www.myurl.com/api?user=$userid"; $xml = new SimpleXMLElement($url, null, true);
-
.header img selects any IMG that's a descendant of any class=header element. img.header selects any IMG with a class=header. You need to find yourself a tutorial or book on CSS.
-
RewriteRule doesn't include the query string when it matches URLs. RewriteEngine On RewriteCond %{QUERY_STRING} ^search_KEYWORD=([a-z]+)&search_RANGE=([a-z]+)&o=([0-9]+)&search=[0-9]+$ [NC] RewriteRule ^/09search_results.php$ /%2/%1/%3 [NC, L]
-
Which one? Random? First? First in what order?
-
I can give pointers, sure, but I don't know what all you've been taught. Your teacher wouldn't ask you to write a parser unless s/he gave instructions on how to do so. So now, (a) did the teacher tell you how to do it and (b) are you sure you're supposed to?
-
There are two problems: 1. getElementsByClassName (as well as getElementsByTagName) returns a DOMNodeList, or whatever the name of the interface is. It's more than just an array: it can change as its elements change. When you remove items that are found in that list, they also disappear from the list. As i counts up, the length of the list counts down. 2. "in" is dangerous. It will find everything that's a member of whatever you're trying to traverse. Try console.log()ing or alert()ing i, see what you get. var details = document.getElementsByClassName("details"); // simply going from 0->length wouldn't work as the length changes // going in reverse is a cheap alternative for (var i = details.length; i > 0; i--) { var p = details[0].parentNode; p.removeChild(details[0]); // once removed, [1] becomes [0], [2] becomes [1], etc. }
-
When you don't want external code to have access to something but might want children to. Like "helper" methods or useful variables.
-
Yeah... Because you're overwriting the previous value. Right there on the first line.
-
Assuming that totaltime was previously set, just subtract that value from time(). time() - $_SESSION['Yahtzee']['totaltime']
-
Yes, but first you should ask your teacher/professor whether the malformed XML was intentional and how you should deal with it. [edit] And whether you're supposed to write your own XML parser or what. I would expect so.
-
Can PHP dynamically change .htaccess files?
requinix replied to Ivan Ivković's topic in PHP Coding Help
A web-based text editor comes to mind. How? [edit] You might be talking about a kind of site administration thing, but in that case the .htaccess is just a normal file you'd want to edit as your site evolves. We're talking about something that needs the .htaccess to change dynamically and (I assume) automatically for whatever reason. -
What errors, if any, does libxml_get_errors return?
-
Can PHP dynamically change .htaccess files?
requinix replied to Ivan Ivković's topic in PHP Coding Help
...but there are, like, zero reasons you should ever need to. What are you trying to do? -
Check the PHP manual for exactly what the w+ mode means:
-
I vaguely recall there being problems with PHP, libxml, and filesystem access. Some security settings preventing reading and writing. Are you simply dumping /Schema/Table to a file?
-
bind_param("$srt.'i'", $par, $c_arr_tags) That first argument is a bit messed up. If $str was empty then you'd be passing literally .'i'
-
string cmd = string.Format(@"-u{0} -p{1} -h{2} {3}", "root", "password", "localhost", DBName); Those are the arguments you're giving to mysqldump.exe. Modify that so you get the kind of backup you want. mysqldump