ParallelLogic
Member
- Messages
- 35
- Reaction score
- 0
- Points
- 6
I have a lot of usernames stored in text files stored on my computer. I want to transfer these into a database I have already created. This is not a one time operation however, new usernames will be added to those text files every day, so I need a reliable way to transfer that data into the database.
I have two potential outlines for programs I need, but I don't know how to execute either one:
1. The program that is collecting the usernames and placing them in a file is written in Java (the programming language I know best). The program manually moves the mouse and types on the keyboard to navigate the site in order to collect info (so I can't use my computer over night, but that's not a problem). One solution I have thought of to populate the database would be to crate a PHP page and then have the Java program navigate to the PHP page and manually enter the data into text boxes and then hit an 'acept' button to send the data off to the database. In this instance I don't know how to make the data I'm sending 'safe'. The users have descriptions they can customize and so I'm worried that they have the option to enter harmful commands into their description that may interfere with the database when it is inserted. I also noticed that when I optputed the data from the database, it replaced ' with ' ' which I presume is its way of adding in an escape character (like backspash before a quote in Java). I als notice that if I try to insert a < into the databse, it seems to corrupt the description or something so that when I retrieve that data through PHP, the last thing it returns from the database is the character right before < and then stops executing, so I had to replace all < with the < code (but I'm concerned there may be other special characters or cases I am missing). If there was a built in function in PHP or Java that made text 'safe' for MySQL, that would be very helpful.
2. The other option I considered (but have absolutely no idea how to do) would be to connect directly between Java and PHP and send the data directly to the database. I don't know the necessary code for Java to interact online.
:happysad: Any help is much appreciated, thank you
I have two potential outlines for programs I need, but I don't know how to execute either one:
1. The program that is collecting the usernames and placing them in a file is written in Java (the programming language I know best). The program manually moves the mouse and types on the keyboard to navigate the site in order to collect info (so I can't use my computer over night, but that's not a problem). One solution I have thought of to populate the database would be to crate a PHP page and then have the Java program navigate to the PHP page and manually enter the data into text boxes and then hit an 'acept' button to send the data off to the database. In this instance I don't know how to make the data I'm sending 'safe'. The users have descriptions they can customize and so I'm worried that they have the option to enter harmful commands into their description that may interfere with the database when it is inserted. I also noticed that when I optputed the data from the database, it replaced ' with ' ' which I presume is its way of adding in an escape character (like backspash before a quote in Java). I als notice that if I try to insert a < into the databse, it seems to corrupt the description or something so that when I retrieve that data through PHP, the last thing it returns from the database is the character right before < and then stops executing, so I had to replace all < with the < code (but I'm concerned there may be other special characters or cases I am missing). If there was a built in function in PHP or Java that made text 'safe' for MySQL, that would be very helpful.
2. The other option I considered (but have absolutely no idea how to do) would be to connect directly between Java and PHP and send the data directly to the database. I don't know the necessary code for Java to interact online.
:happysad: Any help is much appreciated, thank you