-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php~
93 lines (89 loc) · 2.11 KB
/
index.php~
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<?php
session_start();
include('set_lang.php');
echo $lang;
include("connect_db.php");
include("translate.php");
if (isset($_POST['create_news'])){
Header("Location: addnews.html");
}
if (empty($_GET['page'])) {
$page = 1;
}else{
$page = $_GET['page'];
}
include('header.html');
echo '
<div class="leftside">
gfdfghjkl,kjhgf
</div>
<div class="center">';
$STH = $DBH->query("SELECT COUNT(*) as count FROM post");
$STH->setFetchMode(PDO::FETCH_ASSOC);
$row = $STH->fetch();
$m = $row['count'];
$posts = $m;
echo $posts;
$total = (int)(($posts - 1) / 10) + 1;
$page = (int)($page);
if(empty($page) or $page < 0)
{
$page = 1;
}
if($page > $total)
{
$page = $total;
}
$max = $page*10;
$min = $page*10 - 10;
$strSQL = "SELECT * from post LIMIT ".$min.", 10";
$STH = $DBH->query($strSQL);
while($row = $STH->fetch())
{
echo '<div class="post">';
if($lang == 'eng'){
echo"<b>".$row['title']."</b>";
echo '</div><div class="post">';
echo $row['short_text'];
}else{
echo"<b>".$row['title_ukr']."</b>";
echo '</div><div class="post">';
echo $row['text_short_ukr'];
}
$s = "news.php?id=".$row['id'];
echo"<a href=".$s.">".t($lang,'read_more')."</a>";
echo '</div><div class="post">';
$link_profil="profil.php?id=".$row['author_id'];
echo"<p>author:<a href=".$link_profil.">".$row['author']."</a>data: ".$row['data']."<p></div>";
}
$previous_page = $page-1;
$next_page = $page+1;
echo " <a href=index.php?page=".$previous_page.">back </a>
<a href=index.php?page=".$next_page.">next </a></div>
<div class='rightside'>";
if (!isset($_SESSION['ent']))
{
$_SESSION['ent'] = 3;
}
if ($_SESSION['ent'] == 3)
{
if (!empty($_SESSION['erreg']))
{
echo $_SESSION['erreg'];
$_SESSION['erreg'] = '';
}
if (!empty($_SESSION['erlog']))
{
echo $_SESSION['erlog'];
$_SESSION['erlog']='';
}
echo " <FORM ACTION='' METHOD='POST'>
<a href='reg.html'>registation</a>
</FORM> ";
include( "login.html");
}
else{
include('rightside_enter.php');
}
echo "</div></body></html>";
?>