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

4:00 PM
@tereško I'm around. Feel free to ping me with messages you think should be moved to bin.
 
@Zoidberg'-- emm .. if you want to administrate the room , please apply
or do you visit each chat room and bitch about flags ?
 
@LeviMorrison No, Jon Skeet doesn't type, he controls your mind to make you think he did :)
 
.. wait ... it looks like you ARE bitching about every single flag you see: chat.stackoverflow.com/search?q=flag&user=142019&room=
 
Haha
 
So I'm taking the approach of running the HTML through the w3 validator before sending it to the PHP DOM classes.
 
4:04 PM
@Zoidberg'-- Personally I agree with you that the flags weren't appropriate. Venting your frustration when you come in here isn't very professional though.
 
@Moshe Why would you do that?
 
@Jack So I get rid of all of those parser errors, and I have a better chance of parsing correctly.
 
@Moshe DOMDocument already does that though; have you tried?
 
@Jack because .. aliens
 
Where did all of the professional and enthusiast programmers go? There have been too many help vampires today.
 
4:06 PM
@Jack Yea, it gives me these errors and dies.
@Paul 'm sorry. :P
 
@tereško Is he holding an imaginary 1ft sub?
 
don't tell me that you do not know that meme, you bring shame to the tribe
 
Is being able to rewrite the entire linux kernal in C competent enough to say you are not a newbie?
 
C++ room tries to decide what language is the most horriblest
3
 
no
 
4:08 PM
@tereško You assume too much lol
 
@Paul Sunday is generally quiet for the professional programmers. I would think there would be more enthusiasts on, but for whatever reason they aren't. I classify myself as both professional and enthusiast yet I'm rarely online on Sunday.
 
@NikiC Java :P
 
@Moshe Its not you. I shouldn't read the transcripts it is depressing.
 
@webarto The can't decide between Java and C
 
@Moshe It dies or just spits out a lot of warnings?
 
4:09 PM
@NikiC Uh . . . Java < C in my opinion.
It's not a debate at all.
 
@Jack spits warnings at first, dies later.
 
Oh well, it was bedtime ages ago anyway. Goodnight all.
 
@LeviMorrison That's what @Zoidberg'-- says ^^
 
@Moshe Well, can't really help if I don't know what's "killing" it ... so, carry on :)
 
@NikiC C > PHP > Java :P ?
 
4:11 PM
>>> object-c ...
 
You forgot C++
 
@webarto That sounds about right-ish. Though I'm not sure whether I'd put C before or after PHP
 
@DaveRandom I'm unpinning the cv-pls item. I'm fine with pinning stuff like that for a few days but I don't want it looking too official.
 
Because C is really a horrible language in many regards
 
@NikiC It's also a great language in the other regards ;)
 
4:11 PM
@Jack Code's on GitHub, here (link). It's using cURL & DOM classes to scrape a webpage.
 
And, just to annoy him, let's all ping @Zoidberg'--
He seems to hate that :D
 
what is GitHub ?
 
@NikiC do you think we could make @Zoidberg'-- to rage-quit ?
@user1867842 ... ad you keep asking if you should be considered newbie ... ehh
 
@tereško @Zoidberg'-- already had an SO rage-quit once :D
 
4:13 PM
hey , thats not a valid flag .. nor a valid star
 
@tereško I think it was because a mod deleted a comment from him and he totally freaked out over it
 
.. and people keep assuming that i have a short fuse ..
 
yeah
 
more like a grumpy old man ;-)
 
hum
 
4:16 PM
Yo
 
this sucks. My code is broken.
 
get of my lawn
 
so yeah, if anyone else wants to donate a ping to @Zoidberg'--, please go ahead :)
 
speaking of which, i saw your common sense making a come back .. does anyone know why he was booted off for a while in the fist place?
 
@Jack He's regularly suspended
 
4:17 PM
@Zoidberg'-- is awesome though
 
i think @DaveRandom was at fault there , in some respects
maybe we could pin common's comeback to @Zoidberg'-- ?
anyway ... brb .. this seems like a good time to take a shower (those damned hair take long time to dry)
 
The w3C markup validator claims there's a non-SGML character. I wonder if that's throwing of the DOM parser?
 
@Moshe You're missing a libxml_clear_errors(); call btw.
 
@Moshe Do you have an example of the markup?
 
anyway, gtg.
 
4:22 PM
@Jack where?
 
@NikiC By the way, I'm beginning to believe C > C++ in a lot of ways. I fight with the C++ compiler considerably more than the C one.
 
@webarto The markup is visible here: github.com/MosheBerman/lightbulb
 
Ah, @Zoidberg'-- is back in the C++ room
He seems to be ignoring all of our nice pings ^^
Another @Zoidberg'-- ping
 
Who is @Zoidberg'--?
 
And another one for @Zoidberg'--
 
4:29 PM
@Zoidberg'-- of c++?
 
exactly that @Zoidberg'--
 
:)
 
he's complaining that the PHP room is pinging him. So the only logical conclusion is that @Zoidberg'-- needs more pings ^^
 
Let me sing you the song of my people @Zoidberg'--
 
in Lounge<C++>, 55 secs ago, by Zoidberg'--
@yetihehe I find it funny how dumb they are.
^-- Another @Zoidberg'-- ^^
in Lounge<C++>, 2 mins ago, by Zoidberg'--
Heh, I blocked the notification bar with AdBlock. :^)
^-- I will consider that to be a success :)
 
4:34 PM
:D
 
$('.reply-count').remove();
noob :P
 
I am not able to understand one thing,php.ini does not have any entry such a extension = mysql.dll or extension = mysql.so,still php(5.1) working fine with mysql support
 
@Tarun grep -r 'mysql.so' /etc...
 
@Tarun it could be compiled in
 
Can anyone help me with windows symlinks?
 
4:43 PM
@MadaraUchiha Sure
;)
 
@MadaraUchiha It's a not-so-subtle suggestion to switch OS.
 
-_-
D:\Websites\htdocs\geva\wp-content\themes\eyedooptic\scss>mklink /d \compass D:\Ruby193\lib\ruby\gems\1.9.1\gems\compass-.12.2\frameworks\compass\stylesheets\compass
It says it was done successfully, but I don't see anything in the directory?
 
@MadaraUchiha o_o
 
@DaveRandom We should start an SEO campaign that says XML-serializable HTML5 improves SE ratings. People propagate lies under the tent of SEO, so we may as well spread otherwise good tips, right?
 
4:47 PM
But really let me test
 
@webarto there is mysql.so file in /etc/php.d ,upon checking result of phpinfo i found /etc/php.d/mysqli.ini in additional .ini files parsed section
 
@MadaraUchiha Should you specify a target name?
Wait nvm :)
 
Evening
 
jo @DaveRandom
 
@LeviMorrison No worries :-)
 
4:51 PM
@Tarun Yup, execute php --ini to see what is loaded.
 
/me is nearing death from man-flu
 
@DaveRandom man-flu?
 
@MadaraUchiha Holy crap, WP and Ruby? Together? My eyes!
 
@DaveRandom I know, no choice, move on.
 
@MadaraUchiha Just tried it and it just works for me
 
4:53 PM
@MadaraUchiha Yeh it's like flu, only man-sized. It may actually kill me.
 
@DaveRandom lol
@PeeHaa :|
 
Man-flu. Flu with bacon
 
What would be wrong with my system then?
 
Hey guys just a quick question

date("Y-m-d", strtotime("this week last monday 2012-12-31"))
returns me 2012-12-24

but i think it should return 2012-12-31 because 31 is monday, what am i doing wrong?
 
@MadaraUchiha Why did you add the slash in front of the new name?
 
4:55 PM
@PeeHaa I copied it from an answer on my question
 
Could you try it without the slash, because the following just works for me:
C:\Users\PH\Desktop\ph>mklink /d LINKTEST C:\Users\PH\Desktop\fotos
 
Works
Thank you
 
@Linas Doesn't the keyword "last" mean it will return the previous Mon? That seems to make sense to me...
 
@MadaraUchiha Glad I could help
 
0
A: How is SplSubject/SplObserver useful?

Levi MorrisonIt's quite simple: it's not useful for an event system. The observer pattern doesn't lend itself to saying, "This thing was updated by X". Instead it simply says that it was updated. I have actually created a flexible mediator class that could be leveraged for this purpose. Depending on your n...

 
4:58 PM
@webarto sorry my bad i am not able to execute,tried php --ini on command line its prompting a blank line
 
That is odd, it should be something like...
Configuration File (php.ini) Path: (path)
Loaded Configuration File:         (path)\php.ini
Scan for additional .ini files in: (none)
Additional .ini files parsed:      (none)
 
@webarto if i am running php -m then it showing mysql,mysqli etc
 
@Linas You are missing of as in last monday of.
Although, I've never chained so many of those things together.
You might need to do two timestamps.
 
Your function is doing too much. @Linas
 
@Linas I think you can simply do: date("Y-m-d", strtotime("last monday of 2012-12-31"));
That gets the last Monday in December 2012.
 
5:12 PM
posted on December 16, 2012 by Evert Pot

I like using OS X's built-in packages where possible, but unfortunately Apple is way behind with their PHP package, having it locked on 5.3.15. In the past I've seen people use tools like Mamp, or Xampp to provide this for them, but frankly I'm not a big fan of these tools. Homebrew provides a solution. Homebrew is OS X missing package manager, and it's an absolute great tool to work with. Ge

 
php -m returns list of compiled-in modules,so mysql is a compiled-in module
 
@TimPost Can't you just "overload" them with a namespace? Or are they used all over the codebase?
 
could someone help me out with swfupload? the queue starts, but only the first file gets uploaded after i call swfu.startUpload() to initiate the chain
 
@DaveRandom wtf is correct.
I'm religious but even that is . . . crazy . . . to me.
 
5:28 PM
@LeviMorrison I don't quite get it, I think the guy is making a valid point in a very cryptic way, but it is so cryptic that I can't see what he is referring to. The whole thing is probably -worthy anyway.
 
user1125394
why $foo ? "..." : ; doesn't work though $foo ? : "..." ; does
 
user1125394
anyway none work in Js so I better not use that trick
 
@cyril Because it does. $foo ? "..." : ; doesn't make any logical sense in that context.
@cyril The JS equivalent is varName || 'default value if falsey';
 
not really
 
user1125394
$something = 1;
$something = rand(0,1) ? : 2;
$something = rand(0,1) ? 2 : ; //not work
 
5:34 PM
for it to work , $foo has to be defined AND falsie, for default value to be set
@cyril alos , he is talking about $foo = $foo ?: 'default';
what you are asking is "why i cannot use $foo + $x = ;"
 
user1125394
it's ok..., can always use negation on the condition
 
@tereško How so? They have the exact same effect (don't they?). I very rarely user either, probably never these days.
 
3 mins ago, by tereško
for it to work , $foo has to be defined AND falsie, for default value to be set
$foo['x'] = $foo['x'] ?: 1; will throw a warning , if there is no value for "x" key
 
@tereško A warning yes, but it will still work.
 
@DaveRandom same way as $x[karrmba] "works"
 
5:40 PM
:6733103 No, that doesn't work (not nicely). The result of that will be bool or int
 
@cyril , codepad.viper-7.com/ZDHbzN , go home, you are drunk
 
user1125394
$something = !isset($foo['x']) ?: $foo['x'];
 
@tereško I'm not advocating it, I'm just saying that it technically works.
 
user1125394
!!> "ok"
 
@cyril I am having serious difficulty getting my head around that, and therefore do not do it. That is a BIG $readability--;
 
5:42 PM
@cyril That's nearly totally useless
 
user1125394
yes, but it's in inline php statement in views
 
user1125394
<script type="text/javascript">
		var accessToken = '<?= !isset($_SESSION['accessToken'])? : $_SESSION['accessToken']; ?>';
	</script>
 
@cyril this sets value to false if value was defined , otherwise it tries to assign an undefined value
 
@cyril There has to be a more legible way of writing that inline. Why does inline matter anyway?
 
they should add the "mark as stupid" feature to the chat
 
5:47 PM
i wonder about the downvotes. are all SO readers atheists? or are most of them, like, really dumb, lacking any sense of humor? i think the latter. apples before swine, not a good idea. i admit. — Cheers and hth. - Alf 5 mins ago
 
wat
 
user1125394
@NikiC sorry but how would you write it
 
@cyril I have no idea what you're trying to do there
 
user1125394
 
5:54 PM
@cyril Yes, I get that. But I have no idea what that code is supposed to do
 
@tereško lol, not seen that for ages
@terescko: you sound like an idiot, commenting on a deleted answer with derogatory remarks about the author. — Cheers and hth. - Alf 3 mins ago
Flame war anyone?
 
@DaveRandom emm ... the "answer" is not deleted
which kinda proves my original point
 
Is it right if I do this to get all the <td> between a </table> and one that contains "Kraj" ?
$results = $xpath->query("/[td = 'Kraj']//td[preceding-sibling::table]");
 
user1125394
@NikiC echoing a js var, never saw that before? :p
 
@Brut4lity The leading single / means that will be searching for things that are immediate children of the document root. You probably want //. But I don't really understand what you are trying to do, can you elaborate (preferably with an example)?
 
6:01 PM
@cyril heh
@cyril How about we start something more simple
@cyril What do you want to output if that variable is not set?
 
@DaveRandom I want all the content from the <td> tags following <td>Kraj</td> until </table>
 
user1125394
if there are alternatives, I'd be pleased
 
I assume that it's not 1, like your current code would do?
 
user1125394
@NikiC empty string ( that is an invalid accessToken, but not used for the Xhrs )
 
For example I have this as part of an html code :
<table border="0">
<tr style="color:White;background-color:#1F3A63;">
<td colspan="5">Osoby</td>
</tr><tr style="background-color:#3D83C3;">
<td>Rodzaj osoby</td><td>Nazwa</td><td>Miasto</td><td>Adres</td><td>Kraj</td>
</tr><tr style="background-color:LightGrey;">
<td>(732) Zgłaszający/Uprawniony</td><td>Zakład Mięsny Dobrowolscy Spółka z o.o. - Spółka Kmandytowa</td><td>Wadowice Górne</td><td></td><td>PL</td>
</tr><tr style="background-color:LightGrey;">
 
6:04 PM
@Brut4lity OK I see what you want, that's melting my brain a bit, let me go and refresh my head on some docs...
 
;) Sure
 
@cyril I'd go for the usual isset($_SESSION['accessToken']) ? $_SESSION['accessToken'] : ''
Or do something like $accessToken =& $_SESSION['accessToken']; and later just use that var
 
user1125394
=& ? takes the reference?
 
@cyril that supresses the notice
If you're real crazy you could also write <?=$_=& $_SESSION['accessToken'] ?>
 
user1125394
ok
 
6:07 PM
I'd usually go for the $accessToken =& $_SESSION['accessToken']; variant ;)
 
I wish there would be IRC channel for SO
 
Damn did I miss a xpath question :(
 
@DaveRandom Oh I see where I was wrong
@DaveRandom Thanks, and the results of a query is <td> emplacement ?
 
@PeeHaa She's mine! You can't have her!
 
6:20 PM
:(
 
@Brut4lity Sorry, come again? I don't quite get what you're asking...
 
Color Suggestion: Do you like the dark green color when you hover over a navigation link or should it just stay a slightly different brown on this site
 
@DaveRandom Just the return format of the query()
cause I'm doing this
for($i = 0; $i < $results->length; $i++) {
$text = trim($results->item($i)->textContent);
if($text != '') echo $text . "\n";
}
 
@Brut4lity It's a DOMNodeList
 
Ah, so I have to use the other functions such as item and length.
 
6:21 PM
@Brut4lity Yes, or you can just foreach over it
 
@DaveRandom Okay :) Thanks a lot for your help
 
hi all
So it seems I have a problem.
 
No matter how much time I pass on Xpath, it never seems to get in my brain, aswell as regexes
 
My DOMParser I was in here talking about earlier - it only loads 735 records of about 3K.
 
6:23 PM
@Brut4lity I still have to go read docs for anything but the very simplest things.
 
	$dom = new DOMDocument;

 	libxml_use_internal_errors(true);
	$dom->loadHTML($html);
	libxml_use_internal_errors(false);

	//
	//	Get all of the tables in the page
	//

	$tables = $dom->getElementsByTagName('table');

	echo "There are " . $tables->length . " tables. \n\n\n\n\n";
 
@DaveRandom Yep, but I even do mistakes on simplest things, I'm a begginer :p
And the Xpath doc seems weird to me
 
anyone on the color suggestions
 
@benlevywebdesign reddit.com/r/design_critiques might be more willing to help
 
@Brut4lity I read XPath docs from MSDN. which reference you find weird?
 
6:34 PM
@shiplu.mokadd.im W3C's
I'm gonna look at the MSDN's one.
Yes, it's actually better
 
@Brut4lity IMHO, W3C's is not actually a reference. Its rather a spec. Specs are harder to read.
 
That's why.
 
@shiplu.mokadd.im ...and also not fully applicable to any given engine, especially PHP, because it often doesn't implement the full spec. But that's still what I use most often, I guess I am a bit of a sadist.
 
@DaveRandom if you have good grasp of XPath. its not uncommon to look at spec.
People only look at spec when something is not found in the reference or the description there is not enough clear
 
@DaveRandom After testing, this gets me pretty much all the <td> in my code
Even the Kraj, which I do not want
^^
 
2
Q: Small MVC for PHP

Neal The following is a new question based on answers from here: Small PHP MVC Template I have written a small MVC template library that I would like some critiques on. The library is located here If you are looking for where to start, check out the files in the lib directory. I would really...

internet makes me sad
 
What this guy is asking makes no sense, right? stackoverflow.com/questions/13904383/…
 
7:00 PM
Why do people post questions that fall as low on the readability scale as this? I don't get it.
 
@shiplu.mokadd.im Why the fak did that get an upvote?
 
@PeeHaa may be someone who is taking the project.
 
7:15 PM
@shiplu.mokadd.im I wonder how many bags of chips (s)he will get of it :)
 
Anonymous
Is it true that using oop for small scale sites is a bad idea, because it ads unnecessary complexity?? If so, then how small is a small website? Do we have a definition for that?
 
@TheCOMPLETEPHPNewbie try to be pragmatic
 
Anonymous
What do you mean
 
prag·mat·ic
/pragˈmatik/
Adjective
Dealing with things sensibly and realistically in a way that is based on practical rather than theoretical considerations.
 
Anonymous
7:28 PM
Well in that sense, I can't afford to be pragmatic, as I am absolute newbie
 
Today I wrote an app to keep track of my expenses. Its just a single page. NO-mvc. html and php are mixed. But I checked the input
 
@TheCOMPLETEPHPNewbie Don't kid yourself, you're just a troll :)
 
@webarto To be fair, that's a bit rich coming from you... :-P
 
Anonymous
@webarto Why would you say I am a troll? Because, I asked a question incredibly easy to you?
 
Aug 31 at 10:23, by markcial
sometimes i have the weird feeling that @webarto is here only to troll noob users
 
7:30 PM
anyone using Yii?
 
Anonymous
If that is how you define a troll, then you need to check again youtube.com/watch?v=v1PBptSDIh8
 
@Samson Yep. I guess you are, for one. Please see the room description ;-)
 
I need to build a modal in a user's page with an agenda
for each day..and navigate through the days using ajax
I 've built an widget for that
and added an CAction class
 
Anonymous
The reason I asked the question is because I saw a tutorial by Kevin Scogolan from lynda.com lynda.com/Kevin-Skoglund/104-1.html and he said to avoid OOP for small websites.
 
for the ajax update
my question is.. should widgets be used to render static content only?
 
7:34 PM
hello
 
I mean I believe I've deflected from the basic widget use
I've done it like here
should I have just created a new action on the controller for the ajax update
?
 
@TheCOMPLETEPHPNewbie That's nonsense, certainly you can't make a sweeping statement like that. How do you define "small" for one thing.
@Samson Just so you know, I'm not ignoring your problem, I just don't have anything useful to say about it. I'm sure someone else will have an opinion if you give it some time for people to read it though.
 
ok
no problem
 
Anonymous
Well I don't know. He is a very good tutor, but never indicated what should be considered as small/simple website
 
@TheCOMPLETEPHPNewbie Nay, first of all, you use newbie as an excuse, I personally don't like that... we are all noobs, relatively...
@DaveRandom HOW DARE YOU.. YOU.. YOU.. BRITISH!
 
7:41 PM
@Samson take this as a recommendation from someone who had to use Yii for almost a year : just stop and walk away
@TheCOMPLETEPHPNewbie please do not link to sites with bad tutorials
 
@tereško can you explain please?
 
Anonymous
@webarto I am newbie!! Why should I use that for excuse? Is there an SO food-stamp version for noobs here? I don't think so. Just I have 470 reps from 81 answers lol
 
@tereško I don't think I can walk away in the next period anyway
but you made me curious
 
Anonymous
@tereško I think you are having a problem with reality, if you are saying lynda.com has bad tutorials. It is the best on the web!! Just because they did not chose you, does not make it bad.
 
7:45 PM
:-P
 
And you say I'm trolling?
 
lol
 
:6733661 it's just w3schools 2.0 - same crap, different package. Only difference is that it's mostly videos, thus, you do not even need to put in an effort in reading it
 
Better delete that actually, someone might take it seriously
 
Anonymous
7:46 PM
hahaha
 
Anonymous
I don't know which planet some of the people in this forum are from. They say SEO is a myth and lynda.com has bad tutorials?? I think, you guys have been codding to much getting detached from reality ... no offence
 
$criteria->with='user_likes';
$criteria->condition='likes.user_id=1'; //Search if user id '1' liked the post.
Yii... sad.
 
@TheCOMPLETEPHPNewbie Did you get this answer also from Lynda? stackoverflow.com/a/13426637/508666
 
@webarto well you can write your own sql.. I don t see that as a big obstacle
 
@Samson Yii is poorly documented collection of antipatterns and bad code, made by mostly one developer, who wanted to use python, but got stuck with php. When you dig through Yii's docs, you will see that, for every 4 pages of wall-of-text, there are 5 lines of code, with no context (it is impossible to understand the context in which that code has to be used). The "MVC" there is just a joke. Most of objects are static( read: global), configured through single file.
 
7:49 PM
@TheCOMPLETEPHPNewbie The one (constructive) thing I would say about these things is this: when you follow a "tutorial" you have a "tutor", with their own opinions about how things should be done. They are not always wrong, but they are not always right either. It can often be hard to separate facts from opinions. Manuals are generally much, much more useful than tutorials.
 
Also @TheCOMPLETEPHPNewbie what is this: $username = mysql_real_escape_string(htmlentities(trim($_POST['username'])))
 
Anonymous
@PeeHaa Can you tell me why the location should be with upper case L ?
 
Is /example.php considered absolute URL path?
 
user1125394
MVC isn't tied with global
 
Anonymous
7:50 PM
$username = mysql_real_escape_string(htmlentities(trim($_POST['username']))) What does it look like
 
@webarto Absolutely not :)
@TheCOMPLETEPHPNewbie Honestly?
 
@PeeHaa Path, sorry.
 
@Samson the "modules" are something that has been just tacked on ( you can see it by having to set default module in configuration file as "defaultController". Domain logic is tied to active record pattern. Core code is completely undocumented. There are no interfaces, so when you extend core classes, you have to guess what methods to implement. ... and on and on the list goes
 
@webarto If the example.php file is in the root it is considered a full path
 
Anonymous
@PeeHaa WTF is wrong? I said I am new to PHP! WTF more do you need to understand before condescending me?
 
7:52 PM
I'm doomed:))
 
@TheCOMPLETEPHPNewbie have you considered that it could be because you are convinced that you know what is "right way" to do things ?
 
@TheCOMPLETEPHPNewbie See above
 
@TheCOMPLETEPHPNewbie If you are referring to a HTTP header then there is no reason. RFC2616 specifies that header names are case-insensitive. Convention dictates that you capitalise the first letter of each word. It will work either way.
 
@Samson , hence I recommended to slowly put it down and sloooowly step away
 
Anonymous
@PeeHaa this: $username = mysql_real_escape_string(htmlentities(trim($_POST['username']))) is supposed to sanitize user inputs. I know you are going to say PDO, but this is alternative
 
7:53 PM
@TheCOMPLETEPHPNewbie No that monster has nothing to do with sanitizing input for input into a database
 
@PeeHaa Right, I just wanted to clear that absolute path != absolute URL (I needed confirmation). T.Hanks
 
Now now gents, lets try and keep it constructive...
 
Anonymous
@DaveRandom offcourse it was HTTP header. @PeeHaa was quick to mocke and forgot that one
 
Right...
 
@tereško damn..I just got this great job and they've just switched from Symphony to Yii.. there is not much I can do right now
I was now looking through the framework's code on github
 
7:54 PM
lol
 
Anonymous
@PeeHaa it works try it :)
$username = mysql_real_escape_string(htmlentities(trim($_POST['username'])))

It is better than
$username = $_POST['username']
 
@TheCOMPLETEPHPNewbie The problem with that line is the htmlentities, that is not database sanitisation, you shouldn't keep stuff in you database html encoded.
 
I've understood the basic stuff
 
(ignoring the ext/mysql issue for the minute)
 
but it's not that easy to find the best solutions in practice..
 
7:55 PM
@Samson that's actually hilarious, since Symfony 2.x is currently the least bad framework for PHP
 
Anonymous
the htmlentities is for XSS attack, I was putting all together
 
@TheCOMPLETEPHPNewbie Sure it works. But it's a terrible way to do it
XSS has nothing to do with a database
 
it has some issues (in particular - the DIC) , but the overall design is solid
 
You just made OPs database twice as large
 
Anonymous
But, a user can input anything, that is why it is better to sanitize for XSS and SQL Injection at the same time
 
7:56 PM
No you are wrong
One does not simply use htmlentities() data going into the database
 
Anonymous
<input type="text" name="username" />

Now, according to you, I should only prevent that form from sql injection???
 
10 mins ago, by The COMPLETE PHP Newbie
I don't know which planet some of the people in this forum are from. They say SEO is a myth and lynda.com has bad tutorials?? I think, you guys have been codding to much getting detached from reality ... no offence
lmao
 
If the data if going into the database use mysql_real_escape_string(). If data is being displayed use htmlspecialchars().
 
Anonymous
What is someone inserts a malicious javascript code? what can I do? next you probably will say strip_tags(); is better
 
HTML sanitation is applied prior to outputting data.
 
7:59 PM
Ok I'm done trying
 
@TheCOMPLETEPHPNewbie No because you've screwed up the raw data. Let's say, for the sake of argument, you want to export a list of all the usernames in the DB. You don't wan't a list that looks like bob, dave, &lt;alf, you want bob, dave, <alf
 
user895378
@tereško rofl
 
Can somebody please review it so it can be gone
0
A: Is this string sanitization enough to stop SQL injections in PHP?

The COMPLETE PHP NewbieYou must use learn PDO as Mysql_ is always vulnerable. Here is a beginners guide to lean PDP, But, if you "You Must" use Mysql for now, then then atleast sanitize your data data using mysql_real_escape_string() to protect against mysql injections For, ex: $username = mysql_real_escape_string(...

 
THIS IS PROGRAMMING BLOG, NOT A FORUM.
 

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