« first day (880 days earlier)      last day (4051 days later) » 

9:00 AM
@DaveRandom Even I can sense that it has lot of ifs and doesn't look in a good way of coding. But it is somewhat understandable for me as a php beginner.
 
@Alex_ios If you are following that you are doing something wrong. Because they key in that tutorial is larger
Also note that this pattern is crap preg_match("/^([a-zA-Z0-9])+([a-zA-Z0-9\._-])*@([a-zA-Z0-9_-])+([a-zA-Z0-9\._-]+)+$/ to much e-mailaddresses
26
A: How to validate an email address in PHP

PeeHaaThe easiest and safest way to check whether an email address is well-formed is to use the filter_var() function: if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { // invalid emailaddress } Additionally you can check whether the domain defines an MX record: if (!checkdnsrr($domain, 'MX')) ...

Also note that `$query_verify_email = "SELECT * FROM members WHERE Email ='$Email'";
` is vulnerable to SQL injection
 
@DaveRandom It's godaddy
 
That entire tutorial is vulnerable to sql injection
 
@PeeHaa No I haven't followed that way when comes to key. I followed to produce simple key.
 
@PeeHaa Aug 19 '12 srsly?
 
9:03 AM
Is it possible to call a function on a button click in php?
 
@rdlowrey Okay, I've just pushed a new commit that includes a benchmark/ folder.
 
@Gordon ?
 
user895378
@Jack Thanks! I'm really going to sleep now. I'll get into it in the morning.
 
What? I don't know about this -->preg_match("/^([a-zA-Z0-9])+([a-zA-Z0-9\._-])*@([a-zA-Z0-9_-])+([a-zA-Z0-9\._-]+)+$/. Doesn't it work for all emails?
 
@Gordon But updated in October =D
@rdlowrey Alright let me know :) my first test subject mwahaha
 
9:07 AM
@PeeHaa Okay. I will go this way for the email validation ---> if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
// invalid emailaddress
}
 
@PeeHaa I hereby task you to find all the q&a predating that, note them and give em to me so I can practise merging ;P
 
@Gordon :-D
 
@Alex_ios If the email comes from POST you can also use filter_input()
 
@Alex_ios And please don't use the SQL examples in that post. Or you might as well just provide a raw dump of you database for everybody to download freely
 
9:10 AM
@DaveRandom :)
 
@Jack No. I get them from get in activation page.
 
i dont know how merging works yet. havent looked at the UI for it
 
@PeeHaa Sorry, I didn't get you.
 
Do we have a link to a better tutorial for user signup and authentication?
 
SQL injection is a technique often used to attack data driven applications. This is done by including portions of SQL statements in an entry field in an attempt to get the website to pass a newly formed rogue SQL command to the database (e.g., dump the database contents to the attacker). SQL injection is a code injection technique that exploits a security vulnerability in an application's software. The vulnerability happens when user input is either incorrectly filtered for string literal escape characters embedded in SQL statements or user input is not strongly typed and unexpectedly...
Basically everyone can read (and do worse things) to your entire database
 
9:13 AM
@DaveRandom I have seen this too but it's far more concise.
 
@DaveRandom NTIKO (Not that I know of)
 
@ I created a function that retrieve and display some data from my database. Now i need to call that function when i press a button. Do i need to put the button in a form? Or do i use javascript onClick and call the php function.
 
@Alex_ios Same issues plus a couple more :-P
 
You would be waaaay better of learning about doing these kind of things yourself instead of depending on some drunk author of some terrible tutorial imho
 
@PeeHaa Oh! You were talking about sql injection ! I implemented this $mysqli->real_escape_string for every value that I get.
@DaveRandom I thought :P
 
9:17 AM
@Alex_ios Aaaah k. And how are you setting the encoding?
 
stackoverflow.com/questions/15405164/… <-- Meh. Why do people post answers for questions like those...there must be hundreds of questions concerning the exact same topic...
 
@PeeHaa But if I have to do these kind of things myself, I have to refer some sources and I got these two which might not be good in your thoughts.
@PeeHaa encoding?
 
@Alex_ios The danger of most tutorial on the web is that they introduce bad pratice and even worse: vulnerable applications. Which is easy to spot if you know what you are doing, but otherwise that is a hard thing to do
@Alex_ios Aren't you using utf-8?
 
@PeeHaa I don't know :( But I kept this $mysqli->set_charset('utf8');
 
9:22 AM
@Alex_ios ok good. Looks like your most likely safe from SQli
 
@TillHelgeHelwig duly closed
 
@PeeHaa :) So it doesn't allow non-utf8 characters. Right?
 
This code is dangerously bad.

Setting aside for a moment the general spaghetti mess of nested `if` statements, inconsistent code indentation and the total lack of separation of business and presentation logic;
- it is full of SQL injection holes (http://bobby-tables.com/)
- passwords are stored in the database in plain text
- the error suppression `@` operator is not an acceptable way to avoid checking individual return values.
- reassigning the entire value of `$_SESSION` is highly likely to destroy other data in the session storage
 
But what's the answer to my original question?
 
> Your comment is awaiting moderation.
So the OP can ignore it and fail to inform people that his presumably fairly highly ranked page is awful
 
9:26 AM
Whose comment?
 
My comment on that "tutorial"
 
Haha!
 
@Alex_ios sorry I got somewhat distracted by that, has your original question been answered?
 
9:33 AM
I need a list of all functions, keywords and reserved words in php so that i can add them to my dictionary for spell check
@DaveRandom Can u be helpfull :) As Always
 
@DaveRandom NP. You have provided a good tutorial here itself. Thanks for that. And no. But I guess that answer lies in this --> Header redirects require a full URL, Location: file.php is a standards violation and is liable to go wrong .. What does this mean?
 
@ScoRpion... Do you know this page in the manual? Especially the first comment below the entry.
@DaveRandom Somehow you are way more efficient than I am. ;D
 
@DaveRandom @TillHelgeHelwig Thanks both of u buddy..
 
@Alex_ios No, that's not the answer you need (I suspect you need mod_rewrite(), you are almost certainly using Apache) - what that means is that the HTTP spec says that Location: headers must be http://full/url/to/file.php instead of just /path/to/file.php. It's a common mistake brought about by the forgiving nature of HTML, and all modern browsers handle it as you would expect, but it's still a standards violation.
 
9:40 AM
@Gordon Because it should be a comment.
 
@Alex_ios I suspect you just need a .htaccess file in the root directory of your site with something like RewriteRule ^/?regactivate.php$ /progams/phpfiles/regactivate.php [L,QSA]
 
@Jack did you flag the first revision asking "could you try" or the current one saying "try"
 
stackoverflow.com/a/15405698/989169 <-- Am I wrong or are all anwers but mine missing the point of the question?
 
morning
 
@Jack disputed ;)
 
9:43 AM
@DaveRandom Yeah. When I searched for hiding the folder names in google, I got this answers which include .htaccess file.
 
@Jack ah. nvm. I can see that
 
So, there is no other way to do that except this?
 
@Alex_ios Maybe, it depends on your setup. Are you not able to create .htaccess files? (and if not, why not?)
 
And this means --> ^/?regactivate.php$ /progams/phpfiles/regactivate.php [L,QSA] we are telling the system that it should go to /progams/phpfiles/regactivate.php when it is typed like this "http:www.exmaple.com/regactivate.php", right?
 
@Alex_ios yes, exactly.
 
9:46 AM
@Rikesh Yes I know it's disputed ;-)
 
The first component is a regular expression (which I've just noticed is wrong, . should be \.) which will activate the rule if the path component of the URL matches the expression
The second component is a path, rooted in document root, to the actual file to serve
 
@DaveRandom I don't know. Can I create .htacces file on my own and place it in programs folder?
 
And the [L,QSA] is two flags, meaning "this is the last rule to process in the rule set" and "append the original query string to the rewritten URI" respectively
 
I need a htacces rule to break something like
http://www.xyz.com/web-blog/item/121-abcd
to
http://www.xyz.com/web-blog/abcd
 
Actually the QSA is probably unnecessary in this scenario because you are not modifying the query string
 
9:48 AM
mroning
 
@DaveRandom Yeah. I am not modifying the query string which include email and key, but only I wanna modify those folders.
 
Morning
 
@Rikesh Probably going to be difficult. The first includes a database PK, the second doesn't. I know a lot of people do this but I really don't like it, it's really pointless and it brings in a whole bunch of messing around with generating URL slugs that are guaranteed unique. Plus the first looks like it's already rewritten, can't you just alter that rule?
 
Guys who is listed here stackoverflow.com/questions/15254975/… as closed by?
Why only few people?
I rised flag as well. Why my name nick name isn't listed?
 
@Alex_ios It would need to be in the folder above the programs folder, otherwise the URL would have to contain /programs
 
9:51 AM
@Eugene that's because gordon casted his vote, which automatically closes the question
 
@Ocramius morning!
And who are to others?
 
@Eugene Because Uncle @Gordon is now a mod, that's what the diamond means - it also means he is able to cast a binding close vote, i.e. close the question instantly.
 
Who casted before him?
 
@Eugene Gordon has legendary magic powers
 
@DaveRandom Can't we just rewrite ?
 
9:53 AM
stackoverflow.com/questions/15405412/… - can I also suggest him to get a w3cfools certification?
 
@DaveRandom I see. But @PeeHaa isn't as far as I know.
 
I just need to remove /item/ & it's id after that
 
or he is mod. as well?
 
@Eugene huh? You rang?
 
@PeeHaa :)
 
9:54 AM
@DaveRandom No problem. At least I will be able to hide one folder.
 
@Eugene No, but those votes were cast before the mod vote. It is very rare that you will see just a single name closing a question, mods (most of the time) shouldn't make unilateral decisions like that.
 
Hello people!
 
@Alex_ios OK well the same rule should still work if you put it in the programs folder. Just put RewriteEngine on and then that line above in a file, name it .htaccess and upload it to the /programs folder
 
@DaveRandom gordon as mod. should get t-shirt like goo.gl/nq4yC :)
 
Right, damn you people, I have to do some work
 
9:57 AM
@Eugene incidentally I will get send a t-shirt but I doubt it's this one
 
bbiab
 
hello...can someone explain how this works:
$output = preg_replace('/([.!?])\s*(\w)/e', "strtoupper('\\1 \\2')", ucfirst(strtolower($input)));
 
@Gordon why?)) very mod. like :D
 
when i use it it removes all the capitals...
and paragraph breaks (which is strange)
 
@DaveRandom @PeeHaa Can I follow this to create .htacess file?
 
9:58 AM
@Eugene nah
 
Hey @DaveRandom - any chance cv-pls plugin could pop desktop notifications when a new one is added, in Chrome for example? :)
 
Hi everyone. Is there performance diffrence between double and single quotes?
 
@Jimbo Was kinda implemented in a crap way
 
double is slower
 
@Ocramius by the way, very odd, that doctrine2 CLI tool generated entities without anotations, but I assume, that reason was, that annotations actually where generated *.yml files - mappings, right?
 
9:59 AM
@Jimbo It's been on the issues list for a long time. We'll get around to it eventually
 
but jsut a tiny amount
 
In case with plain text.
 
I have temporary disabled it until it actually works @Jimbo
:P
 
@PeeHaa @DaveRandom Ah cool, looking forward to it then :)
 
10:00 AM
Actually maybe quite soon, I want a way to notify the user when the plugin is upgraded as well, and the moment Chrome is kinda crap, it just updates the plugin silently and it just stops working until you refresh the page
 
@DaveRandom I haven't got that plugin work yet :(
 
guys, why does $output = preg_replace('/([.!?])\s*(\w)/e', "strtoupper('\\1 \\2')", ucfirst(strtolower($input)));
 
It just get downloaded not getting install in my crome
 
remove paragraph breaks?
 
@Rikesh There are no known issues with it just plain not-working, what happens?
 
10:01 AM
@Rikesh Under chrome you have to download it and go to chrome://extensions
 
And drop it in there
 
@Gordon Muahhahaha
 
10:02 AM
@Eugene I think there's flags to generate the annotations. You don't need annotations if you have YML/XML
 
@PeeHaa the bad thing about it is that I wrote a rather lengthy blog post refuting him
 
@Gordon Not for me, I think he just changed it, it now says This post has been updated since it was first published.
 
@Ocramius yep, that was my assumption
 
yay it's back
 
@DaveRandom he must have done it just this moment then
 
10:04 AM
He is publishing <-> un-publishing :p
Or might be server issue
 
hm, he is making a few of the points I was going to make in my post, too, now
of course, his entire argument to always return something is moot now
 
@Gordon is it just me or 404? O_o
 
ah, nvm, saw it now
 
anyone here know regex?
whats this doing? '/([.!?])\s*(\w)/e'
 
10:12 AM
@David19801 Finding the first letter of a sentence I guess, but only if it comes after another sentence.
 
its back online for me
 
@David19801 Hmm, perhaps it makes sure each starting letter is capitalized?
 
Need some css help, anyone there ?
 
The comment by sebastian krebs is awesome: “Can you give me the sugar?” — “Brandon” — “And a cup?” — “Brandon”
rofl
 
@Neel Just ask it
 
10:24 AM
I gave that brandon guy the benefit of the doubt, but I tend to agree with @tereško now about the fact it's just to pitch his book and site
 
Morning all
 
Morning
 
morning
 
@Gordon is mod?! :D
Congratulations
 
@iroegbu thanks
 
10:32 AM
yes, before I forget...
anyone know of an algorithm that can help me get stuff thus:
user searches for "stck"
I have "stack"
then I suggest to user "stack found instead of 'stck'"
@Gordon UW
 
@iroegbu depending on the effort you are willing to take, consider solr or cassandra
 
solr is veeeeeery nice imho
and damn fast
 
user1642018
hello all,
 
user1642018
i am stuck with php issue
 
user1642018
10:35 AM
how can i use the if condition in echo ?
 
@PeeHaa Lol
 
Example code please
 
user1642018
here it the code
 
user1642018
<?
$sites=mysql_query("SELECT * FROM sites");
	while($site = mysql_fetch_array($sites)){
	$selected='selected = "selected"';
	echo '<option '.if($_POST['siteid'] == $site['siteid']){$selected;}.'value="'.$site['siteid'].'" label="'.$site['name'].'">'.$site['name'].'</option>';
	}
?>
 
And use fixed font please :-)
 
10:35 AM
Wait, why does it say "MD-40"?
We have "WD-40"
 
@AmbroseBwangatto edit and click fixed font please
 
@Gordon ok thanks, will look at both
 
@Jimbo lol. You're right
:P
 
user1642018
done
 
@AmbroseBwangatto I'd use printf to format that string. increases readability a lot. for the if you could use a ternary then
 
10:37 AM
i've set type as longtext even then mysql not accepting huge values(query gets exicuted for small texts)...any clues
 
Or do this:
$selected = '';
if($_POST['siteid'] == $site['siteid']) {
    $selected = ' selected="selected" ';
}

echo '<option '.$selected.'value="'.$site['siteid'].'" label="'.$site['name'].'">'.$site['name'].'</option>';
 
user1642018
@PeeHaa trying it now
 
Try something like this (its called shorthand conditions):
echo '<option ' . (($_POST['siteid'] == $site['siteid']) ?$selected : "") . 'value="'.$site['siteid'].'" label="'.$site['name'].'">'.$site['name'].'</option>';
 
user1642018
@PeeHaa its working, thanks man.
 
user1642018
@dragon112 checking it, thanks
 
10:40 AM
@AmbroseBwangatto see below
printf(
        '<option %s value="%s" label="%s">%s</option>',
        $_POST['siteid'] == $site['siteid'] ? $selected : '',
        htmlentities($site['siteid']),
        htmlentities($site['name']),
        htmlentities($site['name'])
    );
 
np. Although you may also want to consider @Gordon's remark about using printf to make it more readable
 
user1642018
@PeeHaa sure thing.
 
Damn why am I always too late :(
 
@PeeHaa You aren't late, @Gordon is just insanely fast ;)
 
:-)
 
user1642018
10:41 AM
you guys are fast
 
user1642018
@Gordon this looks complicated for me., i am still newbie. :)
 
@AmbroseBwangatto because you are not used to it. try it a few times and you will find that it's actually much more readable. the first argument is a template. all the arguments following get inserted where it says %s (which means a string).
 
user1642018
@Gordon okie., but how does it knows where to put the siteid and where to name ?
 
@AmbroseBwangatto the $_POST['siteid'] == $site['siteid'] ? $selected : '', is called ternary operator. it's a shorthand notation for if else. you should use it sparingly but for printfs its perfect
 
user1642018
@Gordon okie., now i am getting it, just like = for echo
 
10:46 AM
@PLB @PeeHaa @Gordon
http://chat.stackoverflow.com/transcript/message/8260182#8260182
 
@AmbroseBwangatto it replaces each occurence of %s with the arguments following the template, so if you have printf("Hello %s", 'World') it will replace %s with "World". Also see php.net/printf
 
@pbvamsi Don't just ping everybody in here
 
@AmbroseBwangatto the htmlentities is to protect your output from XSS. google XSS if you dont know what it means. its important. Also mind @PeeHaa's advice below:
 
Although you should often just use htmlspecialchars and set the encoding :)
 
user1642018
@Gordon okie, i know little xss but mainly i used to focus on sql injection.
 
10:47 AM
@Gordon this is why I was told not to use htmlspecialchars before inserting into db
I should use it when outputing instead?
 
@iroegbu no
Only when displaying it
yes. that :)
 
ok
 
And also depends on where yuo are displaying it
If you are writing to a text file you obviously shouldn't :)
 
ok... just to browser
 
@PeeHaa yup. it will still be broken then but not an attack vector
 
@Gordon @PeeHaa this should do? php.net/manual/en/book.solr.php
 
@iroegbu that's one option. but there is other APIs you can pick, too if the native one feels cumbersome.
 
Hey everyone!
 
I've seen people complaining about SSH2 and they recommend another lib instead, but tbh I've had nothing but success with ssh2 via pecl...
 
11:13 AM
Well I'm off, see you all later.
 
The behaviour of DateTime::createFromFormat('Y-m-d', '2013-01-30')->modify('+1 month'); is unbelievably stupid. I have just been screwed over by that big time.
 
PLB
@pbvamsi It depends. There are few things to check. By default length of LONGTEXT is 4 gb (2^32 - 1). If data exceeds that limit or if actual physical memory is less than 4 gb data won't be inserted properly. Also query might be taking too long and times out. Protocol limitations should be checked also.
This is not complete list, of course. These things came up first. Anyway, I hate these kind of questions.
 
There is room for all of us. a good link thanks :)
 
Internet is so crap at work, i'm tethering over 3G -.-
 
@Jimbo internet was mostly non-existent half of the day for me
 
11:23 AM
@Jimbo I'm whining about the slow connection at work but at least I'm getting around 4-5 mbits.
 
@DaveRandom haha
 
We keep going down to 200B/s :/
 
Now that's super funny
 
@Jimbo even the 90's were better off than you
 
@DaveRandom how are you going to fix that? Write your own method?
 
user652649
hello chaps
 
@DaveRandom Hmm, how to install .crx with Chrome on Mac? :)
 
@Jack No idea, does it not work the usual way? Just go to the extension page and drag/drop the file onto it...,
 
It downloads the .crx ... double clicking in finder doesn't do anything.
 
@Jack It's probably not associated with Chrome, double clicking doesn't do anything in Win either
 
11:48 AM
@DaveRandom It just shows the error "Apps, extensions and user scripts cannot be added from this website."
From Settings -> Extensions it can't be installed either.
oh wait, one thing i haven't tried yet ... hold on
aha!
installed it ... like a boss! i.e. slowly.
 
2 messages moved to bin
$date = DateTime::createFromFormat('Y-m-d', '2013-01-30');
$expectedMonth = $date->format('n') + 1;
$date->modify('+1 month');
if (((int) $date->format('n')) !== $expectedMonth) {
    $date->modify('last day of last month');
}
echo $date->format('Y-m-d');
 
@Gordon Congrats :)
 
@iroegbu ^^ is what I have actually done, that was wrong
@Jack lol. Are there any useful instructions we could add to the readme?
 
was just looking at it
 
I thought mass downvoting only happened for jquery questions ;-) — Jack 19 secs ago
 
11:55 AM
was wondering, how manage it was working... not properly though, without:
$expectedMonth = $date->format('n') + 1;
 
@DaveRandom No, it was just stupid me ... the instructions work fine ;-)
 
@DaveRandom - Cool I get it install too :)
Just waiting to see it work ;-)
 
Ooh, there was another build of the site ... now it says how many delete votes are required to delete an answer / question ;-)
 
@Gordon You're probably sick of this by now, but congratulations on being elected.
 
11:59 AM
@Jack Yeh I saw that, we are (I am) planning to add that to the plugin as well somehow, although Shog was saying those numbers aren't guaranteed to be absolutely correct for some reason
 

« first day (880 days earlier)      last day (4051 days later) »