| |
| |
| |
|
Page: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
Comments:
<0> omnipresence: Where did you put the var_dump() in relationship to what's on pastebin? <1> lemme repaste <1> i took all the junk out <1> http://pastebin.com/641554 <2> Whats a safe method of using shell_exec() whose argument is based on user input? <1> its returning the following: string(12) "inv_lock.gif" string(9) "image/gif" string(14) "/tmp/phpBjiFci" int(0) int(735) <0> fleckz: There is no such thing, really <1> i dont know why the string crap is in there <3> fleckz: there isn't a "safe" method :P <3> fleckz: you can start by escaping everything <0> fleckz: You can attempt to minimize exposure by escaping. <4> omnipresence: that is expected <3> http://us3.php.net/manual/en/function.escapeshellarg.php <3> fleckz: http://us3.php.net/manual/en/function.escapeshellarg.php <3> fleckz: but seriously... it isn't recommended <0> omnipresence: You understand that what you're getting is from looping through an array, right?
<3> TML: he really should just use $array[9] or whatever... <1> finally, i got it <1> thank you <3> omnipresence: me or TML ? <0> bashusr: It's all yours <1> no, still broken <3> didn't think so TML ;-) <0> omnipresence: You're going to have to explain what you're trying to do, and what part of it is not working. <0> Or not...whatever floats your boat <5> winmutt: sw3 <6> when i submit a list of checkbox via form, the name= with space or . becomes _, is there a way to make it AS IS? <3> deadcat: nope. <6> doh <3> $var['fdf fd'] is invalid... ain't it? <7> nope it's not <3> there's your answer deadcat <1> ARGGGGGGGG <8> et: Why wouldn't it be? <7> it's a legacy issue <1> $fileInfo=array(array($key => $val)); <1> var_dump(fileInfo); <7> when using register_globals, those names would result in difficult-to-acces-variables <7> berry__: array keys can be any string or integer <6> i have <input type=checkbox name="/path/dvc vs mendo.wmv">dvc vs mendo, when i click send, var_dump($_REQUEST) shows its now DVC_Vs_Mendo_wmv <3> berry__: try to foreach($var as $key=>$value) that :) <8> I will.. I'll post my findings :) <6> ignore my case and path. i am just talking about the space and . right now <3> deadcat: try... <input type='checkbox' name="filename[]" value="/path/dvc vs mendo.wmv"> <1> the var_dump($fileInfo) returns the following: array(1) { ["name"]=> string(12) "inv_lock.gif" } array(1) { ["type"]=> string(9) "image/gif" } array(1) { ["tmp_name"]=> string(14) "/tmp/php3NZiJr" } array(1) { ["error"]=> int(0) } array(1) { ["size"]=> int(735) } 735 <7> deadcat: you can not prevent that. <6> bashusr: ah. thanks <3> when it's selected, $filename[] will be filled <1> i need to get "inv_lock.gif" "image/gif" "tmp_name" into separate vars somehow <7> no, you don't need to, because they already are <3> omnipresence: $fileInfo['name'] is in its own var <1> DAMN <1> you're right <3> lol <3> omnipresence <- noobie :) <6> bashusr: you're the man (= <6> thanks <3> :) <6> as you can tell i am a bad web developer (= <8> bashusr: It actually works. <3> i'm not that great either... only half decent. <3> berry__: i suppose it will... <3> berry__: but how about $GLOBALS['weird var']? <3> can you access $weird var? <7> bashusr: yes. <3> maybe {$weird var} allows it..... <7> ${'weird var'} <3> ah <3> i see <3> weird <8> never use globals. <3> i thought spaces wheren't valid vars <0> omnipresence: I don't understand...you're building an new array for each key, but you're upset that PHP does what you told it to? <8> TML: lol. <7> bashusr: they're just more difficult to access <3> valid var names*
<3> does that mean special characters are allowed as php var names? <0> bashusr: They weren't, prior to the existance of {} <3> ie. !!@#$%^*() <1> ok, i tried echo $fileInfo[0]; <1> and it returns "Array ( )" <3> omnipresence: dude. <0> omnipresence: You're going to have to explain what you're trying to do, and what part of it is not working. <7> bashusr: most special characters (anything with a byte value greater than 127) are allowed in php identifiers <0> omnipresence: And stop flailing around with random guesses like some trout that was just yanked out of the river. <1> $fileInfo contains ["name"]=> string(12) "inv_lock.gif" <3> et: how unconventional... <0> omnipresence: STOP. Take a deep breath, then explain what you're trying to do. <7> "$" is a valid variable name <3> omnipresence: better listen to TML... he can /kick you <7> (that space is \xA0) <3> et: how about !@#$%^? <7> bashusr: those are not. <0> bashusr: Only if you use {} <0> bashusr: php -r '${"!"}=1; var_dump(${"!"});' <1> ok, ive got a bunch of $_FILES... if the extension is an image extension i want to grab it and and get the file info from it <3> that's what i thought TML :) <0> omnipresence: When you say "the file info", what do you mean? <9> omnipresence: Don't rely on file extension. <1> $_FILES['userfile']['name'] <1> im using mime types <10> i want to learn php programming <3> omnipresence: not reliable either <3> J***i: pick up a book. <7> bashusr: that also means you can use UTF-8 encoding for your source, because all multibyte stuff is composed of bytes > 127 <0> !tell J***i about start over <0> omnipresence: And what do you want to do with this information, once you have it? <3> !tell me about start over <1> just echo it <1> then i can go from there <3> TML: ouch. <1> but ive been stuck at this point for 4 hours <1> i just want the size in a variable, the name in a variable, the filetype in a variable <0> bashusr: What do you mean "ouch"? <0> bashusr: That's the best way to learn PHP <1> i got a book today but it was a cheap one.... i didnt read it thoroughly enough in the store and its basically one huge script where all the guy does is write one long application in php/mysql then explain a tiny bit here and there <0> omnipresence: Start with this: foreach($_FILES as $file) { if ($file['type'] == "image/pjpeg") { $filetype = $file['type']; }} <3> TML: yeah i suppose so <3> i never read through the first 5 chapters yet :-P <0> omnipresence: Try that and tell me whether it's what you're trying to do <3> i've read most of the functions/declares though <0> omnipresence: Note that $_FILES can have multiple files in it. <1> i know... im looping through four files <0> omnipresence: So you probably don't want to store them in a scalar, because otherwise, once you leave the foreach() loop, you'll only have the last value available. <1> and ive got everything i want into an array, now i cant separate the values... this is what the array looks like: array(1) { ["name"]=> string(12) "inv_lock.gif" } array(1) { ["type"]=> string(9) "image/gif" } array(1) { ["tmp_name"]=> string(14) "/tmp/php0AgWTL" } array(1) { ["error"]=> int(0) } array(1) { ["size"]=> int(735) } <0> omnipresence: Don't build the array that way <11> ok, total newb question, what is the php equiv of the perl exp $myQuery =~ s/+/ /g; <3> TML: i don't think i could have read through the php manual when i first started php <0> omnipresence: Instead, do something like this: $fileInfo[] = array('name' => $file['name'], 'type' => $file['type'], ....) <0> omnipresence: Understand? <0> bashusr: Why not? <1> ok let me try that <1> thanks <9> slid3r: Replace all + occurence with space? <11> yes <9> slid3r: http://id.php.net/str_replace <11> thanks <11> I thought a regex MIGHT transcend <0> slid3r: Are the "+" signs coming from URL encoding? <11> yes <3> TML: Chapter 14-18 is where it gets hairy <0> slid3r: Then try urldecode() instead <3> Cl***es and Objects? <3> yikes! <0> bashusr: What do you mean "hairy"? <11> coming from $_SERVER['HTTP_REFERER'] <3> TML: i mean that i couldn't understand it <0> bashusr: I find that hard to believe. <1> now i have this: array(1) { [0]=> array(5) { ["name"]=> string(12) "inv_lock.gif" ["type"]=> string(9) "image/gif" ["size"]=> int(735) ["tmp"]=> string(14) "/tmp/phpj3xj6Y" ["error"]=> int(0) } } array(1) { [0]=> array(5) { ["name"]=> string(12)
Return to
#php or Go to some related
logs:
xgl + firedrops Gdk-ERROR **: GLXUnsupportedPrivateRequest SET_SESSION_USER cowsay's #gentoo #perl pivot_root failed, gentoo (masked by: missing keyword) openmosix #mysql #fedora
|
|