strategos Posted April 12, 2012 Share Posted April 12, 2012 Hello, I am new to PHP and am trying to make a script that will ftp into the server via a cron of every hour or so and save the data to a mysql table. The first step is to draw variables out of information in the file via ftp. Its a ban list for a game server I run. How could I get php to single out the ban reason, admin, etc. the looks like this "STEAM_0:0:42741441" { "name" "good mom" "unban" "0" "time" "1329161245" "admin" "(Console)" "reason" "no more trolling for you" } "STEAM_0:1:40563669" { "unban" "0" "admin" "Headcrap(STEAM_0:1:42287608)" "time" "1332855999" "reason" "" } "STEAM_0:1:17693550" { "name" "ʎɖɑɱ" "time" "1323055427" "modified_time" "1323221308" "unban" "0" "modified_admin" "Strategos(STEAM_0:0:26662109)" "admin" "Strategos(STEAM_0:0:26662109)" "reason" "And so died the trolling" } Example: <?php $bannedid = "STEAM_0:0:42741441"; $bannedby "(console)"; // and so on ?> Quote Link to comment https://forums.phpfreaks.com/topic/260786-import-details-from-file/ Share on other sites More sharing options...
dhmm Posted April 12, 2012 Share Posted April 12, 2012 Hello !!! I can help you but sorry about my English... Because, I'm learning ( You're new in PHP / I'm new in English ) For your question... Your data is in the file ??? Or your data is in the MySQL ??? Where is the ban data ? Quote Link to comment https://forums.phpfreaks.com/topic/260786-import-details-from-file/#findComment-1336618 Share on other sites More sharing options...
Muddy_Funster Posted April 12, 2012 Share Posted April 12, 2012 You should really focus on getting the information indo a much more managebale format. There is no consistancy in that file layout, so getting something to work on that test data may not help on the actual full file, or on future data. First find a consistant format to store the information in and then worry about coding a script to extract it (I suggest xml if databases arn't your thing). Quote Link to comment https://forums.phpfreaks.com/topic/260786-import-details-from-file/#findComment-1336623 Share on other sites More sharing options...
strategos Posted April 12, 2012 Author Share Posted April 12, 2012 Hello !!! I can help you but sorry about my English... Because, I'm learning ( You're new in PHP / I'm new in English ) For your question... Your data is in the file ??? Or your data is in the MySQL ??? Where is the ban data ? The ban data is the first example where the code is not highlighted. It is in a .txt file on a remote server. I want to import that data. I can't change the format of the ban file, because that's how the administration system is designed to interpret it. I want to save key details from the data to a mysql table, but right now I just want to focus on being able to capture the data. Quote Link to comment https://forums.phpfreaks.com/topic/260786-import-details-from-file/#findComment-1336676 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.