« first day (1744 days earlier)      last day (3426 days later) » 

01:59
morning
02:31
what happens when I use of `session_destroy();` ?
session is server side, and when I destroy it, the all of users that are logged in my website will be log out ?!
@stack afaik its only for related session id Quoting from php manual destroys all of the data associated with the current session and here current session refers to particular session id
@stack no, only the current user
It's not session_destroy_all()
That's called sudo service memcached restart
Session for each user is stored separately?
Yes, when you start session it generates <strike>random</strike> unique id
02:36
@NullPoiиteя I see !!
Well, random, anyway.
thanks
@Sherif isnt it not random ?
@NullPoiиteя Yes
It is is not not random :)
then using of session_destroy(); is not bad, right ? (The site will not be impaired)
02:41
bad ? No. depends on how you do that ;)
holy crap. PEAR has a blog?!?!
What the PHP is happening?!
I have a form (named contact_us) and I want when user send us a letter, I show him a message 'has been sent', Now for showing that message (has been sent) I need to use of session, right ?
now I want to when I show the message, then destroy it.
now using of destroy in my case is good or bad ?
In all the years I've been using PHP I never once knew blog.pear.php.net even existed.
@stack No, you don't need a session for that.
@Sherif what is PRG ?
@stack PRG
02:44
Pear blog is really frequent :D
it's really slow
@NullPoiиteя So which one of the 7.3 billion people on earth read that thing?
@Sherif what is PRG ?
those who write for pear blog :P
Someone POSTs a contact request, you send the message, and redirect them to /success page
or /failure page
depending on which one you plan on doing
02:46
@Sherif your mean is I send my message az a argument in the url ? (get method)
@stack Nope
@stack do it by ajax. Make ajax call ->submit message ->show result. Thats it
I mean you let PHP make the decision to redirect them to a success page if the message was sent successfully.
@Sherif I have not failure page or success page, I want to show him a message in the form page
@stack Same thing
02:48
please some one tell me HOW I send a message 'has been send' form one page to another ?
@NullPoiиteя ajax is fine, but If I don't want to use it, should I use of session for sending a message from one page to another, right ?
Stop thinking of it in terms of "one page to another" and start thinking of it in terms of request/response.
Then it actually begins to make sense.
Pages are this illusion that only exists in your head. They're not real :)
good morning
In my new job, my boss told me to use his crappy 2005 php framwork where i have to directly inject $_REQUEST to sql query without escaping or sanitizing and he told me XSS is not a real thing :D
thanks for your code. and ok request/response ! but how get response ?
form.php (contained a form and action='contact_us.php')
now I have a message in the contact_us.php. how I send that message to form.php ?
02:55
@stack (∩ ͡° ͜ʖ ͡°)⊃━☆゚. * ・ 。
2
@Sherif so you too just echo $_GET['whoa']; :P
@Sherif and which truth would that be?
@ircmaxell That you are a slave database?
can you not use the same named capture groups in preg on both sides of alternate groups... that sucks
03:05
@Sherif I am not a database. If anything, I am a key-value store
@ircmaxell Hah!
@ircmaxell HTTP/1.1 418 I'm a teapot
@ircmaxell but are you web scale?
no, document stores are web based, not key-value stores
you don't understand anything, do you?
nothing at all :)
03:11
@FlorianMargaine No, not really.
0
Q: sending data from a page to another (request/response)

stackI have a form (named contact_us). and I want when user send us a letter, I show him a message 'has been sent', Now for showing that message (has been sent) I need to use of session ? here is my structure: // form.php <form action="contact_us.php" method="post"> <input name="test" type="text" />...

Wouldn't it have made so much more sense if the Matrix was just about a guy trolling people on the web?
@Orangepill nope, I am not web scale
The web isn't web scale.
Enter: HTTP 2.0
@ircmaxell var_dump($store);
03:23
0
Q: krajee fileupload plugin DELETE URL response

animaacijawhat kind of json should i return, if i want to enable user to delete just uploaded image. That red garbage-can button does not send any requests, just deletes image from a view, not from a server. I look at this manual i respond on each upload now like this: $p = [ 'error' => '', 'initialPrevi...

@bwoebi (recursion protection hasn't been implemented yet)
@ircmaxell stupid bug.
03:51
Doesn't look like they put a lot of their "web 2.0" background into practice
That's the kind of web you expected back when AOL was still telling us "you got mail!"
04:04
sure it's just a css not loading issue.. page looks semantically authored (except for the redundant header)
I think I may have found a loophole with my United debacle
What are they doing to you... denying earned status?
refusing to let me change a flight
Ouch... did you try contacting them through the mileage plus helpdesk... you are a frequent flier you might be able to get some traction from them.
tried and failed
though I may have found a loophole. Will try tomorrow
04:19
We did all of the mileage plus fulfillment a few years back (when they merged with Continental) ... so the 12 page book you got when you requalified that year I sent out :)
That project was a case study in non standard use of php... all those books where marked up in html using php for variable content (8 languages with a total of 1200 and change variable copy blocks) along with some variable svg graphs drawn on several of the versions. html was then rendered to pdf for printing using princexml
how destroy 'post request' after 1 time ?
@stack what do you mean ... you mean don't allow a person to post again after having posted once?
@Orangepill I have a form (in the form.php), the action of that is (search.php). when I submit my form, I see the result of search in the search.php. Now I want when I refresh search.php, the argument be empty. Like when I open search.php directly.
04:32
Post/Redirect/Get (PRG) is a web development design pattern that prevents some duplicate form submissions, creating a more intuitive interface for user agents (users). PRG supports bookmarks and the refresh button in a predictable way that does not create duplicate form submissions. == Duplicate form submissions == When a web form is submitted to a server through an HTTP POST request, a web user that attempts to refresh the server response in certain user agents can cause the contents of the original HTTP POST request to be resubmitted, possibly causing undesired results, such as a duplicate web...
that or stop using sessions to store your search term
alright. thanks
@ircmaxell If you have a moment can you offer any criticism on this answer.
@Orangepill here is my structure. please check out it ...
@stack and you want to prevent refreshing the page from rerunning the same post code
my problem is: when I submit the form, data inserts in the database, and when I refresh the page, data inserts 'again'
04:44
After prompting you if you want to repost the data.
then you want to go with the PRG technique as described above..
@Orangepill so what can I do ? I want data just one time insert in the database and then post request be destroy.
instead of outputing content on the post you stuff the data into the database then do a redirect to a different page (like maybe a success page)
like here
@Orangepill your mean is I create a new file ?
maybe... if that's what you need to do to accomplish what you want.
hurp durp
my extension blows up in PHP 7 yay!
04:49
@stack to emulate what you are doing now just make a success.html page and do your redirect there
@sherif what extension is that?
@Orangepill if I create a new file for redirecting, then I can not send a variable ($msg = 'has been sent') to main page
if it fails do something different then... only send to the success page on success and the success message can be static
@Orangepill i'm novice a bit and I can not undrestand what you said. never mind. anyway thanks.
 
2 hours later…
06:46
Hey everyone, I am going in for an interview on Monday for a back end PHP development position. I have just started applying two weeks ago and have had one interview and two more next week. I am very confident in my abilities, and I am definitely at the junior level, but the interview i am going in for on Monday is a two hour interview. I am concerned about what will take so long in the interview process. Is it possible I will be tested? I have good experience but I still frequently check the
docs for reference. Any advice on what to study?
07:29
@samrap 2 hours is actually a pretty short technical in-person interview. I would say you should brush up on data structures and algorithms. That's usually a core focus of most technical interviews. Design and infrastructure may also help.
@samrap This might be a good read for ya phpden.info/why-do-i-need-to-know-how-to-reverse-an-array
07:47
thank you @Sherif also, though a few years old, what do you think of this: woodstitch.com/resources/php-interview-questions.php
i know most of those, some i need to brush up on, but is that a pretty accurate list as well?
@samrap Depends on your definition of accurate. Those questions are pretty php-specific. Anyone with an internet connection and a few days of working with PHP under their belt could probably answer those questions. I'd be wary of any interviewer that feels such questions asses the skills of anything other than your ability to memorize time-sensitive answers that will likely change in a few years.
so i should focus more on concepts like data structures and algos like you recommended?
Depends on the company. Are they looking to hire someone that knows PHP or are they looking to hire a good developer?
^ this
but if you want to get better yourself (not for the company or interviews) then you should know data structures and algos
that's a good question. this particular company is a web development and IT company so I would assume they are looking for the latter. However, my interview on wednesday might be more of the former, I'm not sure.
and yes @nikita2206 i do want to be a better programmer, but i also want to get the job! ;)
08:00
Think of it like this: knowing the answers to those questions is like knowing what to think. Knowing how to implement array_reverse is like knowing how to think. Which one do you feel is going to make you stand out and land more jobs? The guy that knows what 400K other people also know? Or the guy that make things 400K other people will use?
Long-term goals vs. short term. You figure out how to strike a good balance there.
As long as they consider you on a junior position that'll probably be fine if you don't know everything
Well, you're never going to know everything.
That's a unicorn.
Yeah I should've said 'if you don't know much' probably
You know what you know and know what you don't know.
That's important too.
I don't expect to ever know everything, but I just want to be able to impress the interviewer. I know I am more than capable for a junior level web dev position, but I'm not very strong with algorithms
08:08
@samrap Here's a typical jr level interview coding problem for you codepad.viper-7.com/Zt8u2C
If you were going for front-end I'd give you the auto-complete throttle problem :)
I have to say the simplest problems are usually what stump most jr devs who walk into an interview very confident.
I have a test that fails on travis ...
has anyone ever done anything like valgrind failing tests on travis, wonder if a snippet exists to do that ?
@Sherif what's auto-complete throttle?
like, a delay before auto complete tries to guess something?
@nikita2206 Yes, you have an input text for autocomplete that triggers an ajax function on key-press event. How do you prevent it from sending more than 1 request per 100ms to the server.
So if I'm just banging on the keys I'm not hammering the server.
scratch that ... I stabbed in the dark and was successful ...
Actually, not per 100ms, but rather no more than 1 request within 100ms of triggering the key press event.
08:31
@JoeWatkins Did you mean run a valgrind test in travis or valgrind travis?
I mean take phpt failures (from run-tests.php in an extension) and valgrind the failing tests and show output on travis build ...
Ahh, so run a valgrind test in travis then
travis is meant to be the thing that stops us saying "it works on my machine", but quite often it works on my machine and not on travis ...
heh
I'm trying to remember the hoops I had to jump through to do that once
I thought there would be hoops ...
08:35
Yea, but this wasn't even a php test so ... brain racking required
Yeah I had this problem with travis, I think the best way is to get the travis build image and run it on your machine
09:22
moin , come to party plug.dj/c-l-o-u-d !!
09:33
@bwoebi PHPDBG (current master) segfaults on shutdown when running PHPUnit. Known issue?
@SebastianBergmann Regarding finding the phpdbg binary, I'd just search in the PHP_BINARY directory and otherwise error and require the binary to be passed with a command line option.
@bwoebi I opened bugs.php.net/bug.php?id=70138 now
@kelunik Yes, it might be as easy as that.
An option in the xml file isn't that good, because of different setups.
I want to store the username and password of user in the cookie. Now how many cookie I need to? two ? one for username and one for password ?
@stack Don't ever store passwords in a cookie.
09:46
sry i'm not asking in the correct room!
@kelunik I want user just 1 time log in
I need to store password, is it not ?
but where do you guys recommend to develope a site in?
i use notepad++ by now
@stack Then use a rememberMe cookie with a token: stackoverflow.com/a/17266448/2373138
On a proper operating system using a proper programmer's editor or an IDE.
@kelunik wow !! really thanks
09:48
@animaacija you are current dj there? meh!
@aran jetbrains.com/phpstorm - it has a free trial.
@aran sublimetext.com if you want a free but good tool
@kelunik look, your link is obscure a bit. what is GenerateRandomToken() ? should I create a function in the name GenerateRandomToken ? or what is storeTokenForUser ?
@stack You need to create a cryptographically strong random source to generate a secure token (not predictable), e.g. github.com/ircmaxell/RandomLib with a medium strength generator.
storeTokenForUser is just another placeholder. You (obviously) need to store the token somewhere server-side.
@kelunik ah I see, tnx
10:03
@aran If you're a student, you get a free license for PhpStorm. Before using PhpStorm, I used Atom.
mornin'
I hate PhpStorm
@aran also, in my experience the "notepad++" option is usually defended by people who have never looked at any other editor
@tereško any particular reason?
what do you mean?
@Danack nothing that I can point my finger at
sure if sb has tried nth else they will defend the only one they have tried!
10:09
please use full words
but as I said, that has been my experience with notepad++ users
@kelunik look, I undrestand all of it, just I can't undrestand this: storeTokenForUser($user, $token); what should I do exactly ?
it's usually everyones first editor, but only people who stick with it are the ones who never try anything else
@stack You have to store somewhere, that there's a token $token for user $user, so all this thing should do is saving that information in your database.
@kelunik I need to save token for each $user in the database ? why ?!
30 mins ago, by stack
I want to store the username and password of user in the cookie. Now how many cookie I need to? two ? one for username and one for password ?
are you still trying to do this?
10:16
@tereško yep
don't
@tereško yes, @kelunik told me don't store password
instead after user is logged in generate a random token and store it in user's table
@tereško what is user's table ? database ?
@stack Did you read the full answer? The token is used to authenticate the user, so you have to store it somewhere to check it?
10:18
@kelunik your mean is when user load my webpage, for checking login or not, should I connect to database ? for each page of my website, for each request, should I connect to database ?
@stack Do you already use sessions? If not, skip the rememberMe thing and have a look at sessions first.
^ yep.
@kelunik I know session ! your mean is I get the token from database and put it in the session ?
ok I got it ...!
what is this opparation |= in php?
return $result === 0; always returns 0, right ?
10:30
@tereško then what is === 0 ?
=== is an operator that compares the values and types of values
please. go and learn the basics
@tereško I'm learning now :-)
no, you are guessing and copypasting from google
get this one, read it and then come back
@tereško Please tell me return $result; what difference with return $result === 0; ?
@tereško My main problem is: I don't know english!!!
read the fucking book
10:34
@tereško I think you are nervous, sorry :-)
@stack then you cannot work as a programmer or a hardware tech
english is basically mandatory in this industry
@tereško I know, I'm trying to learn it.
but I don't know very well yet.
reading helps ..
so, I am back to my original statement
ok, don't tell me what is `return $reslult === 0;`, just explain me this:
They are only identical strings if $result is exactly 0...
so .. if $return contains 0, you will get value true,which can get cast as 1
in every other case you will get false
which can be cast as 0
10:39
I see, then the output is boolean !
== compares loosely, because it casts the values before comparing
=== compares strictly, requiring both values to be of the same type
@tereško just one thing. "contains 0" mean exactly 0 ?
@tereško I know ==
@tereško ah ! got it.
@stack You're asking absolute beginner questions. Learn this stuff on your own, there's a plethora of resources out there that answer your questions. Being able to find them is the most important skill.
@Fabor he trolled enough in morning
A guy with 20 rep should be careful with such things.
10:55
ok, sorry for asking.
@stack Not to discourage you, mind you
But being able to figure out things on your own with the help of resources you find online, is an important tool, probably more important than knowing the language itself.
@MadaraUchiha I see, ok, I will search before asking
anyone know any place where i can find remote job ? I have done switching crap companies
^ I probably will be asking same question in a month or so
11:10
in my 2nd last company and I have to work on intel celeron cpu with 1gb ram and there php framwork where i have to write php code in .inc file and include it + adobe dreamweaver i left that job after one day :(
@NullPoiиteя ahahahahah respect
after one day it's bad ass :D
Correct me if I'm wrong, but it's very hard to find companies that use PHP as their main stack pillar and maintain a high quality of coding practices
Tests, proper OO, etc
did you left throwing stuff at people, like, Molotovs?
At least of the companies I've searched here in Israel, I couldn't find a single one that I genuinely appreciated the way they were working.
11:14
Start your own
@MadaraUchiha yes. Hell, in this country most php-shops use CodeIgniter
and I am not exaggerating
@Fabor I all but ditched PHP in the past year or two.
in this country php-shops don't even exist. ecommerce is still alchemy
Other languages simply do it better.
11:17
not one of us ^ GET HIM
@Fabor one could build a company from people in this chat room, but there is the small problem of "where to get clients"
@RonaldUlyssesSwanson Find me one regular in this room that would deny that PHP sucks.
The language itself is fine, I guess. But it's the surrounding "environment" (the actual term slipped from my mind) that make it suck.
The crappy web SAPI, the need for a php.ini, the oh-so-many crap libraries and "MVC" frameworks
PHP as a language in on itself does a lot of things right, and a lot of things wrong, like most other languages out there.
php sucks in a lovable way. it's like courting a very pretty woman hard to seduce
> PHP is Java's retarded, yet lovable cousin.
java is a bit retarded as well
all languages suck
@MadaraUchiha ecosystem is the word you are looking for
i agree though
11:21
@RonaldUlyssesSwanson Yes, thanks
> There are only two kinds of languages: the ones people complain about and the ones nobody uses. -- Bjarne Stroustrup
9
Java has a very mature, but heavy and annoying ecosystem
like libraries ported 1:1 in php that just don't fit the language
JavaScript has a lot of amazing, brilliant ideas (and a lot of horrible, WTF ideas), and an extremely volatile and dynamic ecosystem
like Intl
@tereško true
11:23
PHP, well, PHP doesn't really excel at anything.
@MadaraUchiha it excels at the bar of entry
@tereško I'm past that.
You're past that.
.. from which stems most of it's problems
PHP is a great entry language
@MadaraUchiha true i told project manager also CTO that his e-commerce website is vulnerable to sql injection they were using extract and injecting variable directly in query with mysql_* function and he told me that he needs to get work done and i have to do the same without any security and performance
11:23
But why stay?
@NullPoiиteя exterminate a table or two with a proxy.
Security doesn't make you money.
It prevents you from losing it.
Which is equally, if not more important.
Seems kind of low...
11:25
> // I hate this fucking crappy shit ~ Some PHP dev, probably
2
@tereško Why stay with PHP if its only remarkable feature is the low entry bar?
@MadaraUchiha because we can't be sure to achieve the same quality with some other language in short time
learning requires time
@RonaldUlyssesSwanson That's a lame excuse and you know it.
That's an excuse made by people who will be obsolete way, WAY before they reach retirement age.
And also, @tereško knows other languages.
As I'm sure most of the regulars here
my practical experience with Java, C# and C++ is kinda limited ans my Erlang skills are not up to par
so, essentially, I have only two languages: php and js ... and I have been learning ES6 now, for self-improvement
@MadaraUchiha i'm just saying that you need to wait for the right moment
and honestly i don't feel other languages are appealing enough to justify the change
@tereško To be fair, I was accepted to my current workplace, which is mostly Java, with nothing but PHP and a little JS
I learned Java on the go
11:31
.. also, I don't like java
@tereško Only people who are very used to C are fond of Java
that might be by design
Java solved 2 of C's most horrible bug factories, symmetry (or lack of) and pointer arithmetics
@MadaraUchiha and fucked it all up by not having 'functions' in the language.
@Danack Java has functions
They just have to be attached to a class, which sucks.
static methods are essentially functions
11:34
python -> no types
csharp, scala, java -> too verbose
ruby -> nope. nope. nope.
javascript -> immature
haskell -> better learning ancient egyptian
rust is cute
Java understands OOP as "everything has a class"
> static methods are essentially functions
A donut is effectively a coffee cup - you just need to apply the right transformations.
mmm coffee and donuts
@RonaldUlyssesSwanson How is JavaScript immature?
@RonaldUlyssesSwanson php -> the best
11:35
server side js @MadaraUchiha
It's out there longer than PHP has...
@RonaldUlyssesSwanson Server-side JS is just JS with different standard APIs attached
The language is the same...
@MadaraUchiha i believe js is the only language (of those currently popular) that is worse than php :D
The ecosystem is immature, that is true.
The language itself has crap like any other language, but it has a lot of genius in it too.
will wait for es7
@RonaldUlyssesSwanson How so?
Based on what?
11:38
you don't want to discuss this :D
I get a feeling that you do not really know JS, @RonaldUlyssesSwanson
I mean, beyond "jquery programming"
never used jquery ever
!!> var not = fn => (...args) => !fn(...args); not(x => x > 5)(4)
Ah, right, Cap's not here
in JavaScript, 9 secs ago, by Caprica Six
@MadaraUchiha true
The above is a combination of a few extremely powerful and useful features JavaScript has
Features I can only wish PHP would have one day
Lambdas, functional scope (with real closures), functions as objects
@RonaldUlyssesSwanson Only the syntax is es6
php 7.1 will have that
The same result can be achieved with ES5
var not = function(fn) {
    return function() {
        return !fn.apply(null, arguments);
    }
}
How do you do that with PHP (even 7)?
(Genuinely asking here)
This defines a function not that accepts a function, and returns a function that always returns the boolean opposite of the input function, for every set of arguments
So, for function(x) { return x > 5; }, not() of that returns a function equivalent to function(x) { return !(x > 5); }
11:54
function not($fn){
    return function() use ($fn){
        return !call_user_func_array($fn, func_get_args());
    };
};
this?
@RonaldUlyssesSwanson Can you pass functions to it?
As in, actual functions, not "function expressions" that were assigned to a variable
@MadaraUchiha when was the last time you used php? :D
@RonaldUlyssesSwanson About a year and a half ago
11:57
yes you can pass anything callable to it
in fact you can even type hint it:
function not(callable $fn){
    return function() use ($fn){
        return !call_user_func_array($fn, func_get_args());
    };
};
Ah, right, now I remember
$fn can either be a named function, or a method, or a closure
You pass the function name as a string
yep, that still sucks
Or an array of class name/object instance and a string
11:59
[$obj, "method"] yes
So, no, functions are not first class citizens
Which is the point I'm trying to make here

« first day (1744 days earlier)      last day (3426 days later) »