Issues (46)

1
<?php require($_SERVER['DOCUMENT_ROOT'] . "/static/config.inc.php"); ?>
2
<?php require($_SERVER['DOCUMENT_ROOT'] . "/static/conn.php"); ?>
3
<?php require($_SERVER['DOCUMENT_ROOT'] . "/lib/profile.php");
4
//ini_set('display_errors', 1);
5
//ini_set('display_startup_errors', 1);
6
//error_reporting(E_ALL);
7
?>
8
<!DOCTYPE html>
9
<html>
10
<head>
11
    <link href="/static/css/required.css" rel="stylesheet">
12
    <title>Witter: What are you doing?</title>
13
    <script src='https://www.google.com/recaptcha/api.js' async defer></script>
14
    <?php $user = getUserFromName(rhandleTag($_GET['n']), $conn); ?>
15
    <meta property="og:title" content="@<?php echo $user['username']; ?>" />
16
    <meta property="og:description"
17
          content="<?php echo $user['bio']; ?>" />
18
    <meta property="og:image" content="https://witter.spacemy.xyz/dynamic/pfp/<?php echo $user['pfp']; ?>" />
19
    <script>function onLogin(token){ document.getElementById('submitform').submit(); }</script>
20
    <script src="/js/i-have-no-idea-what-to-name-this-file-and-it-doesnt-really-matter.js"></script>
21
</head>
22
<body id="front" <?php if($user['bg'] != "") { echo "style='background-repeat: repeat; background-image: url(" . str_replace('"', '\"', $user['bg']) . ");'"; }?>>
23
<div id="container">
24
    <?php require($_SERVER['DOCUMENT_ROOT'] . "/static/header.php"); ?>
25
    <div id="content">
26
        <?php if(!isset($_SESSION['siteusername'])) { ?>
27
            <div style="background-color: lightyellow;" class="wrapper">
28
                <big><big><big>Hey there! <b><?php echo $user['username']; ?></b> is using Witter.</big></big></big><br>
29
                <img style="float: left; margin-right: 5px;" src="/static/girl.gif">Witter is a free service that lets you keep in touch with people through the exchange of quick, frequent answers to one simple question: What are you doing? Join today to start recieving <?php echo $user['username']; ?>'s updates.
30
            </div><br><br><br><br><br><br>
31
        <?php } ?>
32
        <div class="wrapper">
33
            <?php if($user['banstatus'] == "suspended") { ?>
34
                <br>
35
                <div style='padding: 5px; border: 5px solid green;'>
36
                    <h4 id='noMargin'>
37
                        This user has been suspended.
38
                    </h4>
39
                </div>
40
                <?php die(); ?>
41
            <?php } ?>
42
            <?php if(!isset($user['banstatus'])) { ?>
43
                <br>
44
                <div style='padding: 5px; border: 5px solid green;'>
45
                    <h4 id='noMargin'>
46
                        This user does not exist or has been permanately deleted.
47
                    </h4>
48
                </div>
49
                <?php die(); ?>
50
            <?php } ?>
51
            <div class="customtopRight">
52
                Name: <b><big><?php echo $user['username']; ?></big></b><br>
53
                <table id="cols">
54
                    <tr>
55
                        <th style="width: 33%;">&nbsp;</th>
56
                        <th style="width: 33%;">&nbsp;</th>
57
                        <th style="width: 33%;">&nbsp;</th>
58
                    </tr>
59
                    <tr>
60
                        <td><big><big><big><b><?php echo getFollowing($user['username'], $conn); ?></b></big></big></big><br><span id="blue">following</span></td>
61
                        <td><big><big><big><b><?php echo getFollowers($user['username'], $conn); ?></b></big></big></big><br><span id="blue">followers</span></td>
62
                        <td> </td>
63
                    </tr>
64
                </table><br>
65
66
                <div class="altbg">
67
                    <b>Weets</b><span id="floatRight"><?php echo getWeets(rhandleTag($_GET['n']), $conn); ?></span>
68
                </div>
69
                <span id="blue"><a style="text-decoration: none; padding-left: 5px;color: #6d94c8;" href="/favorites.php?n=<?php echo handleTag($user['username']); ?>">Favorites</a></span>
70
                <br><br>
71
                <div class="altbg">
72
                    <span id="blue">Followers</span><br>
73
                    <?php
74
                    $stmt = $conn->prepare("SELECT * FROM follow WHERE reciever = ?");
75
                    $stmt->bind_param("s", $user['username']);
76
                    $stmt->execute();
77
                    $result = $stmt->get_result();
78
                    while($row = $result->fetch_assoc()) {
79
                        ?>
80
                        <a href="/u.php?n=<?php echo handleTag($row['sender']); ?>"><img style="width: 30px; height: 30px;" src="/dynamic/pfp/<?php echo getPFPFromUser($row['sender'], $conn); ?>"></a>
81
                        <?php
82
                    }
83
                    $stmt->close();
84
                    ?>
85
                </div><br>
86
                <div class="altbg">
87
                    <span id="blue">Bio</span>
88
                    <?php echo $user['bio']; ?>
89
                </div>
90
            </div>
91
            <div class="customtopLeft">
92
                <img id="pfp" style="height: 13%; width: 13%;" src="/dynamic/pfp/<?php echo $user['pfp']; ?>"><h1 style="margin-left: 80px;"><?php echo $user['username']; ?></h1><br>
93
                <?php if(isset($_SESSION['errorMsg'])) { echo "<div style='padding: 5px; border: 5px solid green;'><h4 id='noMargin'>" . $_SESSION['errorMsg']; unset($_SESSION['errorMsg']); echo "</h4></div><br>"; }?>
94
                <?php
95
                if(ifFollowing(rhandleTag($_GET['n']), @$_SESSION['siteusername'], $conn) == false) {?>
96
                    <a href="/follow.php?n=<?php echo $user['username']; ?>"><button>Follow</button></a>
97
                <?php } else { ?>
98
                    <a href="/unfollow.php?n=<?php echo $user['username']; ?>"><button>Unfollow</button></a>
99
                <?php }
100
                ?>
101
                <table id="feed">
102
                    <tr>
103
                        <th style="width: 48px;">&nbsp;</th>
104
                        <th>&nbsp;</th>
105
                    </tr>
106
                    <?php
107
                    $stmt = $conn->prepare("SELECT * FROM weets WHERE author = ?");
108
                    $stmt->bind_param("s", $tag);
109
                    $tag = rhandleTag($_GET['n']);
110
                    $stmt->execute();
111
                    $result = $stmt->get_result();
112
                    if($result->num_rows === 0) echo('There are no weets.');
113
                    while($row = $result->fetch_assoc()) {
114
                        ?>
115
                        <tr>
116
                            <big><big><big>
117
                                <td>
118
                                    <img id="pfp" src="/dynamic/pfp/<?php echo getPFPFromUser($row['author'], $conn); ?>">
119
                                </td>
120
                                <td><a id="tag" href="/u.php?n=<?php echo handleTag($row['author']); ?>"><?php echo($row['author']); ?></a>
121
                                    <?php if(returnVerifiedFromUsername($row['author'], $conn) != "") { ?> <span style="border-radius: 10px; background-color: deepskyblue; color: white; padding: 3px;"><?php echo(returnVerifiedFromUsername($row['author'], $conn)); ?></span> <?php } ?>
122
                                    <div id="floatRight" class="dropdown">
123
                                        <span><img style="vertical-align: middle;" src="/static/witter-dotdotdot.png"></span>
124
                                        <div class="dropdown-content">
125
                                            <a href="#<?php //echo report.php?r=$row['realid']; ?>"><img style="vertical-align: middle;" src="/static/witter-report.png"></a><br>
126
                                            <?php if(isset($_SESSION['siteusername']) && $row['author'] == $_SESSION['siteusername']) { ?>
127
                                                <a href="/delete.php?rid=<?php echo $row['realid']; ?>"><img style="vertical-align: middle;" src="/static/witter-trash.png"></a><br>
128
                                                <a href="/edit.php?rid=<?php echo $row['realid']; ?>"><img style="vertical-align: middle;" src="/static/witter-edit.png"></a><br>
129
                                            <?php } ?>
130
                                        </div>
131
                                    </div>
132
                                    <span id="floatRight">
133
                                        <?php if(ifLiked($_SESSION['siteusername'], $row['id'], $conn) == true) { ?>
0 ignored issues
show
Coding Style Best Practice introduced by
It seems like you are loosely comparing two booleans. Considering using the strict comparison === instead.

When comparing two booleans, it is generally considered safer to use the strict comparison operator.

Loading history...
134
                                            <a href="#" onclick="unlike(<?=$row['id']?>)" id="like-toggle-<?=$row['id']?>"><img style="vertical-align: middle;" src="/static/witter-liked.png"></a>
135
                                        <?php } else { ?>
136
                                            <a href="#" onclick="like(<?=$row['id']?>)" id="like-toggle-<?=$row['id']?>"><img style="vertical-align: middle;" src="/static/witter-like.png"></a>
137
                                        <?php } ?>
138
                                    </span>
139
                                    <div id="feedtext"><?php echo parseText($row['contents']); ?> </div>
140
                                    <small id="grey">about <?php echo time_elapsed_string($row['date']); ?> from web
141
                                        <span id="floatRight">
142
                                            <?php echo getComments($row['realid'], $conn); ?><img style="vertical-align: middle;" src="/static/witter-replies.png"> &bull; <a href="/v.php?rid=<?php echo $row['realid']; ?>">Reply</a> &bull; <a href="/home.php?text=https://witter.spacemy.xyz/embed/?i=<?php echo $row['realid']; ?>">Reweet</a>
143
                                        </span>
144
                                    </small><br>
145
                                    <?php
146
                                    $likes = getLikesReal($row['id'], $conn);
147
                                    while($row = $likes->fetch_assoc()) {
148
                                        ?>
149
                                        <a href="/u.php?n=<?php echo handleTag($row['fromu']); ?>"><img style="width: 30px; height: 30px; margin-left: 2px;" id="pfp" src="/dynamic/pfp/<?php echo getPFPFromUser($row['fromu'], $conn); ?>"></a>&nbsp;
150
                                    <?php } ?>
151
                                </td>
152
                            </big></big></big>
153
                        </tr>
154
                        <?php
155
                    }
156
                    $stmt->close();
157
                    ?>
158
                </table>
159
            </div>
160
            <?php require($_SERVER['DOCUMENT_ROOT'] . "/static/footer.php"); ?>
161
        </div>
162
    </div>
163
</div>
164
</body>
165
</html>