Hey Im making a php script that adds several hardware items into a database and if that hardware item already
Unless there isn’t anymore you can sort of “automate” through different logic.
For example, layouts.
um “later plan on doing something with content” uhh, yeah look at the bottom of that paste… i “do something with content” i echo it inside template.php
template.php would be considered a sort of ‘layout’
that paste is supposed to be two separate files as you can see by the HTML comments
You could just as easily stick the content into a separate file and include it rather that buffering it, can’t you?
ah okay, you’re already sort of doing that
uh, either way, even if i included it, i’d still have to buffer it to get the output into $content
Why?
Because of your $title and $s?
$rs
because of the way i’m using template.php
i call it the “decorator pattern”
it’s the opposite mechanism of including header and footer
I don’t do header and footer. I do layouts.
Your template.php would be an equivalent to what I call a layout.
well, i’ve heard it called the decorator pattern, though when i looked up “decorator” pattern on wikipedia it wasn’t really this
sure, so then i’ll call it layout.php, whatever makes you happy, point is in order for the “layout” method to work, i have to put the page’s template into a var called content
it doesn’t matter if i include() that page’s template or just put it inline, it still has to go through ob in order to accomplish the layout method
With your current pattern, yes it does.
like this
http://pastey.net/71330
anyway, if i wanna use the “layout” style pattern rather than the “include header & footer” style pattern, the only way i can think to do it is with output buffering
unless you can think of a different way
actually i just thought of a different way
No, using output buffering is the best way unless you like weird shit like making a separate request to your own host
anyone here done any Pear:OAP with NetSuite integration?
right, k that’s what i thought… some fool from russia was in here dissin me cuz i used output buffering
but he liked smarty, so… i guess that explains that
Anyone who LIKES or USES Smarty needs to burn in the firey pits of their religion’s corresponding hell
hahahaha
i know i tried to tell him that but he didn’t take it too well
That’s close enough
Who ever allowed smarty.php.net to be created should also burn.
anyway, i personally prefer the first style i pasted, the one with the page logic and the page template in the same file… reduces the amount of excess file management required in the project
I bet they thought it was a good idea at the time, and now they’re thinking “shit… i shouldn’t have started this project”
i *guess* i can understand breaking out the template into a separate file like in my second paste, i just prefer to have it all in the same file… i feel it’s more manageable that way
Well, your code is getting closer to the MVC pattern.
mostly based on the premise of avoiding: http://en.wikipedia.org/wiki/Yo-yo_problem
oh?
If you take out some of that stuff and do it from a controller, you’ve got an MVC based website.
yeah to me MVC is really more of an approach
i think the strict OO version of MVC is useless, i realized i’ve basically been doing “mvc” for quite a while, but most MVC purists wouldn’t call it such
Well, if your approach works great for you, the people maintaining your code, and your co-developers–then all is good.
DMBS = model, PHP = controller, embedded html host + layout = view
indeed, that is the goal
Right, but stuff like retrieving a result from a database, you’re doing from the view, but it’s damn close to the MVC approach.
okay flood control both server-side and cilent-side is implemented on my ajax chat
um… no not really… i’m retrieving the result in the controller
great success
i’m displaying the result in the view
in the view i’ve already got the result… $rs = result set
the view just cycles through said result set to display it
Oh okay, the file doing your title setting and database retreiving is your controller. I get it. Then it’s already an MVC application
yup
i just usually prefer to keep the controller and the view in the same file, that’s all
given that they’re so intertwined and i personally haven’t ever come across a need to use more than one different view for a given controller
It doesn’t matter in your case if it’s in the same file, as long as the code is separated.
There’s no rule saying that separating code dictates separate files (like most people think)
yah exactly, the code is very separate
hai
right
ok that gay moment has passed…
anyway
Now, time to head out to the electronics market to see what new cool shit is out on the market…
Maybe I’ll test out the Prada phone
lol Prada phone
get an openmoko
Prada phone sucks The Shine is nice ..some faults, but on the whole nice
I really want an iPhone, but there’s no telecom service for it in Korea yet… so I believe the Prada phone is the best I can get so far
http://openmoko.com/products-neo-advanced-00-develkit.html
screw the iPhone, get an openmoko
the openmoko was around before the iPhone was even announced
Wolfy[drawing]: So how are you doing?
?
i’m pretty sure the openmoko will work in Korea
fine, fine. You?
Wolfy[drawing]: Eh tired, had a long day at work.
http://openmoko.com/products-neo-advanced-00-develkit.html is like a personal cell phone assasin kit
I should be studiying myself, but — I am… Ummm… Busy
Wolfy[drawing]: studying yourself… is that code for masturbation?
*blinks*
anyone?
I think everyone blinks here serveral times a minute
If it works in Korea (the phone) then I’m sold.
AFAIK, the only way for it to work in Korea is if one of the telecom companies here provide service for it.
In the Prada’s case, LG Telecom provides service for the Prada (and it’s an LG product)
perhaps this is a mysql question
it’s a GSM phone so it should work basically everywhere
Wolfy[drawing]: Bad Wolfy, do I need to take your pencil away? xD
Try it. You’re not gonna like it.
GSM does not in 1 mile deep caves
I’ll look into it
hi, I am currently using phpbb…basicaly I want to be able to sent email notification for users for new posts. I was forwaded to this room can any one help please. thanks
no you weren’t. #phpbb, please.
yah dude, the iPhone sucks, you can *only* use it with ATT
apple? forcing proprietary usage compliance and vendor lock in? no! i don’t believe you!/sarcasm
i used to be a huge mac fanboi, now i think Apple is just as evil as MS if not more so
and i’ve started to think that maybe MS is not really as evil as everyone wants to believe they are
I still want a MacBook Pro
I don’t care about ipods / macs / iphone.
I’m also considering a PMP.. I want one with a large harddrive and long lasting battery life
Unforuntately, I can’t find one as good as the iPod.
PMP?
*Unfortunately
Wolfy[drawing]: Portable Media Player
PSP :3
Wolfy[drawing]: For example, I use my iPod to watch movies/anime and listen to music.
If I got a 80GB, that’s be nice.. lots of space for everything.
o.O
Currently I have a 30GB which is also great, but I’m almost out of space from all the music and anime.
My Palm has like 4 gigs
haha
But I want a PMP because of widescreen videos.
You may not know, but the iPod screen is horrible for widescreen
I don’t have any problems with that on my palm
Either a PSP or some other PMP… I need
The new Palm ish secksay
I never liked ‘em
Hello everyone. I have a file that is at http://pastebin.ca/633854 that sets parameters for a class function The class is at http://pastebin.ca/633854 . If someone can I’d like someone to check this out for me and
point out some flaws that might cause PHP to warn me tat it’s missing arguments.
Wolfy[drawing]: I’m gonna go to the electronics market to check out some PMP’s and get some new earphones. My friend is coming with me to pick up the PSP he ordered
how much is php web hosting there?
PHP? lol
You mean the PSP?
What sort of thing in php would produce an ‘undefined’ string?
I can’t believe I typed that. PSP, of course
Wolfy[drawing]: Google says: 320 000 South Korean won = 350.08 U.S. dollars
Im trying to fix up this horribly coded site and its doing something weird and telling the client to request something called undefined.
320 000 = 350? Crikey
Echoing something that isn’t defined
The PSP is only $250 or so if I bought it for him
$250 is the original price if you bought it in the states, no?
Wolfy[drawing]: I thought that would just echo nothing
Or was it $200..
0 to like tuesday july
Pricey
echoing / using undefined variables throws an error of level E_NOTICE
(unfortunately)
Wolfy[drawing]: The electronics market has a basement like place that sells copied games, gaming consoles and they also attach mod chips to your consoles. If he would’ve bought it from there he could’ve gotten it real cheap, but he didn’t because he has to pay of monthly bills on it since
he’s pretty broke right now.
copied games? Isn’t that… Illegal?
Yes
heh
Each game is 10,000 WON
“Pirated stuff 1st basement”
10 000 South Korean won = 10.94 U.S. dollars
anyone??
And there are deals like… buy 4 and get 1 free.
that’s almost as normal game
Wolfy[drawing]: No, normal games are $50+ -_-
For example, PlayStation 2 games are around $50 on average.
how do I absolutely reference an include file outside the web directory?
$50?!?
oh, for PSP
Wolfy[drawing]: Can’t you just download PSP games?
PRobably
There’s this really popular website called Ruliweb in Korea for downloading games for any gaming console.
heh
Most Koreans download and burn their games from there.
When you buy a Nintendo DS from the electronics market basement, they ask you if you want to change the default platform and if you would also like to purchase a disk containing 16 games included in it and if you would also like to purchase a set of 4 DVDs containing hundreds of NDS
games
Cool!
Of course, all illegal
of course
I might also check out the Apple store in the electronics market to see if the new MacBook Pros are in
Have you found a shop in Korea where you can buy MiniITX motherboards?
Hello everyone. I have a file that is at http://pastebin.ca/633854 that sets parameters for a class function The class is at http://pastebin.ca/633854 . If someone can I’d like someone to check this out for me and
point out some flaws that might cause PHP to warn me tat it’s missing arguments.
What’s the best way to remove a node in PHP 5 using DOM? is this function valid? DOMNode-removeChild()
They have MBP’s here. $2000 euros; about um… $3000
Wolfy[drawing]: You can probably easily obtain one from the plaza selling computer hardware. Just put in an order for it.
That plaza sells parts cheaper than newegg.com
I bought a Pentium 4 3.0E for about $50 or so
I believe Newegg’s price is $70-ish
The MiniITX stuff is pretty exotic :3
can anyone tell me how to absolutely reference a file outside the web directory?
Placing an order from Korea to Europe would be ridiculosely expensive
Wolfy[drawing]: Probably
Wolfy[drawing]: Korea is the heaven of electronics and hardware.
More precisely put, the electronics market is.
I’m looking for info ok reading FLV metadata with PHP. Can someone please point me towards a tutorial? I’m having a hell of a time finding something on the net…
Wolfy[drawing]: Anyways, time for me to head out to the electronics market and snoop around
you can’t. You can try to (ab) use ffmpeg to do that for you
okies. Laters
Maybe also check out some pirated DVDs along the subway paths
Wolfy[draw: I'm not trying to inject metadata, but just read it...
I'm using ffmpeg for the encoding
There's an flv tool for linux, find it.
I don't know if it works on Windows though
anyways, peace! :O
sure it does
one question.. work PHPNews with TinyMCE 2.1.1.1 ???
kuja is right. use flvtool2
try it and see
Yeah, FLVTool2 does the metadata injector, all I'm trying to do is grab the name of the video and length to pass to flash when we load the file
neither is a topic of ##php
!tell UserReg_CL about g10
ok thank
if I have a hierarchical site, where a page can have multiple children and a page could conceptually make sense in multiple parents, would it be better to be strict and force choosing one parent over the rest, or loose and allow multiple parents at the risk of possible redundancy?
yes, so? if you can inject metadata, you can also *READ* it
I just need PHP to read that metadata, much like reading ID3 tags for audio...
so you are saying to query FLVTool2, then respond that query to php hosting and deliver the data?
maybe
sorry to ask again, but can anyone tell me how to absolutely reference a file outside the web directory?
uh... What?
Hello everyone. I have a file that is at http://pastebin.ca/633854 that sets parameters for a class function The class is at http://pastebin.ca/633854 . If someone can I'd like someone to check this out for me and
point out some flaws that might cause PHP to warn me tat it's missing arguments.
!+g2
Guideline #2) Don't Repeat. If nobody answers your question, don't just repeat it; we all heard you the first time. more likely, nobody knows the answer (/msg php-bot ask), or you need to provide more information.
Wolfy[drawing]: sorry
! +g2
!+g2
:p
oh darn
lol
Well I didnt repeat in two consecutive things like a spam. So dont be pulling that bot stuff on me lol
lol
php-bot is made in python?
i ment
perl
Perl
thats unexpected
why?
Well you think it’d be in php
there is a reason, why PHP isn’t appropriate for bots
Meh
Well how come php.net doesnt have an irc server built in PHP? PHP CLI
you can do anything in php
I’ve done bots in PHP
PHP is perfectly capable
Not really my language of choice for an IRC bot though
So have I. But if you can make something in a language that wasn’t meant for that doesn’t mean it’s goot to use it for
Kernel modules?
Nah
Wolfy[drawing]
I disagree
PHP works perfectly for irc bots
you do? With which part?
therefore
you mean you “think” it does.
no
okay
maybe not that
PHP works fine
no, not really
it does
…
Why do you think it doesn’t?
whats the problem with writing a bot in php?
memory management
Oh?
plus the fact that PHP doesn’t do multithreading
Hmm.. php doesn’t have privary or public variable scopes for OOP model?
yeah
the multithreading thing I can agree with
perl’s multithreading is crap as well
pythons multithreading is great
and you can use http://uk2.php.net/declare to have functions running concurrently
Can someone please help me write a regular expression for PHP? I’ve searched on the site http://regexlib.com but cannot find the pattern I need. What I have is a list of email addresses, in the following format: “FirstnameLastname” email@email.com, “firstnamela
” email@address.com, email@address.com. I want to extract the email addresses as well as the name-strings.
first you neet to split the string
like this explode(‘,’,$string);
then iterate the resulting array
What if there is a comma in the firstname, though??
good question
now i was going to erm talk about that
really you need some kind of “*” *, regex
i was just waiting to see if you were going to notice that
does session_id() change with every referesh ?
nope
heh.
=P
what if this happen with me.
I believe it changes when they restart their browser, though
Hey, count(false); should return false or 0, right?
I can’t see how could ticks be connected to multithreading
i put session_start() in between ob_start() and ob_end_clean()
Wolfy[drawing]: declare does the job
if you want a function running while other code is running
ah wait, no, I rtfm again and it should return 1.
Actually; You’d want PCNTL_fork for that
Wolfy[drawing]: oh alright then
Does PHP5 support private/protected variables in Classes?
yes.
AzMoo[w]: Ah, that’s wonderful
somthing like ‘/”([\w\s]+)”\s*(\w+@\w+\.\w+),?/’
indeed it is! Check out http://www.php.net/oop5
i don’t see any wrong in my coding that rewrite the session_id which lets me get new session_id every refresh
OMG… implementation.. sweet
AzMoo[w]: One quick question: if I have a Calendar class and a MySQL class and I create an instance of mysql hosting class inside of Calender and assign it to $this-mysql. To acceess a variable with a special function inside of MySQL, would I then
run $var = $this-mysql-getResult() ?
so session_start() is called before anything is outputted to the browser i guess
yup
db would be a better variable name, alkos333, and using pdo or some standard interface for the db class (which could extend from mysqli) would allow a client that does not have mysql to swich easily
could it be that your browser is blocking the cookies or something
i called it in into body
no i’ve other application that not change the id every refresh
ooops, i moved session_start before any output, now it’s static, thanks
heh
np
fully implementing the mvc design pattern would be useful also, alkos333, however a quasi-implementation would suffice… i assume that is what you are doing, creating standard crud functions in a class using a private $db
ufully implementing the mvc design pattern would be useful also, alkos333, however a quasi-implementation would suffice… i assume that is what you are doing, creating standard crud functions in a class using a private hosting $db/u
Hold on a second, I’ll show you what I’m writing
The server is running PHP4, I’m gonna ask them to update – php5 is just too good not to take advantage of
What is the php regex equivalent of “?”
\?
This is the calendar I started working on: http://laptop0.alkos333.net/nsco/cal/
I was writing the code for PHP4, but looks like I’m gonna go with PHP5 and ask the hosting providor to update to PHP5 since they are very flexible.
Wolfy[drawing]: I mean the non-greedy …
perl
it’s like the optional +..
sorta…
_nixMan[Work]?…
yes i much prefer 5 alkos333
_nixMan[Work]: Evading ban I see…
you asked what is the php regex equivalent of right?
What’s PDO and what’s mysqli?
Wolfy[drawing]: who are you?
!+pdo
New in PHP 5.1, there is a little thing called PDO, the PHP Data Objects. This isn’t database abstraction layer (as many believe)… It’s more or less database function unification. If you want abstraction layer, take a look at ADODb or PEAR:B.
_nixMan[Work]: the one who banned your other IP
!+mysqli
Wolfy[drawing]: oh that fag because i said winblows… yeah good one
nah
mysqli == mysql improved. http://php.net/mysqli
mysql_* functions arent available in php5
… um, yes they are
Says who?
yes they are.
Hi everyone, how do i use a variable that contains two words in an sql statement
mysqli_* functions aren’t available in PHP4
what are you actually trying to do?
MySQL support is not enabled by default, what i what i meant
neither is mysqli
it’s not enabled by default ever afaik
it was in PHP4
oh ok then
not bundled with php5 either
I have a variable, $var, that contains 2 words, “Word1 Word2″, and I need to use quotes properly or something to get it to work in my WHERE clause of the sql statement
so many times i’ve takled to possible clients about how they hired some kid to program their site that used some framework and it’s all horrible and not working
so you would have to go out of your way to enable them
i dont take those jobs if they don’t agree to let me rewrite
um, yeah it is
nope
if you download the zip file it is indeed bundled with the mysql extension and the libmysql
yes they are
mysqli
So you have to enable it in php.ini?
sorry i go off what the manual tells me
if you’re on *nix then your distro’s repos better have php-mysql available or your distro sucks
the manual doesn’t say they aren’t enabled by default
does anyone know if microsoft is going to get more pushy with upgrading users to IE7 soon?
“MySQL is not enabled by default, nor is the MySQL library bundled with PHP”
that’s admirable, but it’s still better to go based on reality
http://uk.php.net/manual/en/ref.mysql.php
but the mysql library *is* bundled with PHP… i downloaded it just a few days ago
is that php5 and are those mysql or mysqli abstrakt?
Because of the change of license in MySQL 4.1, PHP excluded libmysqlclient. in PHP4 the libmysqlclient is still present
wait it does. my bad. i ment that it doesn’t say they aren’t included
all of the above
and i am getting an error message, is it O.K. to paste?
!tell yadayada about pastebin
no. Use pastebin
Ok
use mysqli
http://hashphp.org/pastebin?pid=24666
what is the SQL statment yadayada?
You have an *sql problem
wtf
it isnt a php problem
did someone kick me?
” this is a PG channel – pretend your 8yo niece is here, or get booted. “
haha
i think that was you before who got kicked for some violation of that, couldve been someone else
no it wasn’t that it was because of my away announcement
SO I ASK THEE WOLFPAWS
if ye be drawing, how can one be kicked by a man
or fox
wolf
such as yourself
but i’m also trying to find out how to stop announcing away in this chat
http://hashphp.org/pastebin?pid=24669
Then don”t do it at all?
“SELECT * FROM products WHERE ref=’”.$var.”‘ ORDER BY cost ASC”;
oops sorry
you dont need to concatenate
that really annoys me
i never concat anymore. since i figured out {} string syntax
silly pointless additions to code, like if($x == true) or echo “hello”.$user
I originally didn’t but i thought it would keep the two words together
With glob, if I’m searching for “foo.inc.php” within a valid directory and it’s not there, it should return an empty array, correct?
That kinda sucks, because you can’t do “blah{function()}blah”
i generally only concatenate when the variable is at the start or end, ‘/users/view/’.$id for example
orly? i thought that was the point?
no flowOver
Wolfy[drawing]: it’s part of x-chat aqua
” hello {$array['username']} “
it’s off for now but i want to see if i can set it to not announce in here or in another channel
should i try the {}
but everywhere else
?
if a variable is set, does it return true?
fucntions in {} work since 5
oh?
so says man
’s been a while since ive missed a feature
can I store an object in an session-var ?
heh i was confused because i always do function calls in strings wiht {}
i guess i should keep that in mind though with 4
How do i keep the two words together in the string?
echo “{ucfirst(‘hello’)}”; doesnt work?
no, it doesn’t work
i know, it was rhetorical
Well, I have PHP 5.2.1 and well… It doesn’t work.
i get the queries done but i dont get the times and the form did not dissapear
{} are for assoc. arrays and things like {$path}index.php
I prefer concat for that.
hmm i can’t recreate it locally on 5. maybe i was mistaken thinking it worked. man says “Note: Functions and method calls work since PHP 5.” and also below that says that {} takes more mem than concating.. which is opposite what i was told.
yes, i do too, but… thats what they’re for Wolfy[drawing]
i’m wondering now how accurate that second statement is, if the quote is wrong
which page flowOver?
php.net/string
looking at that already
hey Wolfy[drawing] darlin
php.net/string
hai, liggy
oops
Wolfy[drawing], pm?
I have resolved mine, thank you
Sure
so i can’t see how they mean functions and methods dont work with {} , yet tests are showing they don’t
is there some way to recode hex chars (e.g. %22) to ASCII?
and the man says they do
hexdec
function test() { return “foo”; } $foo = “test”; print “string{$foo()}”; works {test()} doesn’t.
interesting
i that what it means is you can use {} in dynamic function calls as of 5
${‘foo’} for instance
echo ${‘foo’}();
$t = ‘trim’;
$var = ” a “;
print “{$t($var)}”; — this works
no need for “” though Wolfy[drawing]
so perhaps {} is only useful when you dont need it
i want to control user so he can only insert 1 record within a week.. it’s about the week how it would be calculated.
actually, there *IS* a need for quotes
yea its not to clear on the point really. the note in the manpage about 5 led me to think that all function calls in { } would be parsed, but only dynamic function calls are parsed
oDesk, check the date and do the necessary math to check
i suppose the cases where i’ve used it where only ever dynamic function calls, i’ve never tested static function calls untill this day
no Wolfy[drawing], $t($var) works also
Care to try?
seems tricky
yes, i have Wolfy[drawing]
so did I
oDesk, how is math tricky?
trim returns a string. but we’re testing for what happens inside strings being parsed
print $t($var); works Wolfy[drawing]
yes but that misses the point of the test
but the test goes to show how redundant the ‘feature’ is
I didn’t mention $t($var), but “$t($var)”;
“$t($var)” won’t work
oh yes, i said, ” no need for “” though ” however Wolfy[drawing]
like, i’ll check if it’s Thursday, if so then will reduce 1 day interval then will check if there is record inserted in this time interval right ?
Are we dealing with strings or proper PHP here, ThinkMedical?
we’re testing how php parses variables inside strings.. so doing it properly isn’t a worry here, since its a test
im just making the oberservation that {} for a dynamic function in a string is still somewhat redundant as a feature
oDesk, get todays date, get the records date (assumes you wrote it when you inserted), add 7 days to the insert date and if it is greater – allow another insert
if todays date is greater
That doesn’t voids the fact that it works.
no.. and i never said i did… Wolfy[drawing]
nice idea
math ftw
ick. Math.
ew
math
nasty
ThinkMedical, *sigh* would have prefered exponentially
Wolfy[drawing]: personally i think that the man should clear that up. all it has on the subject is a note that can be interpreted a few different ways
uWolfy[drawing]: personally i think that the man should clear that up. all it has on the subject is a note that can be interpreted a few different ways/u
Like the “proper” way.
one would think it would parse “{ function() }” according to the note
spaces dont work in any instance
that translates to “proper”, floppypond.
ThinkMedical, oh – now I am like the artist formally known as Prince
haha
mybad. i always put spaces in to. then of course take them out. hah.
Hmm, anyone here know of any good image gallery scripts?
gallery2?
Wolfy[drawing]: Hmm, I heard that one was good. I’m going to intergrate a gallery system into PHPBB for my friend’s site.
ughh
yea use gallery2
I think there are already some hacks in that direction…
there’s a phpbb mod for it
Thanks Wolfy and flowOver
what licence is gal2?
http://www.phpbbhacks.com/download/1060
urgh fpl
GPL, IIRC
*gpl
Wolfy[drawing]: She wanted a way to easily update her gallery instead of manually uploading all the images and create a page for each of them, so I opted in to help. Also I’m really jealous of her art skills . http://www.gerbilfat.com/
gpl basically cuts your user base in half, or more
Anthros 3
Wolfy[drawing]: Yeap
Wolfy[drawing]: http://www.gerbilfat.com/gallery/railcolor.phtml
She can’t compare with http://jocarra.sheezyart.com tho :3
gallery 2 has a sweet shell tool
Hmm, is it easy to use? Gallery2 in general
yesh. But you need DB
relatively. once it’s setup for the person to use it, its got alot of features to ease things out
er, what? half user base due to gpl?
setting it up though…
well obviously anyone looking to… dare i utter such herasy… make money, can use gpl can they AzMoo[w]?
AzMoo[w]: it kills the possibility of commercial use
* cant
You can use GPL scrips for commercial use, but there are strings attached.
i’m not sure if that means she can’t charge for access to her site. i think it just means that she can’t sell the script at all
it depends how they’re making money. GPL doesn’t prevent you from using the scripts, it means that you can’t sell the scripts.
Hi
lol, yes AzMoo[w]
Is there any way to handle a fatel error
Wolfy[drawing]: Thats one amazing artist. o.o 3 Wolves
guess what most people who use gallery2 are.. coders AzMoo[w]
i will brbrb
AzMoo[w]: coders make money by ?
so provide it as a free “module”.
Because I think its dumb that trying to allocate memory thats not there causes a script to die
Yeah Wait… There is one more… *fetches link*
AzMoo[w]: you would only use it if you needed to, if you needed to the client wouldve asked for a gallery, that would be part of the site… having a gallery they dont have complete rights for wouldnt sit well with most clients asking for one
http://mixedcreature.sheezyart.com/ — She does mixed stuff, tho… Cartoons, realism,…
is there something wrong with if (!in_array({$key}, $exclude) && !preg_match(‘/ID$/i’, $key)) { array_push($thearray, $key); } ? this appears from within a foreach, im trying to push every value of $key to the array if it isn’t in $exclude and doesn’t end in ID
I think the fatel error out of memory should be managable in a try/catch block
Pffft. Lots of speculation in there. My experiences tell me otherwise.
so either the coder looses $100+ for gallery, AzMoo[w], or they dont…
anyone in charge of making php
AzMoo[w]: coder cant charge for gallery therefore less moeny for coder, it’s very simple
Post your requests on the internals ML, please.
and fair enough too. Coder didn’t code it.
AzMoo[w]: yes but anything they use it for has to be under gpl too
see linus’ rants for more info
Hmm
For some reason my ajax chat doesnt like £ and some other characters
Is there anyway I can make it support them?
unicode
yeah
Wolfy[drawing]: what is internals ML?
csc`: so um, how can I handle unicode characters?
lists.php.net
at0miku, beats me
oh :
:
with mb_string
okay cool thanks
3
Wolfy[drawing]: how do I use it? D:
the documentation is just telling me loads of crap
what can I use for debugging php-code?
a lot of echo and print_r
or var_dump
Wolfy[drawing]: Ahh wait nevermind I got it
Wolfy[drawing]: At some point I split the string, is this where it goes wrong? I need to use mb_split, right
?
Well lemme try
ahhh i found the line that explains the function behaviour. only when $ comes directly after { does it trigger the parsing syntax. so anyways. back to what started all of this. i brought up i dont concat anymore since i learned {} syntax. but apparantly it uses more memories than . syntax.. so
back to the old school ways
split the string how?
Well hang on
Hmm
hmm..I bet there is some good tools.
that’s easier than a lot of echo
I remember seeing a pop-up window containing all vars/values
http://atomiku.com/scripts/ajaxchat/chat.html
anyone know of something like that?
When I put “#” in the text, it doesnt seem to add it to the database
is posible import some class from external php file ?
i am a little confused, i just encountered a strange bug in my code which makes it look to me like the code “$_SESSION['a'] = “something else”; $a = “hello world”; echo $_SESSION['a'];” would echo ‘hello word’, is that possible?
atomiku – have you addressed people being able to edit the js on their client ? like polling more often
_Quintus_, what about $_SESSION['a'] = $a?
ÿ
no matter how many times I see “ajax chat”, it still makes me hurl
lol k
csc`, that is not in my code
csc`, my session variable and local variable are not supposed to be set unless someone logs in, but just putting any name in logs someone in even if their password is wrong.
http is not a chat protocol and isn’t designed for it at all
true
flowOver, what about https?
csc`, i fixed it by JUST changing my session variable from ‘a’ to ’session_a’
csc`, so it looks like somehow using the same name was a problem
csc`: And that is different from HTTP… how?
secured http
:p
is there a setting in php that will let you use local variables by the name X to represent super-globals by the same name?
csc`: yes, so?
yea thats still not made for a chat
even worse actually
its further away from what you need
SSL is used in some chats
Erm.. servers / rooms
its the ssl over http that haggars it
how so? IT’s just another layer.
opening an ssl connection incurs overhead. it’s only done once to open one secure connection with chats. with http its done every single request
opening an SSL sonnection on the modern machines shouldn’t be notiocable
yea but with http ajax chat polling the server every 2 seconds?
it’d be noitoicable
HTTP isn’t built for these kind of junk.
yup, and thats why https is even worse for ajax chat
than http
no, not really. It’s overkill, that’s given, but HTTPS connection is still unnoticable on the modern machines.
can text in an input field be filtered?
filtered how?
for a certain character combination
anyone here do Freelance ?
!+jobs
no job posting / asking for jobs on ##php (see /msg php-bot g7). You might want to check out: ##php.jobs http://www.geekfinder.com, http://www.monster.com, http://www.rentacoder.com or http://www.getacoder.com, or php.net/links, “Developers and Job Opportunities”.
yea 3 people have let me down so far
hi, all. I have a question, In version 4, I can use a class variable, like this $object[$variable_name].
its like people dont want money anymore
just to waste time
and I found I can’t use this in new version.
$object isn’t array
yes. wolfy
so?
your mean, I have to change my code. right?
right
ok
thanks
lol l3dx one sec bro
i dont want to get kicked but if anyone does freelance and wants some money please contact me
whats wrong with that btw
wrong with what?
5- (slacker403) i dont want to get kicked but if anyone does freelance and wants some money please contact
and i got kicked
yes you did. Go away.
its not like he’s spamming it left and right
it will likely happen again if you don’t drop the subject
wow
Dude clearly knows the rules and he broke them. Why not kick him?
ok ok
damn
its just these damn freelance sites are the worst places thought since its IRC there might be something or someone with some time on thier hands and that would be directly reachable
theres a rule against asking for freelance work?
jeeese
i agree
but um
if thats the rules… then I suppose ya gotta obey them
recruting in anyform shouldn’t be conducted here.
lol anyways
slacker403
pm me
Wolfy[drawing] you mean i can’t ask someone to do my homework for me?
rule 7.
funny
..and recruiting successfully completed
i was going through the courses i can take this september…
i have to be in third year to take the server side web programming course, but i have to take client side in january (seconds semester, second year)
i am very disappointed
programming classes in any form are boring
it’s only a 2 year diploma, and i don’t feel like completing the degree atm, since i kind of need to work off my debt
Wolfy[drawing] i agree, but with them i can say that i have the education (even if i sleep through the course and ace the tests)
hahahaha!
i really should look into a challenge exam of some sort
Something like http://wolfy.homeunix.org/projects/hts/bot.phps?
Wolfy[drawing] huh???
Is __construct called as soon as I do new Class; or can I do $class-var = 1; first?
What?
Something like http://wolfy.homeunix.org/projects/hts/bot.phps?
IT’s a solution for an anagram bot
i’m lost
Answer to “challenge exam”
lol
i have 2 scripts, one an html/form with 2 inputs which calls a php with a 4 minutes database process, the process ends ok but it goives no echo and the form page stays in the client
Are there any open source URL shortening scripts for PHP available?
what does Google say?
I was looking and most of the results are ads
And completely unrelated links
can php create compressed archives internally?
why don’t you make one of your own?
csc`: Sure, why not?
Wolfy[drawing], is it a function?
or do i have to do system(); or something
php.net/zip, php.net/gz and pear.php.net/file_archive
thanks
depending on circumstances I need to write to $item['description'], or $item['content']['encoded']; how do I write this as $item[$key]?
surely $item[$key] won’t get into the subarray?
should I eval?
o.O
Hey guys, I am trying to build a directory browsers that also lists the sub directories. Any suggestions on tutorials that work in php 4.6?
$key = “['content']['encoded']” ?
Mmmm, any idea why my server doesn’t allow me to use mkdir? I get the path with $_SERVER['DOCUMENT_ROOT'] and its always worked on every server I’ve tried it on, but just can’t seem to get it working on this new one..
Um. No.
is posible import some class from external php file and how to do it?
can you set an array and write the entire array into a file if you just use $foo instead of $foo[#]?
What’s wrong with using multi-dimensional arrays, anyways?
csc`: like var_export does?
eh
im stupid and dont know php extremely well :p
im trying to get a script to compress a wanted file into a .tar.gz archive, then send the user a link to the file
csc`: use file_archive. Anything else would be more or less waste of time
any idea why my server wouldn’t be allowing me to create a directory?
anyone know of a good directy browser that lists sub directories?
Make one yourself?
Sorry, I lost connection
MartinCleaver: so I want to generalize my code to allow
wolfy[drawing], I cannot get it to list the sub directories with out it listing all the files with in it =\
.
sure you can
What’s wrong with using multi-dimensional arrays, anyways?
wolfy[drawing]: i know it is posible, I just cannot figure out how easily
glob
so I would rather see a different method
glob?
php.net/glob
y, I answered, & I meant that I am not in control of when it is multi-dimensional
you could use glob; But in anycase you’d need recursion.
sometimes its deep in a nested key, other times it is not
whoops
okay
will look
ty
I’d apritiate if you’d type proper english.
Then fugure out how you put data in the array in a first place.
AzMoo[w]: what pattern is appropriate?
AzMoo[w]: wait, nevermind
I am handed the structure. I am not in control of it
!+recursion
http://www.zend.com/zend/art/recursion.php If you can’t understand that, you’re beyond help of ##php…
*, and use the GLOB_ONLYDIR flag
AzMoo[w]: I need to search for something without a period in it
i have 2 scripts, one an html/form with 2 inputs which calls a php with a 4 minutes database process, the process ends ok but it goives no echo and the form page stays in the client
All I can do is detect where the data is and use that location (i.e. in ['description'] or in ['content']['encoded'])
Wolfy[drawing] they have snet that to me 5 times and it still is jibberish.
Wolfy[drawing] okay fine, maybe not but it sounded good “beyond help”
Wolfy[drawing]: recursion is only needed if you want to view the entire tree though.
AzMoo[W] thank you
READ the page.
AzMoo[w] correct
any ideas why a server wouldn’t allow me to use mkdir?
mugger permision
AzMoo[w]: Am I missing something? I thought that was the point here.
do I have to worry about the permissions above the web root?
yes you do, php does not run as root
as in the entire path is something like /var/www/vhosts/domain.net/subdomains/subdomain/httpdocs/content/directory I want to create
you are in linux?
How would i secure a form that requires two hidden fields username and password, so that they are not right there in plain text for everyone to see ?
yeah linux
!+eval
If eval() is the answer, you’re almost certainly asking the wrong question. — Rasmus Lerdorf, BDFL of PHP
you lnow chown muger:muger the_folder
Wolfy[drawing]: seems that he just wants to list the first level sub-directories of a dir so that he can create links to them and drill down page by page.
chown muger:muger the_folder
chown is change owner
AzMoo[w] you are a smart (wo)man
this is linux commnad
ok, what does muger:muger mean?
group and user
apache_apache
apache:apache
try
what would I want to change it to?
Thanks :p (man)
mugger, that’s the syntaxis for chown linux’s command
it will be writable
AzMoo[w]: time to get the logic down here and I think i will be set. TY!
is there an array_* routine that allows me to pass in the structure pointer as a string? e.g. array_something($item, “['content']['encoded']“) ?
the folder
i have 2 scripts, one an html/form with 2 inputs which calls a php with a 4 minutes database process, the process ends ok but it goives no echo and the form page stays in the client
this is my problem. im going crazy
no
good luck!
http://rafb.net/p/b9UdET92.html i cut a lot of mysql bcoz they are working ok
I guess I have to use eval then
or intelect
?
what do you suggest?
Study the problem; Find solution.
Do you think I have studied the problem?
no.
no
anyone here know anything about Linux Vserver ?
what would you need to see to be convinced of that
#linux
?
Your conclusions.
linux verver openVZ etc ?
#linux
its not a part of linux really but yea hmmmmmmm
I. Don’t. Care. It’s not a part of ##php nor PHP either.
it hasa php lib
and that is it
idiot
wow
clam down dude
does it involve the phplib in it?
yah, wolfy, why be such an ass?
this channels behavior has already got it to ##php seems like it might be ###php soon
sigh
Anything that isn’t PHP does not belong in this channel. EOF.
i understand
Erm, I mean Null.
Take it to #phpc.
EOF? LOL!
What’s wrong with EOF?
Hey I’m making a php script that adds several hardware items into a database, and if that hardware item already exists it just doesn’t get added. I was planning on using mysqli’s multi query function and having the name of the hardware item be unique in the mysql table so that when the script
attemtps to add it if it’s a duplicate it just doesn’t make it. Is that an acceptable solution?
or is there something inherantly problematic in it that I can’t see?
Question about globals, which is better to use $GLOBALS['a']; or global $a; ?
both are bad
Wolfy[drawing]: alright, is this the register_globals problem?
Well being despised?
nope. register_globals is something completely different
Wolfy[drawing]: so how would I use an outside variable in a function for instance?
hi
register_globals makes Get / Post / Cookie keys visible in global scope… Like ?name=blah make $name containing’blah’
Pass it as parameter.
still there? not suer what I should be doing with chown
Wolfy[drawing]: oh okay. I’m just going through the php manual, a bit bored, and trying to figure out stuff I didn’t pay attention to or skipped.
AzMoo[w]: That function suggestion worked great! I have a full directory browser up and running now
Wolfy[drawing]: Thanks
chown changes the ownership of files/directories
http://swoolley.org/man.cgi/chown
I see.. I’m just not sure how this relates to php not being able to create directories via mkdir
nice one Glad I could help.
Well, if you run php as an apache module then it has the rights of the user apache runs as. On my debian server for example that would be the www-data user. In order for php to create a folder or file somewhere the user www-data must has write access there. So you could change the owner of the
directory to the user php uses
ahh, but I have no idea which user php uses
What’s your issue?
mkdir won’t create a directory, and as I’m sure you know the error it provides isn’t very helpful
Is there a way to check if my script is being run from a CLI?
anyone know how to secure/encrypt hidden form fields ?
I see. I suppose your have shell access on the server, right?
I know its correct, because I can’t even do something as simple as mkdir(‘folder’, 0755, true);.. I can paste that to any of my other servers and it works fine
yeah I do
What OS?
*distro
centos 4.4
You can try chown’ing the folder your want to write in to the apache user/group. chown apache:apache /path/to/the/folder
muggerthe the apache has no rite to write NOTHING on your folder
so, you must create a writable area for it
what is it called when you do things like function() or die();
what kind of structure is that or part?
die() is a function
yeah but what if I don’t want to just die and I want to do something else as well?
Do whatever you want to and then call die()
Hmm.. where would I ever use interfaces and abstract classes… and I can’t really understand the difference b/w the two
you’re a legend! chown apache:apache did it thanks a million
Nice :] You’re welcome
yeah but how does the syntax go function() or {blah blah blah die();} ? or what?
i have 2 scripts, one an html/form with 2 inputs which calls a php with a 4 minutes database process, the process ends ok but it goives no echo and the form page stays in the client
an abstract class is a class that *must* be extended. It cannot be instantiated on its own. An interface defines what a class implementing the interface must define.
Yeah, something like that. http://pastebin.ca/634020
You write a function and then call it from within your script
AzMoo[w]: Yeah, only interfaces in PHP suck
I could harldly tell the difference at first…
Java OO is way better so far..
luisgrin whats your timeout settings in php.ini ?
i dont know
have a look
gms thanksssssss
You mean like this? http://pastebin.ca/634021
gsm
yeah, it’s certainly not the best OO around, but it’s heaps better php4
im sure you must be rite
max_execution_time and max_input_time and possible memory_limit
http://pastebin.com/m5f9dbac1 — This is valid, isn’t it?
max exu is ok, problem is with one form who calls a php
can i pass variables to a php class?
if the php does not resolve…..
yes, they are arguments in the constructor.
if the php does not resolve in a TIME …. the form … ok the form can time out
AzMoo[w]: Yeah, that’s true.
but i dont know with paramenter must be
I must have misunderstood what you wanted. Like this: or die(mysql_error());
oh ok
Yeah I understand that part, but my problem is it nees to include a header file to finish off the layout as well as print the error and exit.
so I’m wondering if you can replace the or die() part with a different function or strucutre.
and in a way that stops mysqli from printing out it’s own error.
wait sorry I don’t understand
I believe you can put your own function after the ‘or’
I haven’t tried it myself so I’m not 100% sure.
“or die” means “if the function returns false then die”. Instead, test the return value of the mysql function and do your own processing as a result.
if you want to pass a variable into the class just put the names of the variables in the construct or function like __construct($arg1, $arg2) and then when you call the function new myclass($arg1, $arg2))
got it, thanks
AzMoo[w]: you mean like this? http://pastebin.ca/634028 because if I do it like that right now it’s throwing out TWO errors mysqli throws it’s own and then the one that I’m printing.
yes, like that. If you want to suppress mysql’s error put an @ in front of “new”
ahh I guess that would make sense…
Cool that works.
Of course it does
I would have never figured out that putting an @ in front of it would suppress the error on my own
Would anyone here happen to know why CURL doesn’t return special characters for other language sets like Japanese?
AzMoo[w]: can you do that in front of functions too?
i imagine because of character sets. unicode support in 6
sure can.
http://www.tilansia.com/babeltest.php Know anyway to fix it?
So I’m trying to write a DB class which would handle genereric database processing and a Calendar class which would have all of the necessary calendar methods. Would it be alright to create an instance of the DB class inside of a Calender class and use that instance to send/receive data from the
database?
GNS hi
http://au2.php.net/manual/en/language.operators.errorcontrol.php
I would separate them so that you can use the db abstraction layer for other projects in the future without it being coupled to the calendar.
AzMoo[w]: Ok, so that’s what I have right now – just two separate classes not connected at all.
http://pastebin.ca/634035 has the solution I used
AzMoo[w]: Then the question becomes, what’s the best way to link them together then?
ahh that’s what I’m looking for.
check out mbstring
i shy away from multi language dealings because well.. have you seen that page? ugh
good luck getting the characters going i suppose is all i can offer.
AzMoo[w]: You there?
hey, do you really need to ensure that all mysql results aren’t false?
hi,all
where can download websites source code(PHP)?
free.
Not exactly I mean if you don’t care that the mysql query failed then you don’t really need to check it do you?
For which website and what “free”?
Well, you don’t “HAVE TO” per se, but it’s a good practice. What if you have an error and your program attempts to do something it can’t do because the result is invalid?
well like, it would be nice to check it to gracefully fail, but what kind of things would make it fail? how often would that happen?
I m a student, I want learning the php language, so I want download some free source code samples.
true, but I was looking at drupal and joomla, and neither of them do any checking
Well I guess if it’s a really really simple query you won’t have a problem.
It’s a good design to check for errors wherever you can. That way you will detect them at the earliest stage and will know exactly what’s going on.
Use teh Google Luke.
Search for them. They are everywhere.
I tried it , but only search local info.
What do you mean?
hm, okay
thanks
Well like if it’s a simple INSERT INTO blah () values () there’s not much that users could send you that would cause that query to fail.
The amount of checks you do is obviously up to you.
and I could see how if you’re absolutely sure that line will never create an error, and it’s part of an intense application where you need every bit of performance boost you can get I could see you leaving out error checks.
well with luck this would be a commercial thing
only could search local country’s website ,cann’t search other country.
Just have to be reasonable – find an equalibrium
hm, okay
thanks
Then use the checkbox underneath the search box. Geez.
Then you certainly want as many checks as possible.
Don’t people ever read forms they submit?
yeah
but I find oss code to be top notch, so I got confused when I looked at drupal because of how good that code is supposed to be
Ahh, young and unsuspecting.
lol
in other words, that code isn’t that great?
Trust me, there is always room for improvement
Whenever you have more than a few people writing code for a project, things tend to get messy.
It’s like the second law of thermodynamics.
ahaha
a never ending proccess
okay
the code is never better than the program. Second law: every commit reduces the code quality.
if all our automobiles were made using the software development process,
one car would randomly blow up every few minutes
Crap, I’m on commit 347
heheh
rofl
Just when you thought you were done and decided to check your email… Baamm bug report
But that’s already true, isn’t it.
At least a drunk user can’t kill a random person with Microsoft Word.
DesktopBSD 1.6-RC3 is out! yay
guess who’s back. back again. joshie’s back. tell a friend.
can some one tell me how can i execute system command as nobody using php script i tried by system() but not working
a drunk user can’t make his car stuck in the middle of the road
hehe
Linux has a user “nobody”?
yes
sure does
Does it have “somebody” as well?
has anyone here done integration work with disk.com?
it can if you want
Here are some functions for command execution: http://gr2.php.net/exec
humm
I think that the command runs under the user php (or apache if php is a module) runs as. I’m not sure though :]
would work for me, but the shorthand wouldn’t?
Have any of you guys written a generic sql class to work with the databases?
K so I’m doing a mysqli multiquery where I expect some if not all of the queries to fail how can I create a while loop that goes through them? I think you would use while(mysqli-next_result()) but next_result() should also return false if that specific query failed right?
my debian box runs apache with the user “www-data”, but I have heard of it being run by “nobody” as well
yeah, you can turn off support for “” in the php.ini
not working
what command are you trying to run?
well i want to run apf command
which is firewall to block ip addresses from webpage
I would just run the queries one at a time…
ah, I see
ah, thanks… I just installed apache/php locally for the first time… it must be turned off by default
try something basic like ls for testing
okies
you are welcome… if you’re planning to distribute your code at all though, it’s a good idea not to use for the reason you just encountered
its working for ls
but not working for apf
thought it might. Does the user that’s running apache have +x on the apf bin?
yes
“/etc/apf/apf: line 35: /etc/apf/conf.apf: Permission denied”
i will be back brb
then give the user permission to /etc/apf/conf.apf?
hummm
yes! whiskey on the keyboard
when you are going through a foreach loop in an array with named fields how to you retrieve the name of the field you are currently in?
I’m currently trying to get my apache server to recognize I had installed php on my windows xp system. along with the load module and add type codes, I remember there was another code that was needed to allow windows to accept … something… does anyone remember what that code would
be?
$value)
$key)
Ch1ppy beat me to it
I win
can I pass a variable from a function within a class to another function wtihin the same class?
you mean like:
public function test($var) {
$this-yay($var);
}
??
hm
like i have a class and then a function and when i run it has paramaters, then when i run another function from that class i want to be able to access the paramaters.
of the first function that already ran.
oh
you can store them in the class…
you mean by changing the constructor
class Test {
private $var;
public function test1($passed) { $this-var = $passed; }
public function test2() { echo $his-var; }
}
hey all. im messing around with some xsl and xml, and I
‘m trying to teach myself as i go, but im having trouble dumping my vars (which are xml and xsl string)
and getting something useful to look at. so, i’m thinking about using file i/o to dump my vars and look at that way.
hows that sound?
oh ok thanks
you are welcome
By the way, thanks for helping out here but for future refrence, if you need to post more than three lines of code, use a paste bin Some mods/ops here can be strict about it.
I was actually thinking about that as I wrote it, but was lazy
Thanks for the heads up on the strictness though
or vardump will cause the browser to “half-render” my data, where obviously I just want to see the xml
Can’t you just look at the source?
no, it comes from an api call, so from the moment I have it, its in a var
Well, its that posting moree than three lines can flood the channel. So if people come i and see other people doing it, they might just start posting code as well. So it can cause a mess. Saw it happen before. This one guy tried to post about 50 lines of code.
ahahaha. alright, thanks
plus i need to add to add to the xml i get… so, dropping it in a file to verify im doing it right seems like the logical choice, right?
Why can’t the browser display the whole data?
or.. maybe that’s all the data return from the api?
*returned
because some of it is valid html and it tries to render it, so i’m asking if there is some way (i thought there must be) to make my browser be literal in displaying this string
Oh.. hmm
so um guys quick question
I want a download.php with a download counter. each downlaod is stored in msql database. I want it to get the URL, and set the header for it
so download.php?id=IDHERE is actually file.zip
htmlsentities and htmlspecialchars
thanks, gonna look into it
nvm I got it
I mean htmlentities. Note, these formats the html into browser safe text/entities
cool
You can also try using header to send a content type header saying the page is text and not html, but some browsers are buggy and don;t respect content-types *coughs*IE*coughs*
or header(“Content-Type: text/plain; charset=utf-8″);
before the var_dump
good to know, thanks
how was it I get the mime type again?
You’re faster
print(fread($file, 1024*8));
meh
I suppose so
open file, echo its contents
hey
I just dont know how to get a file’s mime type
or whatever it’s called
video/mpeg, etc…
You know whats great? The people at Microsoft decided it would be smart to enable their own mime type detecting by default and ignore anything the server sends. Thanks to this, it opens up a hole which makes IE one huge XSS flaw. Basicly you can make an image and embed html in the image in
the data fields and IE will process that HTML inside the image as real HTML.
So people could include javascript and all kind of things inside a website.
What is the companion function to htmlentites that is used for mysql queries called?
does anyone here know of a good random image generator for a site? i’m looking to set something up where a person can just click an image and have it randomly display another and so on and so forth
IE should be banned!
oh so is there a built in mime type thing?
So a simple avatar or sig image could send all the cokie data, ect to someone else.