Пример #1
0
    private function processData()
    {
        if ($this->context == "Data was submitted") {
            $model = new APIModel();
            if ($this->verifyForm()) {
                if ($_SESSION['userid'] == "") {
                    echo "<script>\r\n\t\t\talert('Session variable not working');\r\n\t\t\t</script>";
                }
                $result = $model->createFriend($_SESSION['userid'], $this->friendName);
                if ($result == "Creation successful.") {
                    //session_register($this->username);
                    //echo $userID;
                    print '<script type="text/javascript">';
                    print 'alert("The friend ' . $this->friendName . ' is succesfuly added")';
                    print '</script>';
                    ?>
						<!--<form method="get" action="../createAlbum/createAlbum.php">
    				<input type="hidden" name="userid" value='<?php 
                    //echo $userID;
                    ?>
'>
    				<input type="submit">
						</form>-->

						<!--<meta http-equiv="refresh" content="0; url=http://localhost:8888/CS460PA2/addPicture/createPhoto.php" />-->

						<?php 
                } else {
                    print $result;
                }
            }
        }
        if ($this->context2 == 1) {
            $model = new APIModel();
            $this->list = $model->FriendList($_SESSION['userid']);
            $result = $model->deleteFriend($this->list[$this->del], $_SESSION['userid']);
            if ($result == 1) {
                print '<script type="text/javascript">';
                print 'alert("The friend ' . $this->list[$this->del] . ' is succesfuly deleted")';
                print '</script>';
            } else {
                print '<script type="text/javascript">';
                print 'alert("The friend ' . $this->list[$this->del] . ' is NOT succesfuly  DELETED")';
                print '</script>';
            }
        }
    }