Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Dec 11th, 2013  |  syntax: None  |  size: 0.71 KB  |  views: 32  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. if($fh == "Harry") {
  2. $password = "123456";
  3. }
  4.        
  5. "Harry":"12345","Biswas":"789456","garry":"56894"
  6.        
  7. $str = '"Harry":"12345","Biswas":"789456","garry":"56894"';
  8.  
  9. $passwords = array();
  10. foreach( str_getcsv( $str) as $entry) {
  11.     list( $name, $pw) = explode( ':', $entry);
  12.     $passwords[$name] = $pw;
  13. }
  14.        
  15. $fh = "Harry";
  16. echo $passwords[$fh]; // 12345
  17.        
  18. $data = file_get_contents("userpass.txt");
  19.  $records = explode(",", $data);
  20.  
  21.  foreach ($records as $record) {
  22.     $record = preg_replace('/"/', "", $record);
  23.     $userpass = explode(":", $record);
  24.  
  25.     //DO YOUR SQL STATMENT HERE
  26.  
  27.     $sql = "INSERT INTO user (username, `password`) VALUES ('" . $userpass[0] . "','" . $userpass[1] . "')";
  28.     //execute query
  29.  }
clone this paste RAW Paste Data