« first day (792 days earlier)      last day (4174 days later) » 

12:00 AM
@PeeHaa Winner. I could make it an injectable but honestly if it's not necessary I cba with the paperwork.
 
Let me login to check whether is indeed is doable
 
Anonymous
It is fine. Honestly, I believe everyone that has ever been in this room is better than I am, so thanks anyway
 
@PeeHaa actually another point - do you have/is it possible to get git on it? I'm thinking that it would be good to just have the repos cloned on the server for dynamic build purposes (this is all related to github.com/cv-pls/cv-pls/issues/47#issuecomment-11243198, not necessarily something that would happen in the immediate future)
 
Yeah. git is installed on it :)
 
@TheCOMPLETEPHPNewbie If only that were true... If you were to come back on Monday around 3pm GMT there would probably be at least two people around who could give you a reasonable opinion on the matter (actually there are a couple in here at the moment but I think they are AFK)
 
12:08 AM
zip and zlib are already on it. Tigerblood!
 
Anonymous
It's ok. I am celebrating about my solved problems for the moment
 
@TheCOMPLETEPHPNewbie What is a good idea? Using bcrypt?
If so, yes, using bcrypt is a good idea. But that phpmasters article won't help you in any way to implement it
 
@TheCOMPLETEPHPNewbie ^^ that's an opinion worth listening to
 
Properly using bcrypt is hard, so I would highly recommend against implementing something yourself. Rather use an existing library
 
:-D
 
Anonymous
12:12 AM
got a two weeks headache stackoverflow.com/questions/13808008/… solved today. best Christmas gift probably
 
@PeeHaa OK cool, 0.20 should just be static files anyway so don't break your back over it, it's just a couple of proof-of-concept things I've been messing about with this evening. The idea that's rolling round my head would take a lot of implementing.
 
Going to have to blog about bcrypt, and then spam posts like that...
 
@TheCOMPLETEPHPNewbie ^^ you'll notice the man you just handed out a smiley is the man who wrote the core password_* functions and the compat lib I linked you before. If you're going to listen to anyone on the matter, listen to him.
 
@DaveRandom That's ok. I have just cloned the backlog and thinking about how and what would be useful. Will report when I think of something :)
 
@ircmaxell I got a blog title for you "Seven ways to screw up a bcrypt implementation". (Seven should be about right, shouldn't it?)
 
12:16 AM
@PeeHaa For me, job #0 for the backlog is to get it to pick up delv-pls and stop auto-delv-ing every cv. Kind of necessary for compat with the previous discussions on how delv's on open questions are handled.
 
Anonymous
@DaveRandom You over estimate me. How am I suppose to follow up zeus of PHP. I am only mortal :) I will though. Even though I am newbie, I want to learn the advanced and recommended methods now, rather than later. Thanks
 
Nah, "Seven ways to screw up password storage"
 
@DaveRandom Agreed
 
@ircmaxell That's lame, because it's covered already very well. There are oh so many blog posts already telling you to use bcrypt ^^
 
Hmmm. Good point...
 
Anonymous
12:20 AM
Is bcrypt the most reliable way of encrypting passwords, that exists in the PHP world today, or should turn my head over others..
 
user895378
28 mins ago, by DaveRandom
@TheCOMPLETEPHPNewbie ircmaxell (one of the owners of this room) has strived long and hard to come up with a secure and simple API for this - those functions will be available as part of the PHP core from 5.5, he's written that compatibility lib because uptake of new PHP versions is... erm... not as fast as one might like.
 
Today, yes. There is a better one, but it is too new to rely upon and may prove not secure... And there is no php implantation
@nikic: I will write it up tomorrow, sitting in a theater waiting for the hobbit to start...
 
Anonymous
Well then: bcrypt... I will bthere :)
 
@ircmaxell I expect a review at the earliest possible moment. If I'm honest my hopes are not that great from what I've seen...
 
@ircmaxell You have a pretty high blog post througput ^^
 
12:24 AM
Lol
 
Anonymous
@ircmaxell you won't be disappointed.
 
Yeah, up to 78 posts so far... 510k unique post views...
Now, to think of 7 ways to screw it up. I can think of 4 off the top of my head...
 
1) getting the salt entropy 2) encoding the salt 3) checking for errors 4) fixed-time comparison 5) the right prefix
That's what I can think of right now
 
Oh, and the nexus 4 rocks...
 
There must be more
 
12:29 AM
right php verwion
Fixed time comparison is q nice to have, but not really a must...
OK, I am off to watch the movie. Later (and good night to the eastern folks)...
 
@ircmaxell night
 
Anonymous
good night
 
Anonymous
Why is this this PDO document does not show how to echo out parameterized queries? wiki.hashphp.org/… Just simple ones
 
@TheCOMPLETEPHPNewbie You mean you want to view the query after it has been constructed?
 
Anonymous
Yes! This one shows how to echo after making the query: for simple query i.e.

foreach($db->query('SELECT * FROM table') as $row) {
echo $row['field1'].' '.$row['field2']; //etc...
}


But this one does not show how to echo out the results

$stmt = $db->prepare("SELECT * FROM table WHERE id=? AND name=?");
$stmt->execute(array($id, $name));
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
 
Anonymous
12:41 AM
@DaveRandom ^^
 
foreach($rows as $row) {
  echo $row['field1'].' '.$row['field2']; //etc...
}
@TheCOMPLETEPHPNewbie ^^ just add that to the bottom
 
Anonymous
I did
 
fetchAll() returns a multidimensional array
 
Anonymous
oh wait...
 
Anonymous
I did the -> thing before, I will change it
 
Anonymous
12:45 AM
Did this:

function forwar_news($id){

$id = $id->prepare("SELECT * FROM clients WHERE update_id=? ");
$id->execute(array($id));
$rows = $id->fetchAll(PDO::FETCH_ASSOC);


foreach($rows as $row) {
echo $row['update_title'].' '.$row['update_content']; //etc...
}

}



and got this error:


Fatal error: Call to a member function prepare() on a non-object in C:\xampp\htdocs\....connection.php on line 77
 
Anonymous
and got this error

Fatal error: Call to a member function prepare() on a non-object in C:\xampp\htdocs\DI....connection.php on line 77
 
user895378
@DaveRandom What's the prescribed length of time to keep a cached DNS result? Two minutes? Or am I just making that up?
 
@rdlowrey That would be the whole point of a record's TTL ;-)
 
user895378
AMAZING!
 
lol
@TheCOMPLETEPHPNewbie What is the value of $id? You should be passing the database connection object and the id into the function ;-)
 
Anonymous
12:50 AM
$id is a $_GET['id']; It is set in another page.

As:

$id = $_GET['id'];

echo forwar_news($id);
 
Anonymous
 
Anonymous
@DaveRandom that should clear things up.
 
Anonymous
I am sure I am doing something silly somewhere
 
@TheCOMPLETEPHPNewbie No I guessed that much - the silly thing you are doing is calling ->prepare() on the value of $_GET['id']. You have to pass your PDO object into the function as well and call ->prepare() on that.
 
Anonymous
1:12 AM
Do I really have to include the entire db: connection code everytime I make a fucntion?
 
Anonymous
This for example:


try {
$conn = new PDO('mysql:host=localhost;dbname=aid-aid', 'root', 'test');
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch(PDOException $e) {
echo 'ERROR: ' . $e->getMessage();
}
 
@TheCOMPLETEPHPNewbie No you do it once and the top of your script and you pass $conn into the function
(sorry I got a bit distracted by something)
 
user1125394
how would you call a folder where there are ORM classes
 
user1125394
I've called it repositories so far
 
1:21 AM
@cyril Call it Bernard. Everybody likes a Bernard.
 
@cyril How would I call a folder? I'm not sure. I wasn't aware folders were callable.
 
user895378
@DaveRandom here's another random question that you may or may not have the answer for. Do you know any way to get the values needed to manually decrypt with openssl_decrypt on the results of a call to stream_socket_recvfrom from that used stream_socket_enable_crypto?
 
user895378
(I'm trying to support SSL over UDP)
 
user1125394
@LeviMorrison name if you prefer
 
	$quotes = Array("The spiffiest arcade of them all!", "THIS IS SPIFFY", "Spiffier than spiff :D", "Setting new standards in spiffyness since spiffyness.", "Why do schoolwork when you can be on Spiffy Arcade?", "\"Hello, procrastinators!\"", "Have to type an essay? Good, then you have an excuse to be on the computer.", "Study hall should be renamed to spiffy hall.");
	echo $quotes[array_rand($quotes)];
This won't be CPU intensive when being called on every single page the person views, right?
I know I could use JS, but my first preference is PHP.
 
1:27 AM
@rdlowrey I do not, neither do I know if it is even possible. That would be a question for @ircmaxell I guess. SSL/TLS is a bit of a black box to me.
 
OMG. Why is hostgator being soo picky. I keep getting that header() error
 
user1125394
Query, james Query
 
"Cannot modify header information - headers already sent by"
Is there anyway to ignore that error? I know 000webhost doesn't give me that error. After switching to host gator it does.
 
@Query Quit outputting data before calling header() then. It is not being picky, you are Doing It Wrong™.
 
What if I am using an include with a form in it.
If form data is not submit, it will redirect to ?errror=
It doesn't seem like I can fix it since the include is already outputting html?
 
1:32 AM
...well you are doing things in the wrong order then. You should check whether the form was submitted before you output anything. You shouldn't output anything at all until you are certain you have something useful to output.
 
@DaveRandom master
 
86
Q: Headers already sent by PHP

Moses89When running my script I get several errors looking like this: Warning: Cannot modify header information - headers already sent by (output started at /some/file.php:12) in /some/file.php on line 23 The lines mentioned in the error messages contain header() and setcookie() calls. What could...

 
I just don't get how this error is doing anything helpful.
God forbid you want to redirect someone after data is outputted...
 
Don't ignore errors or warnings. Fix them instead!
 
@Query You just don't have any idwa how the HTTP stuff works. And instead of thinking maybe I'm doing it wrong you think the technology is wrong
 
1:36 AM
But the free hosting didn't give an error and everything was just fine.
 
That's not a great asset if you are a developer
 
@NikiC as?
 
Ok so since php is compiled before html, then that is why this doesn't work? Still, I think it is stupid.
 
@Query Neh. You're stupid ;)
 
1:37 AM
@Query The other hosting service was hiding the error messages so it was not automatically displayed. But the error was certainly there too.
 
@PeeHaa That surely is a fat dupe innit?
 
It's just the way the protocol works
 
@Jocelyn But the functionality was there. So why does the error matter?
 
Thought maybe you had a dupe ready. Meh just going to close it as a dupe of the reference
 
@PeeHaa I added a dupe
 
1:39 AM
@Eugene I was messing around with it in your absence and I think the issue is that you need to use a file:// URL for a local repo, but even now I'm not certain, but I think I screwed up a couple of times. You'll need to remove the submodule completely and start again.
file:///C:/path/to/repo
 
@Query because that is how HTTP works. You can't alter data that has already been sent. Simple as that. Your previous host was presumably implementing output buffering.
 
@DaveRandom Thank you, that makes much more sense than previous statements. So it's not that the error was not there. It was just that the host was correcting my mistakes?
 
1:44 AM
@Query In essence, yes. You can work around the problem by implementing output buffering yourself - but it would be a much better idea to alter the way your app does things so that it doesn't output anything until there is something useful to output.
 
I think it is because I have a function that checks if user is logged in, if they are it echoes the user nav bar
 
@PeeHaa is a
 
that of course is (mistakenly?) called before any header function.
 
tidy('SO')
 
user895378
1:47 AM
Hopefully in the next couple of weeks I'll have some time to whore up the last few points to 10k so I can start assisting on the
 
@rdlowrey 'Bout time :)
 
user895378
It's a sad world when you don't have any time to rep-whore.
 
@Query Well you should just have it return a boolean, and later on echo the nav bar if the result of the function is true. But you need to not output anything before header(), including <html><head>
 
only 6152 points to go, then I can cast delvotes ;-)
 
@DaveRandom BUUUUUG!
 
1:49 AM
NOOOOOooooo......
 
@DaveRandom So how would someone detect if isset(userloggedin){header('')} if html was already displayed when loading the page? Or does this only apply to html within the php tags?
 
Go on then, hit me
 
Can you reproduce: enable [cv] sound notifications from here in the room
 
@PeeHaa Oh dear. I am unable to do so. It opens a new copy of the chat tab.
Schoolboy error
 
rookie mistake :)
 
1:50 AM
@Query all your questions are answered there. Just read.
 
@TheCOMPLETEPHPNewbie This room is for PHP chat. Anything PHP related is fair game.
However, we are less strict on regular users.
After all, they spend most their time here and collectively we benefit.
If they are off-topic here and there it is not a big deal.
 
@PeeHaa Proper rookie mistake. Usage of this in the wrong context :O
 
That is indeed a proper rookie mistake hehe
 
Really bloody stupid actually, I'm not sure how I missed that, there's a usage of the correct context of this on the next line...
 
Ok, looks like I've some improvements to implement. Thanks to everyone for their helpful comments.
 
1:54 AM
@Query You do that at the top of the page. There is no reason that you'd need to output the HTML before you make that check.
 
2:04 AM
@PeeHaa can you cv something?
 
OK winner
Fixed in dev
 
yay!
 
posted on December 16, 2012 by PHP Advent

No one knows if it was a man, or a woman, or a child that first did it, but we do know that about 40,000 years ago, someone put a faint red dot on the wall of a cave in Spain. Humankind has always felt a burning desire to record information and transmit it into the future. What that dot meant, no one really knows. Perhaps it was the first expression of binary? Perhaps it was just a dot. 7

 
It did occur to me actually - is there any browser we are targeting that doesn't support HTML5 audio? Wondering if the jPlayer stuff can be binned, not sure about support though.
 
2:08 AM
@DaveRandom I had implemented that for older chromes I think
 
...also , I am going to bed because I am still a bit ill and I have started to feel like crap in the last 10 mins or so.
 
later @DaveRandom best of luck with your recovery :)
 
@PeeHaa I'll run some proper tests tomorrow, but if it's an issue with Chrome 14 then update or GTFO. Will have to test FF support.
Nighty night
 
2:23 AM
I'm also going to coma. later all
 
Anonymous
@DaveRandom thanks for helping me out today.
 
3:15 AM
@DaveRandom Well in the middle of the navigation bar html I use that function. It then echoes out the div for the user UI. So I need to put it in the middle of the html <?php check user(); ?>
I've since enabled output buffering until I can find a solution.
 
 
1 hour later…
4:20 AM
yawn
 
4:53 AM
i posted a question but did not understand the answer to well
tried the answer but it did not work
any idea why?
 
@Sammy I might have a solution just a minute
 
ok cooll... i'll wait
 
@Sammy You know mysql_* is being deprecated, right?
 
no
i'm a newbee
 
Please, don't use mysql_* functions in new code. They are no longer maintained and are officially deprecated. See the red box? Learn about prepared statements instead, and use PDO or MySQLi - this article will help you decide which. If you choose PDO, here is a good tutorial.
 
5:07 AM
heh
 
i read it
don't really understand it
 
read it again. ... slowly.
 
@Sammy yeah this query is a headache.. I was thinking you could iterate through and keep track of which table is being queried.
 
in the meantime i just want the current query to work
 
@Sammy why do you have 4 different tables in the first place
all this data should be in a single table
 
5:09 AM
one fore each website section
 
then the single table will have a column called section denoting the section of the data
 
its too late to redo all the table and scripts
 
never repeat same data in different tables, it will lead to headaches like this
 
@Sammy omg really?
 
lol yeah
 
5:10 AM
its data is not the same exactly
the fields are
 
@Sammy oh yeah, i meant the data structure
 
@Sammy that's what columns are for?
 
it will be a big rewrite to deal with at this time
 
i doubt it will be a big rewrite if this is your query
but tedious
 
all i want for now is to add the table name to the query results
as mentioned in my post
 
5:13 AM
@Sammy Well, you can't
 
first test the query directly in mysql
 
Unless you alias all the fields
 
@Sammy the given answer looks correct
 
then why did the guy who answered the post state it can be done?
 
@Jack he wants which table the current row is from
 
5:14 AM
it tried it but the $row['table_name']; values are empty
 
@Sammy that's in php, try in a mysql client
 
im am using php
 
@andho oh dear god, I now realize the unions between the queries ... =(
 
you are using mysql with php
 
yes
 
5:16 AM
@Jack every seen a table for each User in the system. it happens :P
 
@sammy what part about mysql client did you not understand?
 
try the query in a mysql client
cannot help anymore without actual data
 
ok
thanks
 
@andho I have yet to see that, but these kind of constructs get people fired ;-)
@Sammy At this point I would seriously consider making four separate queries ... unless you have even more tables.
 
i do have more tables
 
5:19 AM
 
and more databases too
 
Or add the table number as a separate column in each table ... hmm, that would get weird too.
 
or, go back to learning, before implementing
 
yeah, or what @paul said :)
 
i guess it better to hire a sql programmer
 
5:20 AM
he would quit immediately hehe
kidding
 
just learning as i go
 
great .. then, consolidate all your (similar) tables into one =D
oh yay, i found gentoo in the massive linux distribution chart :)
 
 
1 hour later…
6:58 AM
My new flash game website is near completion :D
Decided instead of adding thousands of really crappy generic games that come in packs I'd rather add high quality ones.
Also if anyone's wondering the "Spiffier than spiff :D" text is something random that changes every time you refresh the page. Just meant to make the website more memorable.
 
@hakre I read on meta that you like to close questions, but what is wrong with copying the relevant parts? I personally hate it to follow dozens of redirects. — rekire 3 mins ago
lol
 
lol, such an idiot
 
holy closevotes batman
@hakre you're famous! Where's this post about you
 
@MikeB it was me first ...lol
 
8:23 AM
@MikeB yes I was repwhoring via asking questions on meta yesterday. works wonderfully.
 
second one is closed as dup as first post ... and both have 2delv
@hakre your idea of 75 and 100 cv/day is quite good ... i always feels 50 cv isnt good enough ... rather unlimited cv to user who have 40 or 50k rep will more effective
 
@NullPointer unlimited won't be good.
Lol, just got a "Trivial answer converted to comment "
 
8:40 AM
morning
 
morning
 
morning (9:42pm lol)
 
@ShaquinTrifonoff you live almost on the other side of the dirt ball .. its 10:45 am
 
9:27 AM
What's a good way to dynamically assign classes to HTML elements?
 
none, without appropriate context
 
@Rafay by keeping a list of classes.
 
9:45 AM
@Rafay Isn't it too low level for a class to be useful?
 
Morning
@NullPointer Holy crap, that guy is back - I thought he was banned for another few months...
 
morning
 
@DaveRandom rejoice!!
He was definitely banned till mid 2013
 
I thought so... Obviously he appealed. Well, if he can be nice to people I have no problem with that, I somehow doubt it though...
 
9:49 AM
@DaveRandom Grow some skin :) - He only got banned because someone complained (which itself was against the rules)
"This smart guy who knows what he's talking about called me a mean name"
 
:-P
 
However his answers since his unbanning are disturbingly friendly...
They got to him :'(
 
This is the post that got him banned meta.stackoverflow.com/questions/134581/… So he would have been banned through ~June 2013
 
11:03 AM
hi folks
Why does PHP suck so much?
Not trolling, having trouble w something.
 
Because it was designed as a simple tool to augment some pages (hypertext preprocessor) and it grown into big shit
Also, what trouble?
 
@yetihehe I'm trying to scrape and then parse a badly formed page.
 
... with badly formed language ;) <- here's your problem.
Actually when page is badly formed, you can't use standard functions, parsing code WILL be kludge (I know this from experience) and there are only two solutions:
1. Press keys until it works
2. Let someone other press the keys until it works.
 
hi
 
@Moshe have you considered using perl and HTML::Parser?
 
12:01 PM
mornign morning
 
@moshbear No because I don't know PERL. and the code is badly formed markup.
@Abhishek Sure, at what? My code or the site, or both?
@Abhishek If you're on GitHub, I'll throw you into my collaborators list.
 
The html :-)
 
@Abhishek Well, the site relies on a post request, so click through the forms:
 
Hi, I have a problem: http://pastebin.com/zKJewb3Q
How come value I want to check is seen as column name ? :/
 
Brooklyn College, Spring 2013, Show start/end date
 
12:09 PM
@DaveRandom yep. Got a hang of it already. Thanks.
 
that'll give you the same HTML as me.
 
@Moshe indeed the html is ugly
 
How do I get my webpage not to go back when they hit the back button and are logged out and how can I add a web page to be blocked like FACEBOOK has
 
@Abhishek yea, wanna see my code?
 
@Moshe HTML::Parser is designed to have bad markup thrown at it yet still work properly. Also, s/using/learning/ . CPAN is your friend.
 
12:14 PM
@Moshe sure :-)
 
@moshbear CPAN?
 
Like I don't want someone going to the url of the "index" page before they have signed up as a member they need to make an account first then they can have access to the "index" page
 
@moshbear yeap HTML::Parser is good
 
Comprehensive Perl Archive Network. It's a standard repository of perl modules that make Boost look tiny. You use $(which cpan) to download and install modules as need.
 
@Moshe how good are you at JavaScript ?
 
12:17 PM
@Abhishek I'm not experienced with it, but I'm experienced with other languages. Why?
@Abhishek My code power.php is the main file.
 
28 messages moved from Lounge<C++>
Guys, I moved some PHP troubleshooting here (why it unfolded in the C++ lounge I have no idea). Hope I did not disturb normal functioning of this room. :)
 
morning
and morning @R.MartinhoFernandes
 
Good Morning :-)
 
@Abhishek @Moshe In PHP you would parse invalid HTML using DomDocument
 
@NikiC his HTML doesnt looks invalid to me
very - ugly though!
 
12:26 PM
@NikiC Well, it's past 13, so morning is kind of gone now :) Which reminds me I need to be somewhere else in the afternoon. Later.
 
In particular see the loadHTML and loadHTMLFile methods
@R.MartinhoFernandes Yeah, well, I stood up late today, so it's still morning for me :D
@Abhishek Didn't look at the HTML. But DomDocument should work for pretty much everything ^^
 
true. DomDocument is a cake! you must have a bite if u are trying to parse html server side
 
@user1867842 Please use correct punctuation. A question should be followed with a question mark (?). Paragraphs should be used to break what you are asking into logical ideas. Just glancing at your question I don't want to read it because of these things.
@user1867842 Also, there are lots of tutorials on the web. Maybe you should have done some more research before asking that question, so that everyone would benefit from it more.
 
I have looked on this kind of thing the only thing I saw is .htaccess . But i'm not sure that is what i'm asking about.
 
12:31 PM
@NikiC here is his existing code though mosheberman.com/lightbulb/lightbulb.zip
 
@user1867842 please do not spam here
 
I'm not spamming.
 
Especially a wall-of-text question like that.
 
good morning @NikiC
 
@user1867842 You have asked it like 14 minutes ago; give the other users on the site time to reply.
 
12:55 PM
Morning people
 
user1125394
need that setup at work
 
user1125394
 
user1125394
4 x 22"
 

« first day (792 days earlier)      last day (4174 days later) »