for (var i = 0; i < 5; i++) {
setTimeout(function() {
console.log(i);
},i * 1000 );
}
Hello, in the following piece of code, the value of i is always 5 , in the console.log(). Why?
for (var i = 0; i < 5; i++) {
setTimeout(function() {
console.log(i);
},i * 1000 );
}
Hello, in the following piece of code, the value of i is always 5 , in the console.log(). Why?
I see that since I don't know which version of MySQL the group by forces to enter all the fields of the select. (this is configurable, but I have no option to change it). I don't understand why you have to put all the fields of the select in the group by, if I only want to group by the user id for example.
If someone is kind enough to explain (for fools, with apples) the reason for this, I would be eternally grateful... I'm looking on the internet, and I don't understand the reasons they give. They say they are good practices, but until recently it could be done without problems and now... :(
A website had an external website linked by a iframe
, for example:
example.com/hls/archive.php?token=f4290354ed8529245633fd8266a8238c44e4ef5aa87d50ff16
I liked that content and linked it on my website, but it didn't show me the data after analyzing your website one after another I realized that my URL where the iframe
content was had to add this:
misite.com/iframe.php?noimportaesto=example.com
The domain taken by $_get
= =example.com
was the key token f4290354ed8529245633fd8266a8238c44e4ef5aa87d50ff16
to access the content.
From there, my idea is born to block the access of each topic that my content subdomain has (ex. view.site.com/contenido1.php
) block access if it enters with an token
expired or invalid one, and if that is the case show a warning message communicating that you will be redirected in x
seconds to another website.
But access to the content must be unique, only for that user, that is, they cannot share the generated link with the token
, and if they do, the content is not displayed.
And that this token
generated is only valid for the content that was redirected from the domain example.com
to the content: that only that URLview.site.com/contenido1.php
allows access , if you try to access other content , that is not valid, you must always generate a from the domain to access to said or other content.contenido2.php
token
example.com
If the security of is broken
token cookie
or is not found, it simply becomesfalse
, and if it exists it becomestrue
.
The token will be generated using new PHP technology , including the use of: bin2hex(random_bytes)
orbin2hex(openssl_random_pseudo_bytes)
.
No use of database or use of .htaccess
, the token
only one must be saved in one cookie
and must expire within 4 hours.
So far I can generate a token
, but I don't know how to validate it with the comments:
<?php
//http://php.net/manual/es/function.phpversion.php
//echo 'Versión actual de PHP: ' . phpversion();
session_start();
$expiry_timestamp = time() + $expiry;
//https://davidwalsh.name/random_bytes //https://secure.php.net/random_bytes
//$token = bin2hex(random_bytes(64)); //Disponible apartir de PHP V 7.
$token = bin2hex(openssl_random_pseudo_bytes(64));
$time_token = 12000;
$time_token = srand(floor(time() / $time_token));
//echo $token;
$_SESSION['token']=$token;
?>
<html>
<head>
</head>
<body>
<a href= "view.site.com/contenido1.php?token=<?php echo $_SESSION['token']; ?>">Contenido 1</a>
</body>
</html>
I do not understand very well how this process would work, can you explain the subject better to me. token
I must work something similar Deactivate session after a while only that instead of sesión
using one cookie
that matches the token
only one generated for that user, taking the domain and subdomain as reference keys.
Font:
The truth is that it causes me a lot of confusion to see this type of operators, I don't know what it means or why it is placed.
checkedit1.CheckStateChanged += CheckValorSi_CheckStateChanged;
We have the following code block:
<?php
var_dump(md5("240610708")=="0e1337");
?>
Which returns bool (true), that is, for PHP the md5 of 240610708 is the same as any string that begins with 0e followed by a number. How does this happen?