Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if(!is_dir('user_data')){ mkdir('user_data'); }
- function auto($url){
- $post = curl_init();
- curl_setopt($post, CURLOPT_URL, $url);
- curl_setopt($post, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($post, CURLOPT_FOLLOWLOCATION, 1);
- curl_setopt($post, CURLOPT_SSL_VERIFYHOST, false);
- curl_setopt($post, CURLOPT_SSL_VERIFYPEER, false);
- $result = curl_exec($post);
- curl_close($post);
- return $result;
- }
- function xx($x){
- echo '<pre>';
- print_r($x);
- echo '</pre>';
- }
- function create_random_mank($count){
- for($i=1;$i<=$count;$i++){
- $mal = json_decode(auto('https://api.namefake.com/indonesian-indonesia/random/'), true);
- $data[$i]['fname'] = $mal['name'];
- $data[$i]['email'] = $mal['email_u'];
- }
- $a = fopen('gsuite_tes.json', 'w');
- fwrite($a, json_encode($data));
- fclose($a);
- echo 'DONE....<br>CREATING CSV<br>';
- create_csv();
- }
- function save_data($val, $send){
- $asssda = glob('user_data/*.csv');
- $jumssada = count($asssda)+1;
- $destination = 'user'.$jumssada.'_create.csv';
- $sell = 'send'.$jumssada.'.txt';
- $a = fopen('user_data/'.$destination, 'w');
- fwrite($a, $val);
- fclose($a);
- $se = fopen('user_data/'.$sell, 'w');
- fwrite($se, $send);
- fclose($se);
- echo '<a href="user_data/'.$destination.'">'.$destination.'</a>';
- }
- function create_csv(){
- $a = fopen('user_data/MASTER.txt', 'a');
- $data = json_decode(file_get_contents('gsuite_tes.json'), true);
- $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]';
- $out .= "\r\n";
- foreach($data as $fname){
- $cut = explode(' ', $fname['fname']);
- $em = $fname['email'];
- $out .= $cut[0].','.$cut[1].','.$em.'@stialan.ac.id,pass,/,janter.dm13@gmail.com,False,';
- $out .= "\r\n";
- $send .= $cut[0].' '.$cut[1].':'.$em.'@stialan.ac.id';
- $send .= "\r\n";
- fwrite($a, $em.'@stialan.ac.id');
- fwrite($a, "\r\n");
- }
- fclose($a);
- save_data($out, $send);
- }
- create_random_mank(50);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement