BobbyRC Posted March 6, 2009 Share Posted March 6, 2009 I'm trying to code a module for a pre-existing bot that runs on deviantart.com's chat network. I'm getting errors, and I don't really know if I'm going about this the right way, so I figured I'd post the code and see if anyone is willing to lend some advice. The code uses a text file I'm trying to store stats in for each user of the room. function c_editstat($ns, $from, $message, $target) { $fname = "userstats.txt"; $user = args($message, 1); $newstat = args($message, 2); $fhandle = fopen($fname,"r"); $content = fread($fhandle,filesize($fname)); $oldstat = strstr($content, $user."=") $newstat = $user."=".$newstat $content = str_replace($user.$oldstat, $newstat, $content); $fhandle = fopen($fname,"w"); fwrite($fhandle,$content); fclose($fhandle); } The contents of the file will simply be: example=1 I'm getting parsing errors at the moment, and tried to sort it out through type casting, but to no avail.. Link to comment https://forums.phpfreaks.com/topic/148187-looking-for-advice-on-a-stats-module/ Share on other sites More sharing options...
vicodin Posted March 6, 2009 Share Posted March 6, 2009 Can you please tell us what the error is? Link to comment https://forums.phpfreaks.com/topic/148187-looking-for-advice-on-a-stats-module/#findComment-777867 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.