Guest User

Untitled

a guest
Jun 27th, 2018
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.32 KB | None | 0 0
  1. <?php
  2.  
  3.  
  4. $con = mysql_connect('localhost', '', '');
  5. mysql_select_db('test');
  6. mysql_query("SET NAMES 'UTF8'") or die(mysql_error());
  7.  
  8. $no = 0;
  9.  
  10. $file = fopen("inkpass.txt","r");
  11.  
  12. while(! feof($file))
  13. {
  14.     $line = fgets($file);
  15.    
  16.     $line = iconv('ISO-8859-1', 'UTF-8', $line);
  17.    
  18.     //id | username | nickname | email | sex | bornyear | tlf | password (MD5)
  19.    
  20.     list($id, $username, $nickname, $email, $sex, $bornyear, $tlf, $password) = explode('|', $line, 8);
  21.    
  22.    
  23.    
  24.     $id = trim($id);
  25.    
  26.     $username = trim($username);
  27.     if ($username == ""){$username = "NULL";}
  28.    
  29.     $nickname = trim($nickname);
  30.     if ($nickname == ""){$nickname = "NULL";}
  31.     $nickname = addslashes($nickname);
  32.    
  33.     $email = trim($email);
  34.     if ($email == ""){$email = "NULL";}
  35.    
  36.     $sex = trim($sex);
  37.     if ($sex == ""){$sex = "NULL";}
  38.    
  39.     $bornyear = trim($bornyear);
  40.     if ($bornyear == ""){$bornyear = "NULL";}
  41.    
  42.    
  43.    
  44.     $tlf = trim($tlf);
  45.     if ($tlf == ""){$tlf = "NULL";}
  46.    
  47.     $password = trim($password);
  48.     if ($password == ""){$password = "NULL";}
  49.    
  50.    
  51.     mysql_query("INSERT INTO hemmelig_users2 (id, username, nickname, email, sex, bornyear, tlf, password)
  52.                                     VALUES ('$id', '$username', '$nickname', '$email', '$sex', '$bornyear', '$tlf', '$password')");
  53.                                    
  54.     $no++;
  55.     echo $no . "\n";
  56. }
  57.  
  58. fclose($file);
  59.  
  60.  
  61.  
  62.  
  63. mysql_close($con);
  64.  
  65.  
  66.  
  67. ?>
Add Comment
Please, Sign In to add comment