djblairq Posted August 12, 2009 Share Posted August 12, 2009 Im working with a script that a friend made me, just adding a few mods to it. And i ran into one problem. The original file produce a digest file with 'user:sitename:password'. I managed to get the file to produce a 2nd digest file called 'digestnames', which makes, 'user:sitename:realname'. Im having trouble getting my downloading script to pull the 'realname' string fromt he digest file, and log it into a txt file. i keep getting it as "Array" and not the users name. Here is a snipet of the script. (for full php files, email me.) ############################################ $nameF = array(); $realF = array(); $rnameF = array(); $myerrLVL = error_reporting(); $realnamepath = "/etc/apache2/passwd/digestname"; error_reporting(0); $realnamefile = fopen( $realnamepath, "r" ) or die( 'Invalid digest file.' ); error_reporting(myerrLVL); $r = 0; while( ! feof( $realnamefile ) ) { $nameF[$r] = fgets( $realnamefile, 1024 ); $nameparsedF = explode( ":", $nameF[$r] ); if( $nameparsedF[1] == "MP3Site" ) { $realF = $nameparsedF[0]; } $r++; } fclose( $realnamefile ); ########################################## then the section to post it to the log file is: ########################################## $theLog = '/var/www/logs/Server.txt'; $logDate = date( "m-d-y|H:i:s" ); $logString = $logDate."|".$realF."|".$theUser."|".$filename."\n"; $fID = fopen( $theLog, 'a' ); fwrite( $fID, $logString ); fclose( $fID ); ############################################## Ive pulled my hair out trying to figure this out... with changing variables, ive ended up with results like: 08-11-09|17:15:57||user1|filename.mp3 and 08-11-09|17:15:57|Array|user1|filename.mp3 and 08-11-09|17:15:57|6373ydbdywtdgdywyerifrhgfhwyte|user1|filename.mp3 Im not sure how to pull up the 3rd column of that digest file, and convert the 9832749832ryry87fkef back into normal text and make it readable in the Server.txt file. Please help me!! If you need to know any other info, please email me. [email protected] Over all, all scripts are working 100%, just not the pulling from the 'digestnames' and posting to the log file. Thank you! Link to comment https://forums.phpfreaks.com/topic/169869-help-pulling-string-from-an-array/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.