logs archiveIRC Archive / Freenode / #php / 2006 / February / 28 / 1
ShuaiKing
Hurrah! thanks!
kidzer
http://www.play.com/play247.asp?page=title&r=BOOK&title=660430&p=91&g=148&pa=sr does that look like a decent intro to OOP?
Arafangion
Damn I hate these "Are you sure that you want to exit the program?"
b1n0ry
kidzer: since the book deals with concepts and is not linguistically-spacific, i would say that it's probably a safe start.
Arafangion
(Action) navigates to the tiny 10x10 circle with "yes" in it.
b1n0ry
s/spacific/specific
kidzer
specific :)
myc
Arafangion: tab enter or enter usually fixes those effectively
kidzer
Cool, i'll see if I can get a hold of it then :)
         

olleolleolle
ShuaiKing: Going further, almost any sequence of output that evaluates to strings can be used in the same fashion as the $_POST array reference there. If you glue your output with the dots, you'll have a fine string to "do stuff with".
Arafangion
myc: Usually.
RedLizard
hi
ShuaiKing
Stupid question, how do you add 1 to something
RedLizard
does anyone know whether it is ok to use $this in a class constructor?
ShuaiKing
I have a really stupid line that doersn't work
b1n0ry
kidzer: programming is 90% concept and 10% language
olleolleolle
ShuaiKing: When you fumble around in the php.net manual text, you can see the "return type" of each function. $number++;
Dangermouse
$num++ or $num += 1 or $num = $num + 1
b1n0ry
ShuaiKing: either $variable = $variable + 1 OR $variable++
Arafangion
kidzer: Once you become somewhat language agnostic, you're already ahead of most uni students.
mattmcc
Indeed. They're learning to think in Java. :P
Arafangion
DAMN.
b1n0ry
kidzer: keep in mind that we're giving you advice to become a -real- programmer, -not- someone who knows how to write PHP
Arafangion
Man, I HATE WINDOWS.
olleolleolle
ShuaiKing: There are quite fine pages about these basic, groundwork stuff at php.net, and they walk you through this stuff, with examples really well.
ShuaiKing
Well, I'm using this http://pastebin.com/575651 code, it's not working.
b1n0ry
Arafangion: take it to #billgatesisgay
ShuaiKing: www.w3schools.com/php
kidzer
what does agnostic mean?
Arafangion
b1n0ry: Yes, I'm having to head off to uni, (late), so I shut down my laptop to take with me.
         

ShuaiKing
(Action) actually went into that channel. How lame.
Arafangion
b1n0ry: Turns out that windows wants to apply updates now.
Dangermouse
ShuaiKing: lol!
Arafangion
(Action) just switches it off.
mattmcc
Doesn't it give you the option not to?
ShuaiKing
Nope.
b1n0ry
i've had production servers that i come in and say "Windows has automatically updated your computer and required an automatic reboot..."
olleolleolle
ShuaiKing: The $result as a quite different structure. It is a "resource" (resource is its type).
BeeR
hi aal
ShuaiKing
So can I convert it or something to a number/string thing?
Arafangion
mattmcc: I was in a hurry, so didn't realise that the icon for power off had a shield in it, and didn't want to investigate what the shield means.
b1n0ry
kidzer: in this sense it means you understand enough of the concept to be able to apply it universally
Arafangion
mattmcc: (I use linux most of the time)
olleolleolle
ShuaiKing: Yep, that is its goal in life! It wants you to do stuff with it.
BeeR
I got a question ....howcome when I try to "display the output from my "FILE" input I get nothing
????
Arafangion
mattmcc: Cya :)
BeeR
echo "<br><br><h1><font color='black'>File is: ".$_POST['sfile']."</font></h1>"; <--- mycode
mattmcc
So there's nothing in $_POST['sfile'].
BeeR
and $_POST['sfile'] is from <input type="file" name="sfile">
kidzer
b1n0ry: cheers, apologies for my seeming lack of knowledge - im still in secondary school so not all that bright in the grand scheme of things
ShuaiKing
So, how would I go about converting it or somethign
mattmcc
Ah. You want $_FILES['sfile']
BeeR
but I press brows and choose a file... howcome?
mattmcc
Which is an array.
b1n0ry
BeeR: input type = file is a special case input type. it's not $_POST
mattmcc
BeeR: See http://php.net/features.file-upload
Dangermouse
b1n0ry
myc
can I foreach over public var's in an object?
Stormchaser
b1n0ry: ...
BeeR
I see so i should replace $_POST with $_FILES even though my form is POST?
b1n0ry
Stormchaser: dolt... i pulled it out of my favorites, lol
mattmcc
BeeR: PHP separates files into its own array, since it has more information than just a value to give you.
b1n0ry
BeeR: and not just $_FILES, specifically the subkey of $_FILES that you want
myc
Is it possible to iterate over an objects public var's?
BeeR
I see 1 sec
mattmcc
Temp name, type, size, relevant error, etc. Read the manual page.
BeeR
Hold ON
I don't want to upload anything
b1n0ry
BeeR: remember that when you post a file, you're getting binary data, a name, a size, a mime type. what do you want to output with your echo statement?
BeeR
I want to send it with my mail function
b1n0ry
BeeR: if you post with an input type=file you are already uploading something
BeeR
I mean along with my email
mattmcc
How do you plan on getting it off the client machine without uploading it? :)
b1n0ry
mattmcc: good question
BeeR
ummm tuffy
Dangermouse
love the silence
BeeR
what do you suggest?
b1n0ry
BeeR: uploading it
BeeR
but I don't want the server to get like 1000's of usless files that users upload
is there a way to manage this>
mattmcc
You don't have to keep them, of course.
But you need to at least have them long enough to turn around and send them.
BeeR
umm so is there a way to auto delete them?
mattmcc
Cron?
b1n0ry
BeeR: if you are accepting files from the user and sending them through your system, you get the files. but one of the parameters that $_FILES gives you is the temporary storage name/location of the file, so feel free to delete it when you're done with it.
BeeR
sorry i just never dealt with files in PHP
my first time
FenixRF
greetings
mattmcc
If you're receiving the upload and sending the message in one PHP instance, you can just use the temp file; it's removed by PHP automatically.
However, that may be error-prone.
BeeR
b1n0ry, tnx thats my clearer
FenixRF
is there a quick way of stripping all non alpha-numeric characters from a string?
mattmcc
The file may not upload successfully, the message may not be sent..
Kog
FenixRF: regex for [^[:alphanum:]]
BeeR
mattmcc: I see, so lets say I uploaded it
nowhow do i attache the file to may message?
b1n0ry
FenixRF: $newvar = preg_replace('/[^0-9a-f]/i','',$oldvar);
sorry, a-z, not a-f
BeeR
attach*
FenixRF
ok... I gotta learn regex :)
thanks b1n0ry
Kog
(Action) slaps FenixRF
mattmcc
BeeR: Compose a MIME e-mail. Probably using a tool like PEAR's Mail_Mime or similar.
FenixRF
yeah, I deserve it :)
b1n0ry
that's all single-quotes, btw
mattmcc
BeeR: Doing it by hand with mail(), while possible, would not be much fun.
b1n0ry
alright, i gotta get going. COB, so have a good one.
mattmcc
I'm in the mood for a 2lbs burrito.
(Action) checks for cash.
Hrm. And a stop by an ATM, apparently.
BeeR
mattmcc: what if Im using "PHPMAILER" class
enygma
mattmcc - get me one. you can mail it.
mfonda
mattmcc, pick me up one too
mattmcc
BeeR: I'm not familiar with that class.
enygma: Alright, but it might be a little cold.
enygma
pfft
BeeR
bro never mind I think I got what I need to do with MIME
tnx for the info tough
will start coding now
enygma
(Action) creates a "mailable microwave"
itrebal
(Action) creates a Difference engine
thin
why doesn't this work? $postdata = $formname[2]+"="+$id[0];
jrwr
how do i get php5 to work with apache2
on debain
absentia
I'm not sure what i'm doing with my php.. but my code is working the first time I run it. that scares me a bit.
itrebal
thin: what lang do you come from?
thin
itrebal: heh, i dunno, how do you add strings together in php? :P
itrebal
thin: . not +
thin
hmm
BeeR
mattmcc ok lets say that I got the upload function working and my files upload to "test" folder
how can I get the file that was uploaded?
absentia
(Action) just wrote an upload replacement in php... weee
thin
itrebal: weird, i get a space between the = and the $id (there shouldn't be any..)
ficusplanet
Hey everyone. I'm trying to install php5 from source with the --with-mysql option, but mysql_connect isn't callable after the install. I noticed that none of the modules in the modules folder are installed during make install. Do I have to do something to get the mysql extension installed?
||cw
BeeR: move_uploaded_file, just like the example says
Kog
(Action) mutters something about mcrypt
Jymmm
FliesLikeABrick FliesLikeALap : wth? lol
Kog
6·d,ZèH1ãã¯NP_gºÅÐael of a modern major general <- something seems a tad bit odd...
killer-instinct
how come when I generate a transparent Image with GD in Firefox, it loads transparent with no problems, but in internet explorer it doesnt
FliesLikeALap
Jymmm FliesLikeABrick is my main name and FliesLikeALap is me on my laptop
Jymmm
killer-instinct IE doens't support Alpha channel PNG's
mattmcc
BeeR: The location of the temp file where PHP put it is in the $_FILES array. The manual page details the structure of that array, and includes code examples.
Tresnar
killer-instinct: That's becuase IE6 doesn't support that feature
insin
killer-instinct: because IE doensn't do PNG transparency without hackage
Tresnar
(Action) grins at the echo.
killer-instinct
oh, what about GIF transparency
would that work?
Jymmm
tias
« 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 »