acoole Posted March 21, 2008 Share Posted March 21, 2008 Hey, There's an odd problem that this script doesn't work: Here's the script(thanks to members of PHPFreaks ): <?php $myusername = $_POST['myusername']; $mypassword=$_POST['mypassword']; if (!file_exists($myusername . '.ini')): die('Error - User isn\'t registered yet.'); endif; require 'ini.class.php'; $ini = new ini; $ini->parse_constants = FALSE; $userdata = $ini->read_ini('/home/sfrp/sa-mp/scriptfiles/' . $myusername . '.ini', TRUE); $userpass = $userdata['password']; if($userpass == $mypassword): // Register $myusername, $mypassword and redirect to file "login_success.php" @session_start(); $_SESSION['user'] = $myusername; $_SESSION['pass'] = $mypassword; header("location:login_success.php"); else: die('Error - Wrong username or password.'); endif; ?> And here's the .ini file it reads from Key=passwordhere 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 So.. what's wrong. I want it to read the password from the first line(key=passwordhere) is there some edits that need to be made? Link to comment https://forums.phpfreaks.com/topic/97231-small-problem/ Share on other sites More sharing options...
acoole Posted March 21, 2008 Author Share Posted March 21, 2008 bump Link to comment https://forums.phpfreaks.com/topic/97231-small-problem/#findComment-497534 Share on other sites More sharing options...
nafetski Posted March 21, 2008 Share Posted March 21, 2008 By "Not working" What do you mean? Supply us with error codes - and *specific* behaviors that are happening and we will be more likely to help. Link to comment https://forums.phpfreaks.com/topic/97231-small-problem/#findComment-497538 Share on other sites More sharing options...
BlueSkyIS Posted March 21, 2008 Share Posted March 21, 2008 $userpass = $userdata['password']; might need to be $userpass = $userdata['Key']; Link to comment https://forums.phpfreaks.com/topic/97231-small-problem/#findComment-497555 Share on other sites More sharing options...
acoole Posted March 21, 2008 Author Share Posted March 21, 2008 Thanks BlueSkyIS I'll try that out now. Link to comment https://forums.phpfreaks.com/topic/97231-small-problem/#findComment-497556 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.