« first day (1286 days earlier)      last day (3888 days later) » 

19:00
well... at the moment, I can't use because it's a framework (OLD) that I'm working on ... =(
What framework is it?
@Charles "homemade" kind >.<
Custom made.
Oh. I'm so sorry.
Homemade is cuter
@Charles T_T
19:05
@MichelAyres are you using mysql_* API ?
PDO: $this->database->exec("SELECT * FROM tbl WHERE name LIKE '%\\\'test\\\'\\\'re%'");
But the problem is, the query is formatted using a big_query_string
@TOOTSKI sexy
That's the guy asking?
$big_query_string = "SELECT ";
$big_query_string .= $a.','$b;
$big_query_string .= " FROM tbl WHERE true";
if(true)
$big_query_string .= "AND col = ".$c;
> There should be more articles about it. I have tried using it several and ended up disappointed. I either overlook something or it is a stripped down version of xdebug.
19:11
@MichelAyres you are not making any sense
He was bitchin' here because we closed his questions. (poor ones)
can you show the relevant fragment of code? preferably with 10 line before that query and 10 like after it ?
@tereško Ok, ok, now you're too nice.
I still have some beer left
$array = $_SESSION;

$array["key"] = "value"; Will it set a session? or I need to use the session array?
19:13
@TOOTSKI I saw that ... what am I supposed to say to that ... "yeah it is ... also php is a stripped down version of java, and the vagina a stripped down version of a penis" ...
@user3123545 it will fail
@JoeWatkins Ping him here, he often comes to argue.
Nothing to reply really.
A bit of ignorant if you ask me.
$Query = "SELECT SQL_CALC_FOUND_ROWS ".$fields." FROM ".$this->config->QueryFrom."
".$Where."
".$Order."
".$Limit;
$this->App->database->query($Query)->fetchAll( PDO::FETCH_OBJ );
well ... it looks like you are already using PDO
19:15
More close candidates of the same author.
so, why are you not using prepare statements ? @MichelAyres
ask me a sensible question and get a sensible answer ...
@tereško What if I pass $_SESSION to a method, and the method does $passedses["key"] = "value"; will it set the session?
@tereško Yes, I'm.
@MichelAyres Read up on pdo::prepare
19:16
@user3123545 it won't work that way.
@tereško The code was there when I get it... I'm trying to improve it in a way that I don't need to rebuild half of the code
Something like
$stmt = $dbh->prepare("INSERT INTO REGISTRY (name, value) VALUES (?, ?)");
$stmt->bindParam(1, $name);
$stmt->bindParam(2, $value);
@user3123545 but you can do: $foo = $_SESSION; $foo['bar'] = 'lorem ipsum'; $_SESSION = $foo;
30
Q: PDO support for multiple queries (PDO_MYSQL, PDO_MYSQLND)

Gajus KuizinasI do know that PDO does not support multiple queries getting executed in one statement. I've been Googleing and found few posts talking about PDO_MYSQL and PDO_MYSQLND. PDO_MySQL is a more dangerous application than any other traditional MySQL applications. Traditional MySQL allows only...

What the f*? Who reverted this?
@TOOTSKI tks going to read it
Oct 13 '13 at 12:27, by tereško
http://stackoverflow.com/questions/6346674/pdo-support-for-multiple-queries-pdo-mysql-pdo-mysqlnd
Apr 21 at 10:26, by tereško
http://stackoverflow.com/questions/6346674/pdo-support-for-multiple-queries-pdo-‌​mysql-pdo-mysqlnd reason: answer advises use of harmful practices
@MichelAyres No, DON'T, it's not related to your question :)
Here we go again.
> You voted to close this question Oct 13 '13 at 12:28
19:19
@bwoebi why the FUCK you reopened stackoverflow.com/questions/6346674/… ?
Great.
@TOOTSKI ROFL!
same goes for you, @YourCommonSense, why the fuck you reopend an actively harmful post ?!? stackoverflow.com/questions/6346674/…
1
A: SQL injection that gets around mysql_real_escape_string()

eggyal In homage to @ircmaxell's excellent answer (really, this is supposed to be flattery and not plagiarism!): There is another, far less obscure EDGE CASE!!! I will follow the format of his answer. The Attack Starting off with a demonstration... mysql_query('SET SQL_MODE="NO_BACKSLASH_ESCAPES"...

3
stackoverflow.com/questions/6346674/… ... with fire (contains harmful, highly upvoted answer)
@ircmaxell is he right?
(I don't have an environment where to test it)
19:24
How do I protect my website from spammers
@JoshC. spam -protection depends on the available resources: theregister.co.uk/2005/07/26/russian_spammer_killed
0
Q: current week contains the last friday of the month

Joseph GregoryI am trying creating a script that will change an image on a page if the last friday in the month is during the current week. For example if I am on any of the day of week (Monday to Sunday) that contains the last friday of the month during the week I will get an output that differs from the rest...

Just to make sure. Using PDO without using Prepared Statements (besides being a not good practice) doesn't save you from SQL Injections and others security issues. Right?!
^^ Am I being blind, or is the OP really over-thinking the problem?..
@tereško Yup
19:25
I wouldn't mind that one
Yeah I got no chance of learning how to do that anytime soon, but thank you - not because of lack of trying its just hard! — Joseph Gregory 23 mins ago
@MichelAyres $pdo->prepare('SELECT * FROM whatever WHERE id = ' .$_GET['id']);
.. do I really need to elaborate ?
I mean like against bots
@JoshC. simplest way is to not use standard names for inputs
@tereško I know how to do that. >.< Just asking if it's non-sense use PDO without the prepare (Something like: $pdo->exec(SELECT * FROM whatever WHERE id = ' .$_GET['id'])).
19:28
@JoshC. next step is adding hidden honey-pot fields, which bot will try to fill but normal users will not: <input style="display:none" type="text" name="email">
@tereško because deleting questions because the answer is bad is not a good thing. Delete the answer instead. and Put your own better answer there. Or just improve the answer.
@bwoebi can you delete the answer ?
@salathe Wrong, wrong, wrong, wrong, wrong, wrong, wrong, wrong... wrong.
@bwoebi can you radically change the answer ?
19:29
@salathe YES!
@ircmaxell Thanks, buddy. :)
well ... i have a suggestion:
dear room 11 regulars, please add "The code in this answer is bad, and promotes some very harmful practices. Do not use it." comment to stackoverflow.com/a/6461110/727208 . There is a slight hope that future visitors of this post might notice the warning.
@tereško can you explain what those bad practices are?
// works not with the following set to 0. You can comment this line as 1 is default
$db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 1)
because as I see it, there's no explanation of why, hence no way to improve it, hence no way for people to know if it's "harmful" and why
@tereško then say it in a comment
19:35
@tereško well, you can. In small steps. And as we have >2k nobody reviews it.... (usually)
The code in this answer is bad, and promotes some very harmful practices (use of emulation for prepares statements, which make code open to SQL injection vulnerability). Do not use it. — tereško 4 mins ago
@tereško improve it. If your improvement then is not accepted, feel free to delete it.
$today = date('j');
$last_friday_in_month = date('j', strtotime('last Friday of this month'));

if ($today === $last_friday_in_month) {
  # victory dance
}
@salathe ^ is this the question?
I can't understand it.
@TOOTSKI No, he wants a victory dance for any day where the friday of that week (monday through sunday) is the last friday of a month. AFAIK.
May has 5 Fridays, he said it's not working, not sure.
CBA.
I assume it's not a complex thing.
19:46
42
A: PDO support for multiple queries (PDO_MYSQL, PDO_MYSQLND)

Sam DarkWARNING The answer below may open up significant security vulnerabilities. Enabling emulated prepared statements is not something that should be taken lightly as can be seen in this answer and in this one. Enable emulated prepares at your own risk: As I know, PDO_MYSQLND replaced PDO_MYSQL in...

heh ... let's see how long it sticks there
@TOOTSKI I think his "not working" is probably "I'm too dumb to write codes". It's not a complex question at all, assuming I'm reading it correctly. *shrug*
@salathe Yeah, he said that control structures are hard.
@TOOTSKI God dammit, they are!
19:49
@SecondRikudo I can't even throw close vote. Need a fresh batch of votes.
@TOOTSKI You already voted to close this question, you can't vote on it anyway.
Who unpinned?
@SecondRikudo why are you trying to close it?
It's a valid question
@SecondRikudo Yeah, we need more people that is :)
Unless @ircmaxell sabotages :P
Yeah, OK, leave it.
We've closed for less :P
if there was a DUP, I'd close it against it
but this is actually a question that's not really covered in docs, and not obvious
@ircmaxell Hardly. No attempted solution, no clear indication of a problem. "How do I do this thing?" is basically the question.
19:50
Ow no sorry I was being an idiot in testing I still used DateTime('last Friday of this month'); for testing in May!! Sorry, you and your code rocks! — Joseph Gregory 38 secs ago
the answer leaves a lot to be desired. But the question itself isn't bad
@salathe LOL, gratz.
Not to mention that the answer is harmful.
@SecondRikudo yes, where a google won't turn up the answer
@SecondRikudo overstatement of the century
19:51
@ircmaxell if you look at his questions, you'll see that they're sort of "SEO"...
@SecondRikudo then close as a dup of one of them
@ircmaxell Probably less now with your sticky note on it.
but closing as off topic, is... well... eih
@SecondRikudo even without it
Most of them are even crappier
don't forget, emulated prepares are turned on by default. Turning them back on isn't the massive issue that you're making it out to be. It is an issue, and should be advised against, but it's not OMG, HE'S EVALING YOUR CODE AND SENDING IT BACK WITH A ROOTKIT
19:53
@TOOTSKI oh awesome, that made me cross 25k :D
salathe, Edinburgh, United Kingdom
25k 3 40 67
@ircmaxell I don't think that the bug described in my answer is realistically relevant to emulated prepared statements: as I state under "The Saving Grace", PDO prepared statement emulation uses PDO::quote() which wraps the quoted literal in single-quote characters and thus will be safe (absent a change of SQL mode between statement preparation and execution).
@salathe You're the best.
So, room 11 is scared to death by emulated prepares, if I get it right?
sigh, whatever, leave it be then.
GoT bad Lip Reading
19:55
@YourCommonSense seems so
@YourCommonSense Room 11 should find something actually scary to be scared to death of!…
@eggyal fair enough, will edit it out. Thanks!
come on. it's 5.5 now. why pull old scaring tales into brave new world?
@YourCommonSense: I'm still pondering over the questions you raised earlier today on GitHub - will get back to you once I've had a chance to think some more. Have a tight deadline for Monday though, so really need to focus on other things until then.
@YourCommonSense 5.6
19:57
@Jimbo consider it a boost towards the 20k which is now your goal.
@eggyal I'll be very grateful
@ircmaxell honestly, you are alarming like Shiflett back in '05
but it's not '05 today.
and I wish I have seen at least one real injection performed through such a widely used GBK
@ircmaxell Oh good, I'm glad I'm not the only one that remembered that. This is a mountain/molehill thing. With emulation on by default everyone's always hypothetically slightly more unsafe than they would be otherwise. Wheeee!
@Charles yeah, i think it's worth pointing out that it's not perfectly safe 100% of the time, but not worth going apeshit over
I'm more angry that someone turned on multi-query in mysqlnd by default... used to have to go out of your want to trigger that level of insanity.
yeah, but I can see why people do it
20:05
oh yeah, it's hella convenient. We use it in our database schema update tool...
well, we kinda try to, it operates on a hacky regex that finds semicolons...
it's you guys rather scaring me. In fact, you can nuke any answer back on SO.
but community-based moderation is one thing and mafia-based is another
@YourCommonSense Closevote ring has its advantages and disadvantages.
I'd rather close 105% than leave 50% open.
close 105% is okay, deleting them is not I think.
20:10
@bwoebi Agreed.
Hence my suggestion to disable the ability to delete unanswered closed questions regardless of score.
If OP doesn't fix it, it'll be auto deleted by the system anyway.
However people don't like their privileges taken from them, so it got downvoted to oblivion
@SecondRikudo that's not why it got downvoted
@ircmaxell Why do you think it got downvoted then?
because it's not a good idea. It harms new users, as they get questions deleted out from under them without the chance to even learn why the question wasn't ideal
20:16
@ircmaxell Are we talking about the same suggestion?
Morniong
The one that forces the question to remain undeleted for at least 9 days after which it is automatically deleted just like it is today?
@YourCommonSense , you are sos scared, take a look at the backlog: php.cv-pls.com/?chatroom , that should give you some deeper insight in the state in this site
Oh, disable the ability to delete... misread that
-21
Q: Disable deletion ability for 20k users for unanswered closed questions

Second RikudoBackground Current deletion rules indicate that a 20k user can vote to delete a question instantly if it's scored -3 or less, or if it's 2(?) days or older. Problems It's really not that difficult for a question to reach -3. It really isn't. 2 days later, it's very likely that the question wi...

20:18
I am not on cv's but, as @bwoebi said, on deletions
If I have one array (1, 2, 4) which directly corresponds to another array (basketball, football, tennis, swimming), then how would I create a new array that matches the three activities and lists their name instead of their id# (for example, [1,2,4] -> [basketball,football,swimming])
@YourCommonSense why shouldn't this be deleted ? stackoverflow.com/questions/23278270/…
And btw. @tereško reopening is nice for preventing deletion.
or better, why shouldn't this be deleted ? stackoverflow.com/questions/10275201/…
@tereško Because it can still be fixed.
@tereško Because it has a decent-ish answer.
20:22
Framework questions never can be fixed.
It should still be closed, mind you.
But not deleted.
In reality, there's very little need for 10~20k users actually deleting something.
11
Q: CakePHP vs codeigniter - I'm experienced in CakePHP

Ciprian MocanuFirst of all I don't mind the "writing more code" attitude that CI has so I don't really care about that. Right now I'm pretty good in CakePHP (I have like 3-4 years in it) and I think it has certain flaws the biggest one being its speed and I was thinking of passing over to CI but I need to know...

The system generally takes care of deletion for you.
@tereško Again, close. Not delete.
you are in favor of perpetuating crap
why ?
what is benefit of those questions for future visitors ?
@tereško First off, the benefit is your for closing duplicates against.
20:26
Anyone?
Second of all, the question has 11 upvotes. From noobs, no doubt, but the question was useful to at least 11 people.
when was the last time you closed a "versus" question against a duplicate ?
... when people want function / method overloading in PHP … (anyone post a meme please now...)
@DemCodeLines foreach on one, and then $secondArray[$firstValue]?
@bwoebi What's wrong with function/method overloading?
they want to overload is_array() .. or something like that
20:28
@tereško That is stupid. Lol
@SecondRikudo everything. In a dynamic language. Then make just a few ifs and it's fine.
@bwoebi Why does it matter that it's a dynamic language?
What's wrong with wanting self documenting code?
function show_property_value($arguments) {
	switch (count($arguments)) {
		case 3:
			list($publisher,$version,$prop) = $arguments;
			$mode = null;
			break;
		case 4:
			list($publisher,$version,$mode,$prop) = $arguments;
			break;
		default:
			print "@@ERROR_VAL@@";
		usage("Incorrect number of parameters!");
	}
self documenting ... with overloading? sorry, but it have to laugh.
Why?!?!?!
@SecondRikudo that's why we have optional parameters...
20:30
@SecondRikudo Don't do that please :)
~^~
@SecondRikudo Well, here is the situation. I have two tables, one with all the possible sports and one with all the tags the user gets. Would it be efficient to SELECT**ALL** of the rows in the sports table, put it into array and then check against the array with the user's sports or is there another more efficient way?
@DemCodeLines Heard of JOINs?
It's basically nikic/FastRoute :P
20:31
@SecondRikudo Yes, but never used those.
@DemCodeLines Today's a good day to start.
e'ning folks
@SecondRikudo "Join - Join array elements with a string" what the heck does that have to do with retrieving values from a mysql table?
@NikiC evening :-)
@DemCodeLines Google "mysql join"
20:34
Well, what I wanted to say actually: if you have your own idea on some particular question, if it should be closed/deleted - it's allright, proceed with button
But if you are pressing it only because someone asked you to - you are doing it wrong.
I mean, I could just figure out a way to put an array of the user values in the WHERE clause in the mysql statement and then put all the retrieved values into an array, unless that's what JOIN is.
@DemCodeLines A JOIN allows you to add the relevant columns from another table.
To JOIN the two tables into one
:16052857 Technically, the request means "Please read this question and see if it needs closing"
Sadly, reality sometimes always differs from the ideal.
@SecondRikudo In this case, it's a little more complicated.
Since I have one table that has scattered user values.
id/user/sport
1/1/1
2/1/2
3/2/1
4/1/3
so if I want to get user 1's tags, it will return 1,2,3 while just 2 for user 2.
And I have already done that and put those numbers into an array.
@DemCodeLines But you want the actual sport name, not just the sport ID
Correct?
Yup, I just have already retrieved the id's in one array. Now I need to match those with the table with all the names and put that in an array.
20:39
@DemCodeLines You want JOINs. Read the article I linked to you.
I mean I could use a JOIN, but then I'd essentially be repeating the code that I used for getting the id's into an array in the first place.
You JOIN the sports table ON the user/sport table, and then you get the entire row for the relevant sport with an ID.
@DemCodeLines What you get from a JOIN result, is this
@tereško from the other side it looks like this. bad question... bad question... bad question... 100500th bad question... CRASH! BOOM BANG! One alone unlucky bad question gets beaten to the pulp by Room 11 Flying Force... bad question... bad question... bad question... Repeat.
Alright I'll try and let you know what comes out
id/user/sportid/sportname/all/other/sport/fields
Then you just get them back from the query like a normal select result.
20:42
@YourCommonSense lemme guess : you found a question in that list which should not be closed ?
or are you still looking
=)
frankly, I didn't look at all
so, "I did not read the book, but I have a strong opinion about why it is bad"
Well, to get it straight
1. Your cv-pls is a drop in a bucket. It's good thing to occupy yourself if you has nothing else to do, but it has no effect site-wide
2. Beside killing obvious low-quality questions there is a sport of nukeing old mature questions, based mainly on opinions and prejudices.
I don't care for the [1]. And I have seen questions deleted by the gang, which, in my opinion, didn't deserved it
@SecondRikudo ran this: SELECT user_tags.user, tags.name FROM user_tags INNER JOIN tags ON user_tags.tag=tags.id and while it got the correct user and the corresponding sports name, it isn't correct, because I need to run the query for specific users.
20:57
and that question on multiple execution you reproached me for is one of them.
@DemCodeLines WHERE user_tags.user = :userId?
Although not helping me with my goal SpiceWorks is pretty cool.
@Fabien http
cheers
I just want to monitor the bandwidth usage on my network :(
user1607528
help please, on this page rushventures.com/products.html how to click develop filter link on page load
21:09
@Muhammet sigh
IIRC, this isn't your first time, the next I'm going to start binning your JavaScript questions, OK?
@SecondRikudo you are talking to tiny people again, ain't you
@tereško Most probably
21:27
@SecondRikudo thanks for the help. saving me from headaches every single time lol :D
user895378
21:51
@JoeWatkins It's definitely is going to end up being tomorrow ... you'll be able to play with it over the weekend for sure. Lots of cool stuff though ... it's coming along really nicely.
22:07
0
Q: PHP Ratchet websocket handshake failing

user3123545Just started using ratchet. When I firstly tested it, it worked fine with websockets, got requests etc. But now I am doing the same as I did, but the request (onOpen) isn't even getting requested, and I am getting this JS error: WebSocket connection to 'ws://localhost:8080/' failed: Error during...

@user3123545 For one, don't use localhost
@Danack Why?
18
A: mysql_connect (localhost / 127.0.0.1) slow on Windows platform

DanackPHP is attempting to open a connection to localhost. Because your computer is connected to your network via IPv6 it's trying the IPv6 version of 'localhost' first, which is which is an IP address of ::1 http://en.wikipedia.org/wiki/IPv6_address#Special_addresses ::1/128 — The loopback add...

Same shit - localhost doesn't mean something specific
2
Is my code right

Proposed Q&A site for people who would like a hand in checking their code in may programming languages for many purposes. Or people who don't have access to someone to debug their code.

Currently in definition.

LAL
@Danack It's kinda weird, netstat -a shows 3 listeners while i closed the server pastebin.com/HEbLg4Pf
2 listeners*
@TOOTSKI Too obvious.
Real links don't display the https://, also, real links are truncated at a certain length.
22:33
    $data = json_decode($message);
    switch ($data['packet']) {
Is that wrong?
Yes!
i get Cannot use object of type stdClass as array
i should've googled , got the asnwer lol
@user3123545 Please refer to the documentation for json_decode
22:36
@LeviMorrison when's voting?
@TOOTSKI resists urge to turn this into an Abbott and Costello sketch
Not sure why, but OK :D
What version control softwares do big companies like Microsoft, Google, Apple and Facebook use?
I mean they don't publicly put out their code, but they have some sort master branch in which every developer (in the company) is contributing, so what software do they use?
FB use git
MS I assume use their own
22:50
@DemCodeLines Why does it matter?
Use whatever works for you. Namely Git.
ThW
ThW
@DemCodeLines How you use the vcs is a different matter (feature branches, ...)
@SecondRikudo I am interning for a small company and we kinda need a version control system. The code is private and company property, so I am not going to upload it on github or some other third party software.
@DemCodeLines Git.
Git != GitHub
Those companies all set up their own systems that is private and to themselves and runs on their own server. I need to set up something like that too.
You can push and pull from each other, or set up a centralized internal server to push and pull from.
22:52
Does git have its own GUI?
or do I have to use github client or something?
@DemCodeLines There are several Git clients, depending on your OS
Most IDEs have Git integration
And I find the CLI to be simplest and quickest to get the job done.
ThW
ThW
@DemCodeLines git is the vcs, no web ui neccessary, but here are several
@SecondRikudo I use TortoiseGit mostly, cli sometimes
@DemCodeLines let's start with the basics.
Git works 100% on the file system.
That means it can be completely local, without any distribution, external servers or even a network connection.
Now, one step further
Git is distributed
Meaning, everyone can pull from everyone, if they want.
So you work on some feature, and then you tell your other folks by some means "Hey guys, I just did the patch and fixed bug #123, pull from me!"
And then they can pull from you, if they want, and merge your work into theirs.
ThW
ThW
git clients manage the user actions, the web uis like github manage the network
@SecondRikudo Which is the best thing ever.
22:57
@TOOTSKI Yes, but requires some training and thought change.
ThW
ThW
should be easier if here is no previous vcs
Well, basically I am looking to set up an internal company version control system that anyone connected to that company server (will be employees obviously) can pull and add stuff, although I would like to have central control of merging all the pull requests.
@ThW And team members never touched a VCS before :P
ThW
ThW
@SecondRikudo that's not my point, processes tend to depend on the vcs used
@DemCodeLines There's a really nice talk about how to use Git as a distributed VCS by the creator of Git
Lemme see if I can find it
It's a tad long, but watch it.
ThW
ThW
23:01
Has anybody tried Fossil?
@SecondRikudo how does that help me with route to go?
lol sorry im just kidding. I'll watch it as soon as I get some time.
@DemCodeLines There's no real route to choose from.
Bookmarked it though! :D
Out of all the VCSs out there today, Git is by far the best. In any category.
How you implement it internally is up to you.
But look up the distributed model, as opposed to the centralized model. The distributed model is superior.
oh, it's frontend coding time again!
Fixing JS code: 10% coding it right, 90% dealing with IE: http://goo.gl/jouuzj #ie thanks @IE, for always, constantly wasting my time
23:03
@SecondRikudo any tutorials out there on how to set up git internally?
ThW
ThW
@SecondRikudo Fossil is an dvcs and it includes the wiki/issue tracker into the dvcs structure
@DemCodeLines Read the Git book.
Also Google has some decent stuff.
@ThW Git has a stronger community.
Also, that problem was solved so many times over (issue tracking)
ThW
ThW
yeah that's a main point
Most of my projects are on bitbucket/github
@SecondRikudo I know, but usually it is an central instance (like github), with fossil it is distributed, too.
morning
@DemCodeLines have you tried searching for stuff about git? i assume you have not seen this yet.. Git branching model tuts. Then again, whatever works for you.. you might adjust depending on your organization's process..
@reikyoushin There is not adjusting, at least not right now, since we don't have any sort of version control system (the team is pretty small and the code is fairly new).
23:16
@DemCodeLines then that branching model could be one of the options..
if you want, you can create a "bare" repository internally which would act as your trunk.. then, all of your collaborators have their own repository on their local PCs.. (that's how people usually do it, or so i think)
my first vcs was cvs, then i have to work with svn now.. yet for me nothing beats git. :)

« first day (1286 days earlier)      last day (3888 days later) »