$LogIn=$_REQUEST['LogIn']; // save as flag for each code section $Change=$_REQUEST['Change']; // save as flag for each code section $self=$_SERVER['PHP_SELF']; $datFile="gigList.dat"; $savFile="gigList.dat"; $DATA=array(); ////////////////////// Log In ////////////////// if ($Change==""){ $name=$_REQUEST['name']; $password=$_REQUEST['password']; $pswFile="gigList.psw"; $fp=fopen($pswFile,"r"); if (!$fp) {echo "
Unable to open remote file.
"; exit;} $NAME=trim(fgets($fp, 2048)); $PASSWD=trim(fgets($fp, 2048)); fclose($fp); if(!isset($name)&&!isset($password)) { //Visitor needs to enter a name and password // print "";
print "
Invalid login/password"; echo "You must provide a valid login and password to enter this site."; }// else }//end if not Change ////////////////////// Change Password ////////////////// else if ($Change=="Change"||$Change=="TryData"||$Change=="SaveData"){ $name=$_REQUEST['name']; $password=$_REQUEST['password']; $Opasswd=$_REQUEST['Opasswd']; $Npasswd1=$_REQUEST['Npasswd1']; $Npasswd2=$_REQUEST['Npasswd2']; $Msg=$_REQUEST['Msg']; $Saveword=$_REQUEST['Saveword']; $pswFile="gigList.psw"; $fp=fopen($pswFile,"r"); if (!$fp) {echo "Unable to open remote file. "; exit;} $NAME=trim(fgets($fp, 2048)); $PASSWD=trim(fgets($fp, 2048)); fclose($fp); if ($Change=="SaveData"){ //save the new password $fp=fopen($pswFile,"r"); if (!$fp) {echo "Unable to open remote file(".$inFile."). "; exit;} $n = fgets($fp, 2048); $p = fgets($fp, 2048); fclose($fp); $fp=fopen($pswFile,'w+') or die("Cannot open ".$savFile); fwrite($fp,$n); //fwrite($fp,$p); fwrite($fp,$Saveword); fclose($fp); $str="LogIn=LogIn&Msg=password%20changed"; print ""; $Change=""; //clear Change to avoid being picked up by subsequent ifs }//end if Saveword if ($Opasswd==$PASSWD&&$Npasswd1==$Npasswd2&&$Opasswd.$Npasswd1.$Npasswd2!="") { //check if parameters correct for change submit it for change $str="Change=SaveData&Saveword=".$Npasswd1; print ""; $Change=""; //clear Change to avoid being picked up by subsequent ifs }//end if $m1="New_Passwords_not_same!"; $m2="Password_Incorrect!"; $m3="Missing_Data!"; if ($Change=="Change"&&$Opasswd.$Npasswd1.$Npasswd2!=""){ $f=""; if ($Npasswd1!=$Npasswd2){$f=$m1;} if ($Opasswd!=$PASSWD){$f=$m2;} if ($Opasswd==""||$Npasswd1==""||$Npasswd2==""){$f=$m3;} $str="Change=Change&Msg=".$f; print ""; }//end if Msg if ($Change=="Change"&&$Opasswd.$Npasswd1.$Npasswd2.$Saveword==""){ print "
|