Last active
January 3, 2016 01:49
-
-
Save rat/8391359 to your computer and use it in GitHub Desktop.
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
// lista arquivos no diretorio | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <dirent.h> | |
int main(void) | |
{ | |
DIR *dir; | |
struct dirent *lsdir; | |
dir = opendir("tmp//"); | |
/* print all the files and directories within directory */ | |
while ( ( lsdir = readdir(dir) ) != NULL ) | |
{ | |
printf ("%s\n", lsdir->d_name); | |
} | |
closedir(dir); | |
return 0; | |
} | |
//renomeia tmp para lol | |
#include <stdio.h> | |
int main() | |
{ | |
rename("tmp\\", "lol"); | |
return 0; | |
} | |
#include <stdlib.h> | |
#include <io.h> | |
#define TMP_DIR "spool/" | |
int main(void){ | |
if (access(TMP_DIR, F_OK) != -1) { | |
rename(TMP_DIR, "outgoing/"); | |
} | |
return 0; | |
} | |
<?php | |
// Checks whether the directory exists | |
if (!file_exists('tmp/')) { | |
mkdir('tmp/', 0777, true); | |
} | |
// Make file | |
while (true) { | |
$filename = uniqid(rand()); | |
if (!file_exists('tmp/' . $filename)) { | |
$file = fopen('tmp/' . $filename, 'w'); | |
fwrite($file, $_POST['phone'] . PHP_EOL . $_POST['sms']); | |
fclose($file); | |
break; | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment