Esempio n. 1
0
function latest()
{
    $dbc = mysqli_connect('localhost', 'root', '', 'test') or die("error connecting to the database");
    $query = "select * from creator where creatorid={$_GET['view']}";
    $result = mysqli_query($dbc, $query);
    $row = mysqli_fetch_array($result);
    $username = $row['username'];
    $query = "select * from article where creatorid={$_GET['view']}";
    $result = mysqli_query($dbc, $query);
    $outputstring = '';
    while ($row = mysqli_fetch_array($result)) {
        $id = $row['articleid'];
        $title = $row["title"];
        $myfile = fopen("{$row["articleid"]}.txt", "r");
        $content = "";
        $currentRow = 0;
        $numRows = 20;
        $postedon = $row['timestamp'];
        $address = calculatearticleimage($id);
        while (!feof($myfile) && $currentRow <= $numRows) {
            $currentRow++;
            $content .= fgets($myfile, 10);
        }
        $outputstring .= "<div class=\"divid\">\n                <img src=\"{$address}\" alt=\"img01\" />                \n                <h1>{$title}</h1>\n                <p id=\"gist\">{$content}..</p>\n                <p><a id=\"username\" href=\"profile.php?view={$_GET['view']}\">@{$username}</a></p>\n                <p id=\"timestamp\">posted on {$postedon}</p>\n                <p><a id=\"butt\" href=\"articles.php?article={$id}\">Read &raquo;</a></p>\n                \n            </div>";
    }
    echo $outputstring;
    //$row=mysqli_fetch_array($result);
    //$outputstring="<div class=\"divid\"><h1>{$row['title']}</h1><p>{$row['title']}</p><p class="timestamp"><i>@anishgkanchan</i></p><p class="timestamp"><i>posted on Nov' 26</i></p></div>"
}
Esempio n. 2
0
    $result2 = mysqli_query($dbc, $query3) or die('no query3');
    while ($row1 = mysqli_fetch_array($result2)) {
        $id = $row1['articleid'];
        $sql2 = mysqli_query($dbc, 'SELECT * from article WHERE articleid="' . $id . '"');
        $articledetails = mysqli_fetch_array($sql2);
        $postedon = $articledetails['timestamp'];
        $creatorid = $articledetails["creatorid"];
        $q = "select * from creator where creatorid={$creatorid}";
        $r = mysqli_fetch_array(mysqli_query($dbc, $q));
        $username = $r['username'];
        $title = $articledetails["title"];
        $myfile = fopen("{$articledetails["articleid"]}.txt", "r");
        $content = "";
        $currentRow = 0;
        $numRows = 20;
        $id = $articledetails["articleid"];
        $url = calculatearticleimage($id);
        while (!feof($myfile) && $currentRow <= $numRows) {
            $currentRow++;
            $content .= fgets($myfile, 10);
        }
        $outputstring .= "<div class=\"divid\">\n                <img src=\"{$url}\" alt=\"img01\" />                \n                <h1>{$title}</h1>\n                <p id=\"gist\">{$content}..</p>\n                <p><a id=\"username\" href=\"profile.php?view={$creatorid}\">@{$username}</a></p>\n                <p id=\"timestamp\">posted on {$postedon}</p>\n                <p><a id=\"butt\" href=\"articles.php?article={$id}\">Read &raquo;</a></p>\n                \n            </div>";
        echo $outputstring;
    }
}
?>

<?php 
include "basiclayout.php";
?>
		
Esempio n. 3
0
$buy = '';
while ($row = mysqli_fetch_array($result)) {
    $articleid = $row['articleid'];
    $dealid1 = $row['dealid'];
    $creatorid = $row['creator1'];
    $amount = $row['amount'];
    $query1 = "select * from creator where creatorid={$creatorid}";
    $result1 = mysqli_query($dbc, $query1);
    $row1 = mysqli_fetch_array($result1);
    $username = $row1['username'];
    $query2 = "select * from article where articleid={$articleid}";
    $result2 = mysqli_query($dbc, $query2);
    $row2 = mysqli_fetch_array($result2);
    $title = $row2['title'];
    $postedon = $row2['timestamp'];
    $address = calculatearticleimage($articleid);
    $buy .= "<div class=\"divid\" style=\"margin-top:-50px\">\n                <img src=\"{$address}\" alt=\"img01\" />                \n                <h1>{$title}</h1>\n                <p id=\"gist\">Amount for the article:{$amount}</p>\n                <p>request sent by:<a id=\"username\" href=\"profile.php?view={$creatorid}\"> @{$username}</a></p>\n               \n                 <p><a id=\"butt\" href=\"articles.php?article={$articleid}\">View Article &raquo;</a></p>\n                \n                <p><a id=\"butt\" href=\"acceptcopyright?dealid={$dealid1}\">Accept&raquo;</a>\n                    <a id=\"butt\" href=\"declinecopyright?dealid={$dealid}\">Decline&raquo;</a>\n                      \n            </div>";
}
function accept($dealid)
{
    echo "accept";
    $query = "update hiredeal set status=\"accept\" where dealid={$dealid}";
    $result = mysqli_query($dbc, $query);
}
function calculateimage1($id)
{
    //$imagearray=getimagesize("upload_pic/thumbnail_{$_SESSION['login_user']}.jpg");
    if (file_exists("upload_pic/thumbnail_{$id}.jpg")) {
        return "upload_pic/thumbnail_{$id}.jpg";
    } else {
        return "upload_pic/usericon.jpg";