SHARE
TWEET

anu

a guest Nov 9th, 2019 148 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. if(!is_dir('user_data')){ mkdir('user_data'); }
  3.  
  4. function auto($url){
  5.     $post = curl_init();
  6.     curl_setopt($post, CURLOPT_URL, $url);
  7.     curl_setopt($post, CURLOPT_RETURNTRANSFER, 1);
  8.     curl_setopt($post, CURLOPT_FOLLOWLOCATION, 1);
  9.     curl_setopt($post, CURLOPT_SSL_VERIFYHOST, false);
  10.     curl_setopt($post, CURLOPT_SSL_VERIFYPEER, false);
  11.     $result = curl_exec($post);
  12.     curl_close($post);
  13. return $result;
  14. }
  15.  
  16. function xx($x){
  17. echo '<pre>';
  18. print_r($x);
  19. echo '</pre>';
  20. }
  21.  
  22. function create_random_mank($count){
  23.     for($i=1;$i<=$count;$i++){
  24.         $mal = json_decode(auto('https://api.namefake.com/indonesian-indonesia/random/'), true);
  25.         $data[$i]['fname'] = $mal['name'];
  26.         $data[$i]['email'] = $mal['email_u'];
  27.     }
  28.     $a = fopen('gsuite_tes.json', 'w');
  29.     fwrite($a, json_encode($data));
  30.     fclose($a);
  31.     echo 'DONE....<br>CREATING CSV<br>';
  32.     create_csv();
  33. }
  34.  
  35. function save_data($val, $send){
  36.     $asssda = glob('user_data/*.csv');
  37.     $jumssada = count($asssda)+1;
  38.     $destination = 'user'.$jumssada.'_create.csv';
  39.     $sell = 'send'.$jumssada.'.txt';
  40.     $a = fopen('user_data/'.$destination, 'w');
  41.     fwrite($a, $val);
  42.     fclose($a);
  43.     $se = fopen('user_data/'.$sell, 'w');
  44.     fwrite($se, $send);
  45.     fclose($se);
  46.     echo '<a href="user_data/'.$destination.'">'.$destination.'</a>';
  47. }
  48.  
  49. function create_csv(){
  50.     $a = fopen('user_data/MASTER.txt', 'a');
  51.    
  52.     $data = json_decode(file_get_contents('gsuite_tes.json'), true);
  53.     $out .= 'First Name [Required],Last Name [Required],Email Address [Required],Password [Required],Org Unit Path [Required],Recovery Email,Change Password at Next Sign-In,New Status [UPLOAD ONLY]';
  54.     $out .= "\r\n";
  55.     foreach($data as $fname){
  56.         $cut = explode(' ', $fname['fname']);
  57.         $em = $fname['email'];
  58.         $out .= $cut[0].','.$cut[1].','.$em.'@stialan.ac.id,pass,/,janter.dm13@gmail.com,False,';
  59.         $out .= "\r\n";
  60.         $send .= $cut[0].' '.$cut[1].':'.$em.'@stialan.ac.id';
  61.         $send .= "\r\n";
  62.         fwrite($a, $em.'@stialan.ac.id');
  63.         fwrite($a, "\r\n");
  64.     }
  65.     fclose($a);
  66.     save_data($out, $send);
  67. }
  68.  
  69. create_random_mank(50);
  70.  
  71.  
  72.  
  73. ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top