0

When I open a page the page loads for a very long time and no errors appear in the logs. I've run it through a syntax checker which told me there was one more opening parenthasis than expected, but didn't give me a line number, so I have no idea where the error is happening.

I know it is bad practise to paste all of your code, but in this scenario I have no alternative! I've removed most of the totally static HTML and javascript.

<?php 
    require_once("models/config.php");
    if(!isUserLoggedIn()){
        header('Location: login');
}
define('OKAY','fine');
include('models/db/imgconnect.php');
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Account | <?php echo $websiteName; ?> </title>
<?php require_once("head_inc.php"); ?>
<script type="text/javascript" src="//api.filepicker.io/v1/filepicker.js"></script>

<?php  $group = $loggedInUser->groupID(); 
$limit= $group['group_limit']; 
$_SESSION['limit'] = $limit;
$_SESSION['owner'] = $loggedInUser->display_username;

?>

<!--
$loggedInUser->display_username;
echo $limit;
-->

<?php
        mysql_select_db($dbname,$con);
        $owner = $loggedInUser->display_username;
        $query = "SELECT * FROM `images` WHERE `owner_un`='$owner'";
        $res = mysql_query($query) or die(mysql_error());
?>

</head>
<body>
    <?php require_once("navbar.php"); ?>
<div class="container">



            <h1>Welcome  <strong><?php echo $loggedInUser->display_username; ?></strong></h1>
            <hr >
            <?php if(isset($_SESSION['message'])){
                echo $_SESSION['message'];
                unset($_SESSION['message']);
                echo "<a href='#' onClick='window.location.reload()'>Dismiss</a>";
                echo "<hr>";

            }
            ?>
            <h3>Upload</h3>

<div class="row">
    <div class="span3">
        <?php 
        $limit = intval($limit);
        $totalUploads = mysql_num_rows($res);

          if($totalUploads >= $limit){
            echo "You're over the maximum limit for your account! You need to delete some photos before you can upload more";
          }else{
            ?>
            <!-- Uploader script-->
            <form method="POST" action="uploader.php" id="uploadForm">
              <input type="filepicker" name="ink" data-fp-apikey="AkKxqOGzgRfqZYEb68dEXz" data-fp-mimetypes="image/*" data-fp-container="modal" data-fp-multiple="true" data-fp-services="COMPUTER" onchange="out='';for(var i=0;i<event.fpfiles.length;i++){out+=event.fpfiles[i].url;out+=' '};$('form#uploadForm').submit();">
            </form>

            </form>

            <?php
          }
        ?>

    </div>
    <div class="span3 offset4">
        <a data-toggle='modal' data-target='#taskModal' href='share.php?type=all&amp;usrid=<?php echo $id;?>' class="btn btn-success">Share my entire library</a>

    </div>
</div>

        <hr >
        <h2>Your pictures</h2>

        <?php
            if (mysql_num_rows($res) > 0) {
            ?>
                    <table class="table table-hover  span7">
        <thead>
            <tr>
                <td>Preview</td>
                <td>Name</td>
                <td>Actions</td>
            </tr>
            </thead>
            <tbody>
            <?
                while($row = mysql_fetch_array($res)){     
                  echo "<tr valign='middle'>";
                  echo "<td width='200'><img class='img-rounded' src='thumbnail.php?src=" . $row['loc'] . "&w=100'></td>";
                  echo "<td width='200'>" . $row['name'] . "</td>";
                  echo "<td><div class='btn-group'><a class='btn btn-large' data-toggle='modal' data-target='#taskModal' href='share.php?imgid=". $row['url'] . "'><i class='icon-group'></i></a><a class='btn btn-large' data-toggle='modal' data-target='#taskModal' href='edit.php?imgid="  . $row['url'] ."'><i class='icon-edit'></i></a><a class='btn btn-large' data-toggle='modal' data-target='#taskModal' href='delete.php?imgid="  . $row['url'] ."'><i class='icon-trash'></i></a></div></td>";

                  }
            }else{
                echo "<p class='text-error'>Oh No! We couldn't find any pictures. Click the upload button to upload some!</p>";
            }
            if(mysql_num_rows($res) > 0){
            echo "</tr>";
            echo "</tbody></table>";
            }
            ?>





</body>
</html>
4
Contributors
5
Replies
30
Views
3 Years
Discussion Span
Last Post by iamthwee
0

I have not touched the code of the included files for about six months, and they were checked at the time (and on the same PHP version). The syntax checker has no access to the other files, only that one - so the error must relate to that file.

0

Thanks for saying that, but how is that relevant to the question? As far as I'm aware there are no html errors that would cause a page to not load.

0

You do have two </form> closing tags, and that is an issue. Whether it is causing the page to not load I don't know.

Getting antsy about it doesn't help you, it may well be relevant.

I would remove chunks of the code one by one, systematically to home in on the problem. If this already on a production server turn on error reporting to debug the issue, remember to turn off after issue has been fixed.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.