Esmu beidzot saņēmies (un dažās lapās jau veiksmīgi izdarijis) uzrakstīt valīdu HTML.
http://46.109.34.200
S J miniblogs
- +1
S J 11.12.2012. 18:00
- +1
index fails iepriekš
<html>
<head>
<?php
include '/.http/etc/include/header.php';
function is_admin($auth) {
return ($auth->class == 'Administrators');
}
?>
<title>ieraksti kautko</title>
</head>
<body>
<?php
include '/.http/etc/include/include.php';
?>
<div id="text">
<?php
$ip = $_SERVER["REMOTE_ADDR"];
$utf8 = $db->query("SET NAMES utf8");
$message = $db->query("SELECT
`ieraksti`.`title`,
`ieraksti`.`author_id`,
`ieraksti`.`created`,
`ieraksti`.`content`,
`ieraksti`.`id`,
`users`.`class`,
`users`.`username`,
`users`.`banned`
FROM
`ieraksti`,
`users`
WHERE
`ieraksti`.`author_id` = `users`.`id`
ORDER BY
`ieraksti`.`created` DESC");
while ($new = $message->fetch_object()) {
$id = $new->id;
$com = $db->query("SELECT COUNT(*) FROM `komenti` WHERE `text_id` = '$id'");
$count = $com->fetch_row();
if ($new->author_id == $auth->id
|| is_admin($auth) ) {
echo '<div id="readbox"><div id="title"><a href="/read?id=' . $new-> id .'">' . $new->title . '</a></div><div id="small"><a id="edit" href=/editread?id=' . $new->id . '>[labot]</a> <b>Autors: </b><a class="' . $new->class .' ' . $new->banned . '" href="/user?id=' . $new-> author_id . '"> ' . $new->username . '</a> <b>Pievienots: </b>' . $new->created . '<b> Komentāri: </b>' . $count[0] . '</div>' . $new->content . '</div>';
}
else {
echo '<div id="readbox"><div id="title"><a href="/read?id=' . $new-> id .'">' . $new->title . '</a></div><div id="small"><b>Autors: </b><a class="' . $new->class .' ' . $new->banned . '" href="/user?id=' . $new-> author_id . '"> ' . $new->username . '</a> <b>Pievienots: </b>' . $new->created . '<b> Komentāri: </b>' . $count[0] . '</div>' . $new->content . '</div>';
}
}
echo '<div id="readbox"><center>';
$total_com = $db->query("SELECT COUNT(*) FROM `komenti`");
$com_count = $total_com->fetch_row();
$total_page = $db->query("SELECT COUNT(*) FROM `ieraksti`");
$page_count = $total_page->fetch_row();
$total_users = $db->query("SELECT COUNT(*) FROM `users`");
$user_count = $total_users->fetch_row();
echo 'Kopā komentāri lapā: ' . $com_count[0] . '<br />Kopā ieraksti lapā: ' . $page_count[0] . '<br />Kopā lietotāji lapā: ' . $user_count[0] . '';
echo '</div></center>';
?>
<div id="readbox"><center>© Svens, 2012</center></div>
<div id="center_orange"><a href="#">[uz augšu]</a></div>
un tagad<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<?php
include '/.http/etc/include/header.php';
?>
<title>ieraksti kautko</title>
</head>
<body>
<?php
include '/.http/etc/include/include.php';
?>
<div id="text">
<?php
$ip = $_SERVER["REMOTE_ADDR"];
$utf8 = $db->query("SET NAMES utf8");
$message = $db->query("SELECT
`ieraksti`.`title`,
`ieraksti`.`author_id`,
`ieraksti`.`created`,
`ieraksti`.`content`,
`ieraksti`.`id`,
`users`.`class`,
`users`.`username`,
`users`.`banned`
FROM
`ieraksti`,
`users`
WHERE
`ieraksti`.`author_id` = `users`.`id`
ORDER BY
`ieraksti`.`created` DESC");
while ($new = $message->fetch_object()) {
$id = $new->id;
$com = $db->query("SELECT COUNT(*) FROM `komenti` WHERE `text_id` = '$id'");
$count = $com->fetch_row();
if ($new->author_id == $auth->id || is_admin($auth) ) {
echo '<div class="readbox"><a class="title" href="/read?id=' . $new-> id .'">' . $new->title . '</a><div class="small"><a class="edit" href=/editread?id=' . $new->id . '>[labot]</a> <b>Autors: </b><a class="' . $new->class .' ' . $new->banned . '" href="/user?id=' . $new-> author_id . '"> ' . $new->username . '</a> <b>Pievienots: </b>' . $new->created . '<b> Komentāri: </b>' . $count[0] . '</div>' . $new->content . '</div>';
}
else {
echo '<div class="readbox"><a class="title" href="/read?id=' . $new-> id .'">' . $new->title . '</a><div class="small"><b>Autors: </b><a class="' . $new->class .' ' . $new->banned . '" href="/user?id=' . $new-> author_id . '"> ' . $new->username . '</a> <b>Pievienots: </b>' . $new->created . '<b> Komentāri: </b>' . $count[0] . '</div>' . $new->content . '</div>';
}
}
echo '<div class="readbox"><center>';
$total_com = $db->query("SELECT COUNT(*) FROM `komenti`");
$com_count = $total_com->fetch_row();
$total_page = $db->query("SELECT COUNT(*) FROM `ieraksti`");
$page_count = $total_page->fetch_row();
$total_users = $db->query("SELECT COUNT(*) FROM `users`");
$user_count = $total_users->fetch_row();
echo 'Kopā komentāri lapā: ' . $com_count[0] . '<br />Kopā ieraksti lapā: ' . $page_count[0] . '<br />Kopā lietotāji lapā: ' . $user_count[0] . '<br />© Svens, 2012</center></div>';
?>
</body>
</html>EDIT: tā paskatoties, jaunais jau uzreiz pēc skata izskatās labāk. :D
Ielogojies vai izveido profilu, lai komentētu!