| |
| |
| |
|
Page: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
Comments:
<0> you can also use the dom's xpath parser to run an xpath query, get a nodeset, and loop over the nodeset as well <0> in fact, I would suggest that :( <1> once this is done i'm releasing under GPL :D <0> http://us3.php.net/manual/en/function.dom-domxpath-evaluate.php <1> thanks alot for the links provided <2> $uid = (int) @$_REQUEST['userid']; // This should make $uid pretty safe from SQL-injection, right? <2> I mean, if there is anything other than a digit, it will return 0. <0> lose the @ <0> not really <2> No? <0> they could send their own userid <2> Of course. <0> you should use a session, not let the user submit their own userid <2> It is a list of users that a user can click to view. <3> You can use: if (is_numeric($_POST["user_id"])) { do something } <0> oh. no problem then
<0> just lose the @ and do REAL checking <0> don't be lazy. Laziness is the quick road to security holes <2> Well... yeah. <3> You can adopt something like this: <3> if (is_numeric($_POST["user_id"])) { $clean["user_id"] = $_POST["user_id"] } <2> $uid = (empty($_GET['userid']) ? 0 : $_GET['userid']); <2> danf_1979: Using E_ALL would give you a notice if the variable is not set, right? <4> $element = $dom->createElement('node'); $dom-appendChild($element, $dom->createAttribute('foo', '1'), $dom->createAttribute('bar', '2'));? <3> yes <4> does that look right? <3> use isset <3> and if you adopt $clean array <3> make sure to do $clean = array(); <3> you can use $mysql["stuff"] for things that are clean and go to mysql <2> Sure. <3> and $html["stuff"] for displaying <5> if ( !isset($_POST['user_id'] or !ctype_digit($_POST['user_id']) ) { handle bad data } else { $user_id = $_POST['user']; } <2> Hm. Not a bad idea. <3> make sure you initialize arrays <3> at the top <5> or rather, $user_id = $_POST['user_id']; <2> Sholdn't that problematic be removed since globals are off? <6> Which is faster, using MySQL to search a database for the existance of a username or using PHP to search an array for the existance of a value, ***uming there are the same number of both and the array is a single dimension? <7> depends on the number of possibilities <8> Can someone tell me how to p*** back PUT input from a hyperlink (not using a form)? <7> if there's only a few, then use an array, if there's a lot then use a DB <2> Let the database do the things it does best, find stuff =) <6> Thankyou. <3> I usually use this kind of method for entering data to mysql: <3> if (is_numeric($_POST["parent_id"])) <3> { <3> $mysql["parent_id"] = $_POST["parent_id"]; <3> } <3> where "parent_id" is the field name <9> Is there any simple way to translate say like... "March" to 3? <2> cynic: strtotime could probably do that. <7> Warning: domdocument(): Start tag expected, '<' not found in blah .. where the line in question reads: $doc = new DomDocument('1.0'); <7> none of the docs suggest I need to provide a '<' <10> hey guys <11> Woosta: it has to be something else <11> php -r "\$x = new DOMDocument('1.0');echo \$x->saveXML();" <11> <?xml version="1.0"?> <7> :( <11> pastebin the entire page <7> http://pastebin.com/643286 <8> I am using $_GET["myvar"], but need to p*** back using POST method, instead... How can you do that from a hyperlink? Is there a javascript method? <7> Error claims to be on line 9 <11> those are way too many arguments for one function <7> Can't post from a hyperlink .. only from a form <7> tempest1: I agree :) <7> I didn't write this <11> try an array maybe lol <5> you can with javascript <11> oh ok <8> Woosta: Then can I make all my pages forms and somehow use hyperlinks as submits? <7> you could use JS to submit a form via post .. but then you have to make sure the user has JS turned on .. <7> But if you need to link via post then you've got something wrong somewhere .. post is for posting data to the server .. get is for getting data from the server <7> linking is about getting data .. <7> tempest1: other than the inordinate number of params .. does anything else look amiss that could cause the error? <11> not off hand
<8> Woosta: I have many different pages going to the same .php file with a broad variety of data.. I don't want it to show in the URL and sometimes it will be too long to put in the URL. <7> maybe the DOMDocument extension I installed isn't the right one .. I installed php4-domxml from debian .. <11> Woosta: yea, the DOMDocument extension was a replacement for DOMXML from php4 <7> Solifugus: if you're submitting data to a document, then you shoudn't be using a hyperlink .. but if you must, consider styling a submit button to look like a hyperlink .. <7> tempest1: so it has the same namespace, but different interface? <11> yes <7> Did noone consider that to be utterly stupid? <8> Woosta: I am thinking about just going with the Javascript approach.. doesn't pretty much everything support js now days, anyway? <7> So where do I get the right one? <11> Woosta: have to install php5 i believe <7> Solifugus: it's an unknown .. but a fair number of people turn it off for 'security' <7> tempest1: this runs on our server under php4 .. <11> i have JS turned off <11> Woosta: you might have to reimplement it then <11> with a find and replace all editor, and php.net it shouldn't take long <8> Woosta: or.. i'll have to learn how to style a submit button, then.. <3> css? <7> I might look for a new solution then .. this is code to give to our partners who might or might not know anything about php :) <3> This is how you can use css in a submit button: <3> <input cl***='do_action' type='submit' name='delete_category' value='' /></td> <3> where do_action is defined in css.. you can use an image, etc <3> hover and all kind of nice stuff <7> input.submitLink { border: 0; margin: 0; padding: 0; background: transparent; /* <-- I think */ font-family: blah; font-size: blah; font-weight: blah } <3> if you want to use an image it would be background: url(do_action.gif) no-repeat; <3> you can use for example an image oh 50px height, and divide it in 25 in one color, and 25 in another color <3> then use in hover: <3> background: url(do_action.gif) no-repeat 0 -25px; <3> at it would change color <8> Woosta: ok... i copied all that into a text file.. I will play with it.. I never learned css because i've always been a programmer.. I know function and really hate it when I have to do something aesthetic... I can do anything in terms of backend functionality, though... In a language I know well, that is. <7> I'm surprised you're using PHP then .. it's so much harder to separate front- and back-end <3> I like to design myself <8> Woosta: I just start every .php file with <?php ... do my coding.. and end it with ?>. Print out html when ever I need to... minimally.. <8> PHP is owesome for data processing. <7> lol <3> Yes it is, I use it a lot for server mantainance, as well as python <3> python is niceee <8> python seems nice in principle, but i just cannot get used to its syntax.. it bothers me... why can't it be more standard in terms of basic syntax and what it calls things.. a "dictionary" ?! php is much faster coding and nicer looking, in my opinion... unless you have it mixed in with html. <7> tempest1: I can't move on :) ... so I've installed an old version of DomDocument, or a new one? Is there any way of querying the api of the one I have installed? Is there any way to install the one documented at php.net/dom? <3> My opinion is different <11> Woosta: you can try... <3> python is an elegant, clean and powerful language. I love GUI programming in python <3> Linux/FreeBSD/MacOS/Windows compatible <3> you can even make an .exe in windows <3> nice... <11> Woosta: it's part of the PHP core, and since you have an old version, you can't use it until you install php5 <11> you could install php5-cli though, and set it up concurrently <7> Mmm .. how can I query php on our server to see what version it is? <8> danf_1979: perhaps my view would be different if someone would make a decent python tutorial.. most of them have you spending hours doing silly things like arithmatic expressions.... and the ones that get to the point are always too incomplete to be useful. I didn't really have to learn PHP, I just looked at some code and it was obvious.. <11> Woosta: phpinfo(); <7> PHP 4.3.2 (cgi), Copyright (c) 1997-2003 The PHP Group <7> So it's using 4.3.2 .. but has some domDocument extension that has the proscribed interface <11> you could install php5 and use shell_exec() or something <11> no, it doesn't <8> danf_1979: php uses the same terminology, syntax, and commands as most other normal programming languages.. <7> It doesn't? But this script *works* there? <3> Solifugus, yes I agree. Usually python tutorials are just some basic scripting stuff. If you want more, then you have to look some demos, like wxpython... <11> Woosta: it does? <7> yup <11> hmm <3> python syntax is cleaner than other languages <11> danf_1979: what others? <12> Hi guys. Hope you can help please! We have a 404.php which is shown when a 'missing' page is requested, however, I'm trying to show what the missing file actually is. If I use <?php echo $_SERVER['HTTP_REFERER'] ?> it doesn't show anything, I've also tried REQUEST_URI which just shows /404.php - any ideas how I can do it? <8> danf_1979: yes.. a good set of small sample programs would really boost one's ability to quickly learn python. python's syntax may be clear, but it's so foreign and nonstandard that for someone coming from another language, it's really difficult. <13> look in your server logs <11> Xyphoid: bad idea <13> 404 is displayed by the webserver, not the client - referer will not be set <3> Don't generalize Solifugus <11> there was a server var to do it or something, check phpinfo(); <12> ah ok, I wanted to show something like: "Sorry the file you requested (/blah.php) does not exist." - no way? <7> Xyphoid: afaik, referrer is set .. <13> oh, I read that as 'how do we find this particular one' <7> teach: that's not referrer <3> for dir in dirs: <3> command = "du -s %s%s" % (path, dir)
Return to
#php or Go to some related
logs:
autonumeric access #php #suse wesw02 gentoo mdns hosts.conf #gentoo the <=x11-base/xorg-x11-6.9 package conflicts with another package #css PYHOOK slow sources.lst debian kernel-source
|
|