acoole Posted March 8, 2008 Share Posted March 8, 2008 I get these errors Warning: fopen(./test.ini) [function.fopen]: failed to open stream: Permission denied in /home/acoole/public_html/testing/done.php on line 8 Warning: fwrite(): supplied argument is not a valid stream resource in /home/acoole/public_html/testing/done.php on line 102 Warning: fclose(): supplied argument is not a valid stream resource in /home/acoole/public_html/testing/done.php on line 105 Script = <?php $path = "./"; // this will prevent XSS echo "<h1>Logged In</h1>"; // replace $_SESSION['username'] will the variable that holds your user name $file = fopen($path.$_POST["name"].".ini","a+"); // write contents fwrite($file,"Key= Level=1 AdminLevel=0 DonateRank=0 UpgradePoints=0 ConnectedTime=0 Registered=1 Sex=1 Age=25 Origin=2 CK=0 Muted=0 Respect=0 Money=25900 Bank=50000 Crimes=0 Kills=0 Deaths=1 Arrested=0 WantedDeaths=0 Phonebook=0 LottoNr=0 Fishes=0 BiggestFish=0 Job=0 Paycheck=1175 HeadValue=0 Jailed=0 JailTime=0 Materials=0 Drugs=0 Leader=0 Member=0 FMember=255 Rank=0 Char=0 ContractTime=0 DetSkill=0 SexSkill=0 BoxSkill=0 LawSkill=0 MechSkill=0 JackSkill=0 CarSkill=0 NewsSkill=0 DrugsSkill=0 CookSkill=0 FishSkill=0 pSHealth=0.0 pHealth=48.0 Int=0 Local=255 Team=3 Model=264 PhoneNr=8284 House=255 Bizz=255 Pos_x=246.6 Pos_y=-1161.9 Pos_z=1029.6 CarLic=0 FlyLic=0 BoatLic=0 FishLic=0 GunLic=0 Gun1=0 Gun2=0 Gun3=0 Gun4=0 Ammo1=0 Ammo2=0 Ammo3=0 Ammo4=0 CarTime=0 PayDay=4 PayDayHad=0 CDPlayer=0 Wins=0 Loses=0 AlcoholPerk=0 DrugPerk=0 MiserPerk=0 PainPerk=0 TraderPerk=0 Tutorial=1 Mission=0 Warnings=0 Adjustable=1 Fuel=0 Married=0 MarriedTo=No-one "); // close the file fclose($file); ?> Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/95117-please-help/ Share on other sites More sharing options...
acoole Posted March 8, 2008 Author Share Posted March 8, 2008 FYI, website:http://sampservers.info/testing/done.php To make it fully work http://sampservers.info/testing/index.html Quote Link to comment https://forums.phpfreaks.com/topic/95117-please-help/#findComment-487234 Share on other sites More sharing options...
corbin Posted March 8, 2008 Share Posted March 8, 2008 The php script needs write permission.... Or the user under which it's running does or so on.... Google linux file permissions and see if you can figure it out. I'm feeling kind of lazy right now lol. Also, that $path = './' does not make the script secure.... Quote Link to comment https://forums.phpfreaks.com/topic/95117-please-help/#findComment-487236 Share on other sites More sharing options...
laffin Posted March 8, 2008 Share Posted March 8, 2008 Usually php scripts dun have permissions to create files in a folder. Create an empty file, and allow world read/write access Quote Link to comment https://forums.phpfreaks.com/topic/95117-please-help/#findComment-487237 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.