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
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.
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 ?
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 ?
here is my structure:
// form.php
<form action="contact_us.php" method="post">
<input name="test" type="text" />...
what 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...
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
@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.
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
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
@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 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.
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! ;)
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.
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
@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.
@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.
@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.
@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 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 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.
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.
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 :(
@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
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); }