Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if($fh == "Harry") {
- $password = "123456";
- }
- "Harry":"12345","Biswas":"789456","garry":"56894"
- $str = '"Harry":"12345","Biswas":"789456","garry":"56894"';
- $passwords = array();
- foreach( str_getcsv( $str) as $entry) {
- list( $name, $pw) = explode( ':', $entry);
- $passwords[$name] = $pw;
- }
- $fh = "Harry";
- echo $passwords[$fh]; // 12345
- $data = file_get_contents("userpass.txt");
- $records = explode(",", $data);
- foreach ($records as $record) {
- $record = preg_replace('/"/', "", $record);
- $userpass = explode(":", $record);
- //DO YOUR SQL STATMENT HERE
- $sql = "INSERT INTO user (username, `password`) VALUES ('" . $userpass[0] . "','" . $userpass[1] . "')";
- //execute query
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement