Skip to content
Advertisement

Php multiple data insertion with textarea

I have 500+ user:pass and i want add all data with textarea.

Example ;

user:pass user:pass user:pass

I use the following codes to add users individually ;

JavaScript

How can I make this to add multiple data user = username : pass = password

Thanks in advance.

Advertisement

Answer

you could use explode to split your string with a separator for example if you have a string like this

JavaScript

after explode it will be like this

JavaScript

after that, you could explode it one more time from the ‘:’ so you could try something like this

JavaScript

another thing it is so dangerous to save password as plain text so I just add sha1 to add some level of security for hashing the password

Another solution

you could also use regex to be more efficient like this

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement