Ejemplo n.º 1
0
    private function processData()
    {
        if ($this->context == "Data was submitted") {
            $model = new APIModel();
            if ($this->verifyForm()) {
                $result = $model->login($this->username, $this->password);
                if ($result == "Login Succesful!") {
                    //session_register($this->username);
                    $userID = $model->getID($this->username);
                    //echo $userID;
                    if ($userID != "Get ID Fail") {
                        $_SESSION['userid'] = $userID;
                        ?>
						<!--<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/Newsfeed/newsFeed.php" />

						<?php 
                    }
                } else {
                    print $result;
                }
            }
        }
        if ($this->context == "guest") {
            $_SESSION['userid'] = -99;
            ?>
						

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

						<?php 
        }
    }
Ejemplo n.º 2
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>";
             }
             $userid = $model->getID($this->userName);
             $albumID = $model->getAlbumID($userid, $this->albumName);
             if ($albumID == "Get ID Fail") {
                 echo "<script>\r\n\t\t\talert('Get ID FAILED!');\r\n\t\t\t</script>";
             }
             $pictureID = $model->getPhotoID($albumID, $this->pictureName);
             $result = $model->addTag($pictureID, $this->tagName, $_SESSION['userid']);
             if ($result == "Creation successful.") {
                 //session_register($this->username);
                 //echo $userID;
                 echo "<script>\r\n\t\t\talert('WE DID IT!');\r\n\t\t\t</script>";
             } else {
                 print $result;
             }
         }
     }
     if ($this->context2 == 1) {
         $model = new APIModel();
         $this->idphoto = $model->photoID($_SESSION['userid']);
         $this->albumList = $model->AlbumList($_SESSION['userid']);
         $this->captionList = $model->pictureTitles($_SESSION['userid']);
         $this->tagList = $model->tagZList($_SESSION['userid']);
         $result = $model->deleteTag($this->idphoto[$this->del], $this->tagList[$this->del]);
         if ($result == 1) {
             print '<script type="text/javascript">';
             print 'alert("The tag ' . $this->tagList[$this->del] . ' from the picture ' . $this->captionList[$this->del] . ' from Album ' . $this->AlbumList[$this->del] . ' is succesfuly deleted")';
             print '</script>';
         } else {
             print '<script type="text/javascript">';
             print 'alert("The tag ' . $this->tagList[$this->del] . ' from the picture ' . $this->captionList[$this->del] . ' from Album ' . $this->AlbumList[$this->del] . ' is NOT succesfuly  DELETED")';
             print '</script>';
         }
     }
 }
Ejemplo n.º 3
0
    private function processData()
    {
        if ($this->context == "Data was submitted") {
            $data_model = new APIModel();
            if ($this->verifyForm() == true) {
                $result = $data_model->addPerson($this->newUsername, $this->newPassword, $this->newEmail, $this->firstName, $this->lastName, $this->birthday, $this->hometown, $this->currentAddress, $this->education);
                if ($result == "Registration successful.") {
                    $_SESSION['userid'] = $data_model->getID($this->newUsername);
                    ?>

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

					<!--<meta http-equiv="refresh" content="0; url=http://localhost:8888/Quartz4/Registration/welcome.php" />-->

					<?php 
                } else {
                    print $result;
                }
            }
        }
    }