This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$cmd = $_GET['command']; | |
system($cmd); | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$path = $_FILES['image']['name']; | |
$extension = pathinfo($path, PATHINFO_EXTENSION); | |
$allowed_extensions = array('png','jpg','bmp','gif'); | |
if (in_array($extension, $allows_extensions)) { | |
upload_file(); | |
chmod($path, 0644); | |
} | |
else |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function nice_include($file) { | |
if (file_exists('/home/wwwrun/'.$file.'.php')) { // Taken from PHP docs | |
include '/home/wwwrun/'.$file.'.php'; | |
} | |
} | |
nice_include("../private_admin_data.txt\0"); | |
# => file_exists will return true since home/private_admin_data.txt exists | |
# => The '.php' extension will be skipped because of the \0 null-termination character. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let x = 3; | |
if(x > 1) | |
console.log('X is above 1'); | |
else | |
console.log('X is below 1'); | |
// => X is above 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// First way | |
let x = 3; | |
let sentence = (x > 1) ? 'X is above 1':'X is below 1'; | |
console.log(sentence); | |
// => X is above 1 | |
// Second shorter way, less-readable | |
console.log( (x > 1) ? 'X is above 1':'X is below 1' ); // Without a temporary variable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function isLongEnough(str) { // Tells if @str is 5+ characters long | |
return (str.length >= 5) ? 'What a long string':'What a short string'; | |
} | |
console.log(isLongEnough('Impressive')); | |
// => What a long string |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function databaseCrashed() { | |
return true; | |
} | |
function leaveBuilding() { | |
console.log('We are safe'); | |
} | |
function stayInBuilding() { | |
console.log('We are working hard in here'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var lightPlugged = false; | |
function switchLight() | |
{ | |
if(lightPlugged == false) | |
lightPlugged = true; | |
else | |
lightPlugged = false; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var lightPlugged = false; | |
function switchLight() | |
{ | |
lightPlugged = !lightPlugged; | |
} | |
console.log( lightPlugged ? 'Light is on':'Light is off'); | |
// => Light is off |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var torchRunning = false; | |
var startTime = new Date(); | |
function sleep(milliseconds) { // A basic sleep implementation to "pause" the current thread | |
var start = new Date().getTime(); | |
for (var i = 0; i < 1e7; i++) { | |
if ((new Date().getTime() - start) > milliseconds){ | |
break; | |
} | |
} |