private function showHTML()
    {
        echo $_SESSION['userid'];
        ?>
		<!--<html>
<body>
 
<form action="createAlbumActivity.php" method="POST" enctype="multipart/form-data">
    <input type="file" name="file"/>
    <br />
    <input type="submit"/>
</form>
 
</body>
</html>-->

<html>
<head>
<title>Upload Image </title>
<script>
function createAlbum() {

	<?php 
        if ($_SESSION['userid'] != -99) {
            ?>

    window.location.href ="http://localhost:8888/CS460PA2/createAlbum/createAlbum.php";
<?php 
        }
        ?>
}
function createPhoto() {
		<?php 
        if ($_SESSION['userid'] != -99) {
            ?>
    window.location.href ="http://localhost:8888/CS460PA2/addPicture/createPhoto.php";
    <?php 
        }
        ?>
}
function addLike() {
		<?php 
        if ($_SESSION['userid'] != -99) {
            ?>
    window.location.href ="http://localhost:8888/CS460PA2/addLike/addLike.php";
    <?php 
        }
        ?>
}
function AddTag() {
		<?php 
        if ($_SESSION['userid'] != -99) {
            ?>
    window.location.href ="http://localhost:8888/CS460PA2/addTag/addTag.php";
    <?php 
        }
        ?>
}
function addComment() {
    window.location.href ="http://localhost:8888/CS460PA2/addComment/addComment.php";
}
function newsFeed() {
    window.location.href ="http://localhost:8888/CS460PA2/Newsfeed/newsFeed.php";
}
function addFriend() {
		<?php 
        if ($_SESSION['userid'] != -99) {
            ?>
    window.location.href ="http://localhost:8888/CS460PA2/addFriend/addFriend.php";
    	<?php 
        }
        ?>
}
function logout() {
    window.location.href ="http://localhost:8888/CS460PA2/Logout/Logout.php";
}
function showLike() {
    window.location.href ="http://localhost:8888/CS460PA2/showLikes/showLike.php";
}
function UserActivity() {
    window.location.href ="http://localhost:8888/CS460PA2/showContributers/showContributer.php";
}
function PopTag() {
    window.location.href ="http://localhost:8888/CS460PA2/showPopTags/showPopTags.php";
}
</script>
</head>
<body>
<br>
<button onclick="newsFeed()">Newsfeed</button><button onclick="addFriend()">Friend</button><button onclick="createAlbum()">CreateAlbum</button><button onclick="createPhoto()">CreatePicture</button><button onclick="addLike()">AddLike</button><button onclick="AddTag()">AddTag</button><button onclick="addComment()">AddComment</button><button onclick="showLike()">ListOfLikes</button><button onclick="UserActivity()">UserActivity</button><button onclick="PopTag()">PopularTags</button><button onclick="logout()">Logout</button>
<br>
<br>


<?php 
        $model = new APIModel();
        $this->peopleList = $model->ownerLIst();
        $result;
        $counter = 0;
        foreach ($this->peopleList as $x => $x_value) {
            $result[$counter] = $x;
            $this->contributionList[$counter] = $x_value;
            $counter = $counter + 1;
        }
        $this->arrlength = count($this->peopleList);
        echo "<table id= 'myTable' style='width:400px;'>";
        echo "  <caption>Contributer List</caption>";
        echo "<tr>";
        echo "<td>Users:</td>";
        echo "<td>Contributions:</td>";
        echo "</tr>";
        for ($x = 0; $x < $this->arrlength; $x++) {
            //echo $this->photoList[$x];
            echo "<tr>";
            echo "<td>" . $result[$x] . "</td>";
            echo "<td>" . $this->contributionList[$x] . "</td>";
            /*
            
            $image = imagecreatefromstring($this->photoList[$x]); 
            ob_start(); //You could also just output the $image via header() and bypass this buffer capture.
            				imagepng($image, null, 80);
            				$data = ob_get_contents();
            				ob_end_clean();
            				
            
            echo '<td><img src="data:image/png;base64,' .  base64_encode($this->photoList[$x])  . '" /></td>';
            */
        }
        ?>


</body>

</html>

		<?php 
    }
Beispiel #2
0
    private function showHTML()
    {
        echo $_SESSION['userid'];
        ?>
		<!--<html>
<body>
 
<form action="createAlbumActivity.php" method="POST" enctype="multipart/form-data">
    <input type="file" name="file"/>
    <br />
    <input type="submit"/>
</form>
 
</body>
</html>-->

<html>
<head>
<title>Upload Image </title>
<script>
function createAlbum() {

	<?php 
        if ($_SESSION['userid'] != -99) {
            ?>

    window.location.href ="http://localhost:8888/CS460PA2/createAlbum/createAlbum.php";
<?php 
        }
        ?>
}
function createPhoto() {
		<?php 
        if ($_SESSION['userid'] != -99) {
            ?>
    window.location.href ="http://localhost:8888/CS460PA2/addPicture/createPhoto.php";
    <?php 
        }
        ?>
}
function addLike() {
		<?php 
        if ($_SESSION['userid'] != -99) {
            ?>
    window.location.href ="http://localhost:8888/CS460PA2/addLike/addLike.php";
    <?php 
        }
        ?>
}
function AddTag() {
		<?php 
        if ($_SESSION['userid'] != -99) {
            ?>
    window.location.href ="http://localhost:8888/CS460PA2/addTag/addTag.php";
    <?php 
        }
        ?>
}
function addComment() {
    window.location.href ="http://localhost:8888/CS460PA2/addComment/addComment.php";
}
function newsFeed() {
    window.location.href ="http://localhost:8888/CS460PA2/Newsfeed/newsFeed.php";
}
function addFriend() {
		<?php 
        if ($_SESSION['userid'] != -99) {
            ?>
    window.location.href ="http://localhost:8888/CS460PA2/addFriend/addFriend.php";
    	<?php 
        }
        ?>
}
function logout() {
    window.location.href ="http://localhost:8888/CS460PA2/Logout/Logout.php";
}
function showLike() {
    window.location.href ="http://localhost:8888/CS460PA2/showLikes/showLike.php";
}
function UserActivity() {
    window.location.href ="http://localhost:8888/CS460PA2/showContributers/showContributer.php";
}
function PopTag() {
    window.location.href ="http://localhost:8888/CS460PA2/showPopTags/showPopTags.php";
}

</script>

</head>
<body>
<br>
<button onclick="newsFeed()">Newsfeed</button><button onclick="addFriend()">Friend</button><button onclick="createAlbum()">CreateAlbum</button><button onclick="createPhoto()">CreatePicture</button><button onclick="addLike()">AddLike</button><button onclick="AddTag()">AddTag</button><button onclick="addComment()">AddComment</button><button onclick="showLike()">ListOfLikes</button><button onclick="UserActivity()">UserActivity</button><button onclick="PopTag()">PopularTags</button><button onclick="logout()">Logout</button>
<br>
<br>

<form action="addTag.php" method = "POST" >
Tag Name:
<br>
<input type="text" id="name" name="tag"/>
<br>
Picture Name:
<br>
<input type="text" id="name" name="picture"/>
<br>
Album Name:
<br>
<input type="text" id="name" name="album"/>
<br>
Owner's Name:
<br>
<input type="text" id="name" name="user"/>
<br>
<input type ="submit" value = "Submit">


</form>

<?php 
        $model = new APIModel();
        $this->albumList = $model->AlbumList($_SESSION['userid']);
        $this->captionList = $model->pictureTitles($_SESSION['userid']);
        $this->photoList = $model->getImages($_SESSION['userid']);
        $this->dates = $model->datesOfPics($_SESSION['userid']);
        $this->idphoto = $model->photoID($_SESSION['userid']);
        $this->tagList = $model->tagZList($_SESSION['userid']);
        $this->peopleList = $model->ownerLIst($_SESSION['userid']);
        $this->arrlength = count($this->albumList);
        echo "<table id= 'myTable' style='width:800px;'>";
        echo "  <caption>Tag List</caption>";
        echo "<tr>";
        echo "<td>Owner:</td>";
        echo "<td>Album Name:</td>";
        echo "<td>DateOfALbum:</td>\t";
        echo " <td>Picture Name: </td>";
        echo "<td>Tag:</td>";
        echo "<td>Image:</td>";
        echo "<td>Delete:</td>";
        echo "</tr>";
        for ($x = 0; $x < $this->arrlength; $x++) {
            //echo $this->photoList[$x];
            echo "<tr>";
            echo "<td>" . $this->peopleList[$x] . "</td>";
            echo "<td>" . $this->albumList[$x] . "</td>";
            echo "<td>" . $this->dates[$x] . "</td>";
            echo "<td>" . $this->captionList[$x] . "</td>";
            echo "<td>" . $this->tagList[$x] . "</td>";
            /*
            $image = imagecreatefromstring($this->photoList[$x]); 
            ob_start(); //You could also just output the $image via header() and bypass this buffer capture.
            				imagepng($image, null, 80);
            				$data = ob_get_contents();
            				ob_end_clean();
            				
            
            echo '<td><img src="data:image/png;base64,' .  base64_encode($this->photoList[$x])  . '" /></td>';
            */
            $picid = $this->idphoto[$x];
            echo "<td><img src =../addTag/get.php?id=" . $picid . "> </td>";
            echo "<td> <form  action='' method='POST'>";
            echo "<input type='hidden' id='pleasework' name='item' value='" . $this->counter . "' />";
            echo "<input type='submit' id=" . $this->counter . " name='Deletez' value='Delete' ></form></td>";
            echo "<td> <form  action='' method='POST'>";
            $this->counter++;
        }
        ?>


</body>

</html>

		<?php 
    }
Beispiel #3
0
        $counter = 0;
        foreach ($temp as $x => $x_value) {
            $names[$counter] = $x;
            $values[$counter] = $x_value;
            $counter = $counter + 1;
        }
        // print_r($temp2);
        //echo "<br>";
        return $temp2;
    }
    public function allTags()
    {
        $photos = array();
        $this->mysqlconnect();
        $query = "SELECT * FROM tags_table  ";
        $id = 0;
        $result = $this->mysqli->query($query) or die('SELECT query failed: ' . mysql_error());
        for ($row = $result->fetch_assoc(); $row != FALSE; $row = $result->fetch_assoc()) {
            $name = stripslashes($row["tag"]);
            if ($name != "NA") {
                $photos[$id] = "{$name}";
            }
            $id++;
        }
        return $photos;
    }
}
//unit tests
$model = new APIModel();
$return = $model->ownerLIst();