logs archiveIRC Archive / Freenode / #php / 2006 / May / 31 / 1
Crell42
TML: A positive integer.
richardlynch
Crell42: There may be some cool stuff in the streams stuff where you can re-tie one stream to another and all that to do what you want... Not sure it's going to beat echo for speed, though. Are you really trying to solve a speed problem, or is this just playing with benchmarks.
Crell42
So it's writing something. To where, I don't know...
richardlynch: Eh, neither. Just trying something different. :-)
(Action) shrugs and goes back to his older formatter.
richardlynch
Crell42: Is this CGI/CLI/Module or shell or...
Crell42
Web app.
Jymmm
Davey: Yes, it's mine (just finished it yesterday), The hole is for a clock to fit into.
Crell42
Performance-wise, the SQL I'm doing is going to kill it long before this does.
Davey
Jymmm, very cool :D
Jymmm
Davey: thank you
         

richardlynch
Crell42: So you're mostly just having fun, eh? :-)
Jymmm
Davey the photo doesn't do it justice though. I'll have to setup lighting and take better pics.
Davey
Jymmm, I'm sure
Crell42
richardlynch: On company time, to bot!
boot!
Davey
anyhow, off home to see my MbP... uhm, I mean, wife. :)
Jymmm
lol
enygma
weenie
gymsmoke
i'm running a session in which the final stage is an email sent to the requestor, and, after the email is sent, i take them to a success page, which times out after 15 seconds and returns them to the main menu. at the end of that page, i call session_write_close(), sleep for a tic, then call session_unset() and session_destroy(). The problem is that the session file is still there with all of the data in it
is there a way to actually remove the file from the server's drive ?
richardlynch
gymsmoke: I believe the User Contributed Notes at http://php.net/session_destroy will have that.
novata_peleona
hi...
how can i receive from php to other value emtpy of checkbox??
richardlynch
novata_peleona: HTTP only transmits the boxes that are checked. Your application logic has to "know" what boxes were available, somehow.
Nomikos
add a hidden field with the same name and empty value to the form, that way the browser will still send the name, with value empty
novata_peleona
richardlynch, uffffff...
Matt
hey guys
novata_peleona
richardlynch, can you send a zero value??
Crell42
novata_peleona: Yes you can.
A common trick I use is to have all checkboxes be preceeded by a hidden value of the same name, value 0.
novata_peleona
echo "<td><input type='checkbox' name='permiso[]' ".$cheked." value='".$id_galeria."-".$user->id."'></td>";
Crell42
<input type="hidden" name="foo" value="0" /><input type="checkbox" name="foo" value="1" /> Check this
That way $_POST['foo'] will always be 0 or 1.
spiderr
richardlynch, any recollection of what the \n setting was called? i don't see anything that looks promising and spent quite a while trying to google it up.
mattmcc
That trick will work in PHP, but beware of trying it in other languages which may not consider request variable order to be important.
         

richardlynch
novata_peleona,Crell42: The only problem with that is that you are relying on the ORDER of the HTML/HTTP POST data to be preserved, and there's no guarantee in the spec that it will be...
Crell42
True, mattmcc. I'm not familiar with the way other languages handle array HTTP data or ordered values.
mattmcc
Although usually such languages will give you both values, not just one, so you can still check for the presence of a 1 value.
Crell42
richardlynch: Technically true, but in PHP it is in practice. I picked the idea up from Drupal, and it's never broken.
richardlynch
spiderr: I'm not even sure it's in httpd.conf instead of /etc/logger.conf or whatever... Sorry. I just ignored it and went on.
spiderr
k, thanks.
novata_peleona
Crell42, but with a array 'permiso[]' ho
richardlynch
Crell42: I'm suggesting that the BROWSER is allowed to re-arrange the POST data any way it likes, long before it gets to PHP. If IE, changes their order tomorrow, you're in trouble. And they can, if they want.
novata_peleona
Crell42, but with the array 'permiso[]' that would works???
Crell42
novata_peleona: I believe so. Let me check the code I use for generating checkbox arrays.
novata_peleona
Crell42, oks
richardlynch
novata_peleona: it would work if you use permis[0] and permiso[0] for the names.
s/permis/permiso/
novata_peleona
???
Crell42
novata_peleona: Let me pastebin, one sec.
richardlynch
novata_peleona: Use a hidden with NAME="permiso[0]" and then your checkbox with NAME="permiso[0]"
Crell42
http://pastebin.com/747797
What I get back then is an array either 0 values (none checked) or just the values from the checked checkboxes.
novata_peleona
Crell42, , richardlynch a lot of thx us
Crell42
Although the empty value could be handled by our input wrappers. I don't recall... :-)
novata_peleona
okissssss
:)
thirdLibr
is there a way to test if a string contains no characters
excluding spaces
Rick
Empty()
Frixon
empty() ist evil!
*is
richardlynch
thirdLibr: if (str_replace(" ", "", $string) === "") echo "Only spaces";
Rick
(Action) empties Frixon
Crell42
(Action) hands Frixon a cross.
Frixon
Rick: Do you think "0" is empty?
thirdLibr
cool
what's wrong with empty()?
Frixon
Read the manual and have a look what is seen as empty.
That just sucks.
richardlynch
The biggest thing wrong with empty() is that its definition changed from version to version...
CppIsWeird
can someone explain to me why this: http://papernapkin.org/pastebin/app/view/229 produces this: http://demos.medlinis.com/ when Demo 05, Dragons Fury, and Radical Site are all directories?
enygma
what's the function to break apart a URL into its sections
(Action) tries to remember
piera
enygma: thats hard for you
Frixon
richardlynch
enygma: parse_url
Frixon
The other one with "e"-
enygma
that's it
danke
Frixon
enygma: Have a look at the manual next time!
richardlynch
CppIsWeird: http://papernapkin.org/pastebin/app/view/230
CppIsWeird: You were looking in the script directory to decide what was or wasn't a directory...
CppIsWeird
ohhhh
what id i did a $file.realpath()?
LOL, first thats wrong syntax, and no, it didnt work
richardlynch
CppIsWeird: I think that only translates from DocumentRoot to real path...
dbruns
hey i know this isn't the right place to ask this, but i don't know where else to go and I know there are a lot of smart people here that can probably answer, with that said, Anyone know a channel I can go to to get some help with IIS / Cold Fusion server setup?
herrlich
i have a question concerning php-sockets
CppIsWeird
hmm... is there any way to get the absolute path when listing a directory like that or do i just have to manually keep track of it
herrlich
is there a way to receive data from to different sockets at the same time?
dbruns
dang proprietary crap languages/servers have no good community support at least nothing openly visible
richardlynch
CppIsWeird: http://php.net/pwd might do what you want.
herrlich: I think there might be something akin to stream_select in the socket stuff... Search http://php.net for it.
CppIsWeird
The PHP Data Objects (PDO) extension defines a lightweight, consistent interface for accessing databases in PHP
?
novata_peleona
Crell42, it fails.!
richardlynch
CppIsWeird: It's an attempt to let you switch from MySQL to PostgreSQL to Oracle painlessly, in theory...
novata_peleona
Crell42, it allways send the last value.
CppIsWeird
...
lmfao
kezz
trying to install phpticket and getting a undefined index error anything ring a bell that could be missing in my settings?
novata_peleona
<input type='hidden' name='permiso' value='".$id_galeria."-".$user->id."-0'>
<td><i
CppIsWeird
im baffeled how you got that out of what i asked, but thanks for the help anyways. :-D :-P
i asked about file handleing, getting the full path
herrlich
thx richardlynch i think 'socket_select' is what i was looking for
novata_peleona
richardlynch, as you told me, it send both values
gymsmoke
huh - this seemed to work pretty nicely
novata_peleona
*sends
richardlynch
kezz: We can't help you with installing phpticket, whatever that is... But it's probably bad software that they never checked with E_NOTICE turned on, and I'd avoid it, personally.
gymsmoke
session_write_close(); $sessFile = '/path/to/session/sess' . $_COOKIE[PHPSESSID]; unlink($sessFile);
Jymmm
!+g8
php-bot
Guideline #8) SQL Q's: #sql, #mysql or #postgresql. Apache Q's: #apache. Linux Q's: Either #yourdistro, #linuxhelp or #linpeople. HTML/CSS/JavaScript Q's: #web. Just because some other channel is 'dead' does NOT mean you can ask here.
Jymmm
!+g10
php-bot
Guideline #10) We don't support script(s). We help you *write* PHP, not recommend or download and install/hack/modify/adapt/use pre-written scripts
Crell42
novata_peleona: Hm, what?
novata_peleona
Crell42, as you told me,only sends the last value
Crell42
print_r($_POST);
It should give you a nested array.
novata_peleona
Crell42, http://pastebin.com/747843
Crell42, print_r($_GET) -->[permiso] => Array ( [0] => 1-3-1 ) )
Crell42, 1-2-1 is missing.
Crell42
Try making the hidden input not an array.
ks
hey guys, why I can't login from home ?
mattmcc
Because your home wants you to relax, rather than try to get work done.
novata_peleona
Crell42, if is not an array, it only sends the last value.if it is it sends all. 0 an 1
ks
i tried to restart my router and it changes ip
Nomikos
good thing my home doesn't do that, i work at home
ks
mattmcc :)
Crell42
hm.
One moment.
richardlynch
ks: http://dyndns.org/
novata_peleona
Crell42, will be necesary using javascripit?
ks
richardlynch i love this channel, but not that much
nife
why is this not a valid regular for preg_match ? /*\/*/
Crell42
novata_peleona: No. I know it can be done without.
Xyphoid
nife: * is a special char within a regex.
richardlynch
nife: * is special to PCRE, and \ is special to BOTH PHP and PCRE. You may want something like: '/\\*\\/\\*/'
sanity
is there a way to get the filename of the currently executing php file?
Crell42
sanity: __FILE__
sanity
Crell42: thanks :-)
Crell42
np
nife
yeah I realize * is a special char is matches anything I wanted that I wanted something that matches anythinghere/anythinghere
herrlich
sanity: $_SERVER['SCRIPT_FILENAME']
novata_peleona
Crell42, can you tell me how?
nife
how would I do that
richardlynch
nife: No. . matches ANY character. * just means "zero or more" of the precedign character.
nife
ahh thanks
sanity
herrlich: thanks - i think that is actually closer to what i need
« prev 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 30 31 32 33 34 next »