예제 #1
0
파일: index.php 프로젝트: dcsmitty/Rumblr
niceDate(return_ProfileInfo('birthday', $temp_ID));
?>
</p>
				<P><b>Interests: </b> 
				<?php 
get_ProfileInfo('interests', $temp_ID);
?>
</P>
				<P><b>Blog Description: </b> 
				<?php 
get_ProfileInfo('blogdesc', $temp_ID);
?>
</P>
				<P><b>Blog Privacy: </b> 
				<?php 
get_ProfileInfo('privacy', $temp_ID);
?>
</P>
				<button type="button" style="font-face: 'Comic Sans MS'; color: black;" onclick = "showUpdate(0)">Update Profile</button>
				</br></br>
				
				<?php 
require_once 'connect.php';
$query = "SELECT * FROM posts ORDER BY timestamp DESC";
//You don't need a ; like you do in SQL
$result = mysql_query($query);
while ($row = mysql_fetch_array($result)) {
    //Creates a loop to loop through results
    $profileInfo = "SELECT * FROM profile WHERE profileID='{$row['User_ID']}'";
    $profileQ = mysql_query($profileInfo);
    //check if this is valid
예제 #2
0
파일: posts.php 프로젝트: dcsmitty/Rumblr
function posting($type_of_post, $toPrint, $username, $privacy, $datePosted, $timePosted, $User_ID, $postID)
{
    ?>
		<div id="singlepost">
			<?php 
    $follow_success = true;
    //check to see if the individual is already being followed
    $query = "SELECT * from following";
    $result = mysql_query($query);
    while ($row = mysql_fetch_array($result)) {
        if ($row['User_ID'] == $_SESSION['SESS_LOGIN_ID'] && $row['Followed_ID'] == $User_ID) {
            $follow_success = false;
        }
    }
    $favorites_success = true;
    //check to see if this post was already favorited by this user
    $query = "SELECT * from favorites";
    $result = mysql_query($query);
    while ($row = mysql_fetch_array($result)) {
        if ($row['User_ID'] == $_SESSION['SESS_LOGIN_ID'] && $row['Post_ID'] == $postID) {
            $favorites_success = false;
        }
    }
    ?>

			<div id = "topbar">
			<TABLE BORDER="0" >
			<TR>
			<?php 
    //-----------------display likes-----------
    $query = "SELECT * from posts WHERE postID={$postID}";
    $result = mysql_query($query);
    while ($row = mysql_fetch_array($result)) {
        $amount_of_likes = $row['Likes'];
    }
    //Display the Follow button on post if valid
    if ($User_ID != $_SESSION['SESS_LOGIN_ID'] && $follow_success == true) {
        ?>
				<TD><form action="follow.php" method="post">
					<div id = "following">
						<input type = "hidden" value = "<?php 
        echo $username;
        ?>
" name = "follow_enter"/>
						<input type="submit" value = "Follow" name =  "follow_sub"/>
					</div>
				</form></TD>
				<?php 
    }
    $Repost_success = true;
    if ($User_ID != $_SESSION['SESS_LOGIN_ID'] && $Repost_success == true) {
        ?>
				<TD><form action="repost.php" method="post">
					<div id = "Reposting">
						<input type = "hidden" value = "<?php 
        echo $postID;
        ?>
" name = "repost_enter"/>
						<input type="submit" value = "Repost" name =  "repost_sub"/>
					</div>
				</form></TD>
				<?php 
    }
    if ($User_ID != $_SESSION['SESS_LOGIN_ID'] && $favorites_success == true) {
        ?>
				<TD><form action="favorites.php" method="post">
					<div id = "Reposting">
						<input type = "hidden" value = "<?php 
        echo $postID;
        ?>
" name = "favorites_enter"/>
						<input type="submit" value = "Favorite" name =  "favorites_sub"/>
					</div>
				</form></TD>
				<?php 
    }
    if ($User_ID != $_SESSION['SESS_LOGIN_ID']) {
        ?>

				<TD><form action="likes.php" method="post">
					<div id = "likes">
						<input type = "hidden" value = "<?php 
        echo $postID;
        ?>
" name = "likes_enter"/>
						<input type="submit" value = "Like: <?php 
        echo $amount_of_likes;
        ?>
" name =  "likes_sub"/>
					</div>
				</form></TD>

				<?php 
    } else {
        ?>
					<div id= "Likes_text">
						<?php 
        echo "Likes: " . $amount_of_likes;
        ?>
					</div>
				<?php 
    }
    ?>
			</TR>
			</TABLE>
			</div>

			<?php 
    //repost check
    $query = "SELECT * from posts";
    $result = mysql_query($query);
    while ($row = mysql_fetch_array($result)) {
        if ($row['postID'] == $postID) {
            $rpost = $row['IsRepost'];
        }
    }
    ?>

				<div id="userinfo">
					<img id="profPic2" src ="<?php 
    get_ProfileInfo('photo', $User_ID);
    ?>
"/>
					<strong><a onclick = <?php 
    if ($_SESSION['SESS_LOGIN_ID'] == $User_ID) {
        echo "hide(3)";
    } else {
        $_SESSION['PID'] = $User_ID;
        echo "hide(5)";
    }
    ?>
 > <?php 
    echo $username;
    ?>
 </a> 
					
					<?php 
    if ($rpost) {
        echo "- <b>REPOST</b>";
    }
    ?>
					
					<br> <?php 
    echo " " . $datePosted;
    ?>
<br> <?php 
    echo $timePosted;
    ?>
</strong>
				</div>

			<div id = "postInfo">
				<?php 
    if ($type_of_post == 'photo') {
        ?>
					<br><strong>Photo: </strong><br>
					<td bgcolor='#F8F7F1'><img height = '200px' width = '200px' src ="<?php 
        echo $toPrint;
        ?>
"/></td>
							<?php 
    } else {
        if ($type_of_post == 'link') {
            ?>
					<br><strong>Link: </strong><br>
					<td bgcolor='#F8F7F1'><a href="<?php 
            echo $toPrint;
            ?>
"> Link </a></td>
				<?php 
        } else {
            if ($type_of_post == 'quote') {
                ?>
					<br><strong>Quote: </strong><br>
					<td bgcolor='#F8F7F1'><?php 
                echo " \"" . $toPrint . "\" ";
                ?>
</td>
				<?php 
            } else {
                if ($type_of_post == 'chat') {
                    ?>
					<strong>Chat: <br></strong><br>
					<?php 
                    echo " \"" . $toPrint . "\" ";
                    ?>
				<?php 
                } else {
                    if ($type_of_post == 'audio') {
                        ?>
					<br><strong>Audio: </strong><br>
					<audio controls>
					  <source src="<?php 
                        echo $toPrint;
                        ?>
" type="audio/ogg">
					  <source src="<?php 
                        echo $toPrint;
                        ?>
" type="audio/mpeg">
						Your browser does not support the audio element.
					</audio>
				<?php 
                    } else {
                        if ($type_of_post == 'video') {
                            ?>
					<br><strong>Video: </strong><br>
					<iframe width="420" height="315"
					src="<?php 
                            echo $toPrint;
                            ?>
">
					</iframe>
				<?php 
                        } else {
                            ?>

					<br><strong>Text: </strong><br>
					<?php 
                            echo $toPrint;
                            ?>
 
				<?php 
                        }
                    }
                }
            }
        }
    }
    ?>
				<br><br>

				<b>Tags:</b>
				<div id = "tags">

					<?php 
    //SHOW TOP 3 MOST RECENT COMMENTS
    //check to see if the individual is already being followed
    $query = "SELECT * from tags";
    $result = mysql_query($query);
    while ($row = mysql_fetch_array($result)) {
        if ($row['Post_ID'] == $postID) {
            echo $row['Tag_label'] . " ";
        }
    }
    ?>

				</div>

				<?php 
    $query2 = "SELECT * FROM comments ORDER BY Timestamp DESC";
    //You don't need a ; like you do in SQL
    $result2 = mysql_query($query2);
    $comments_counter = 0;
    while (($row2 = mysql_fetch_array($result2)) && $comments_counter < 3) {
        //Creates a loop to loop through results
        $profileInfo2 = "SELECT * FROM profile WHERE profileID='{$row2['User_ID']}'";
        $profileQ2 = mysql_query($profileInfo2);
        //check if this is valid
        if ($profileQ2) {
            if (mysql_num_rows($profileQ2) > 0) {
                if ($row2['Post_ID'] == $postID) {
                    $getProfile2 = mysql_fetch_assoc($profileQ2);
                    $printComment = $row2['Comment'];
                    $usererID = $row2['User_ID'];
                    $postTime2 = strtotime($row2['Timestamp']);
                    $username2 = $getProfile2['username'];
                    //$date2 = date('m-d-Y', $postTime2);
                    //$time2 = date('h:i:s:a', $postTime2);
                    postingComments($username2, $printComment, $postTime2, $postID, $usererID);
                    $comments_counter = $comments_counter + 1;
                }
            }
        }
    }
    ?>
				<br>
				<form action="comment.php" method="post">
					<div id = "commenting">
						<textarea rows="2" cols="50" name = "comment_enter"/></textarea> <br>
						<input type = "hidden" value = "<?php 
    echo $postID;
    ?>
" name = "id_enter"/>
						<input type="submit" value = "Comment" name =  "comment_sub"/>
					</div>
				</form>

			</div>
		</div>
		</tr>
		</table></td>
		</tr>
		</table><br>
		
				<?php 
}
예제 #3
0
파일: comment.php 프로젝트: dcsmitty/Rumblr
function postingComments($user_name, $comment_to_print, $commentTime, $posterID, $usererID)
{
    ?>
	<div id="commentPosted">
		<div id="userinfo">
			<img id="commentPic" src ="<?php 
    get_ProfileInfo('photo', $usererID);
    ?>
"/>
			<!-- <strong><a href="hide(3)" > <?php 
    //echo $user_name;
    ?>
 </a>  <?php 
    php;
    ?>
</strong> -->
			<strong><a onclick = <?php 
    if ($_SESSION['SESS_LOGIN_ID'] == $usererID) {
        echo "hide(3)";
    } else {
        $_SESSION['PID'] = $usererID;
        echo "hide(5)";
    }
    ?>
 > <?php 
    echo $user_name;
    ?>
 </a><?php 
    /*echo " " . humanTiming($commentTime). ' ago'; */
    ?>
</strong>
		</div>

		<div id="commentContent">
			<?php 
    echo $comment_to_print;
    ?>
 
		</div>

	</div>
	<?php 
}