Файл: Source/pages/faq.php
Строк: 163
<?php
/*
* Script name: Points4Prize
* Author: Soft Projects
* Date created: 15/07/2015
*/
require_once 'inc/header.php';
?>
<body class="no-slider">
<!-- <body class="has-top-menu"> -->
<!-- BEGIN #slider-imgs -->
<div id="slider-imgs">
<div class="featured-img-box">
<div id="featured-img-1" class="featured-img"></div>
<div id="featured-img-2" class="featured-img invisible"></div>
<div id="featured-img-3" class="featured-img invisible"></div>
<div id="featured-img-4" class="featured-img invisible"></div>
</div>
<!-- END #slider-imgs -->
</div>
<!-- BEGIN #top-layer -->
<div id="top-layer">
<div id="header-top">
<?php
require_once 'inc/header_top.php';
?>
</div>
<section id="content">
<header id="header">
<div id="menu-bottom">
<?php
require_once 'inc/menu_bottom.php';
?>
</div>
<div class="wrapper">
<div class="header-breadcrumbs">
<h2 class="right">FAQ</h2>
<ul>
<li><a href="index.php">Home</a></li>
<li>FAQ</li>
</ul>
</div>
</div>
</header>
<div id="main-box">
<!-- BEGIN #main -->
<div id="main">
<h2><span>Frequently Asked Questions</span></h2>
<div class="content-padding">
<div class="article-full">
<div class="accordion">
<?php
$checkalln = mysql_query("SELECT id FROM chesto_zadavani_vaprosi WHERE active='yes'");
$broi = mysql_num_rows($checkalln);
$pp = 15;
if ($broi > 0) {
$pages = ceil($broi / $pp);
$page = (int) $_GET['p'];
$page = sprintf("%s", mysql_real_escape_string($page));
if ($page == 0 || $page < 0 || $page == NULL) {
$page = 1;
}
if ($page > $pages) {
$page = $pages;
}
$begin = ($page * $pp) - $pp;
$result = mysql_query("SELECT * FROM chesto_zadavani_vaprosi WHERE active='yes' ORDER by id DESC LIMIT {$begin},{$pp}") or die(mysql_error());
for ($i = 0; $i < mysql_num_rows($result); ++$i) {
$row = mysql_fetch_array($result);
$rank = $i + 1 + $begin;
echo '<div class="accordion-tab">
<a>' . $row['vapros'] . ' </a>
<div class="accordion-block">
' . $row['date'] . '<hr />
<h5>' . $row['otgovor'] . '</h5>
<BR />
</div>
</div>';
}
$next = $page + 1;
$next2 = $page + 2;
$prev = $page - 1;
$prev2 = $page - 2;
if ($pages >= $next) {
$nexts = "<a href='/faq-$next'><button class='page'>></button></a>";
$pageup1 = "<a href='/faq-$next'><button class='page'>$next</button></a>";
} else {
$nexts = "<button class='npage' disabled='disabled'>></button>";
}
if ($pages >= $next2) {
$pageup2 = "<a href='/faq-$next2'><button class='page'>$next2</button></a>";
$last = "<a href='/faq-$pages'><button class='page'>>></button></a>";
} else {
$last = "<button class='npage' disabled='disabled'>>></button>";
}
if ($page > 1) {
$prevs = "<a href='/faq-$prev'><button class='page'><</button></a>";
$pagedw1 = "<a href='/faq-$prev'><button class='page'>$prev</button></a>";
} else {
$prevs = "<button class='npage' disabled='disabled'><</button>";
}
if ($page > 2) {
$pagedw2 = "<a href='/faq-$prev2'><button class='page'>$prev2</button></a>";
$first = "<a href='/faq-1'><button class='page'><<</button></a>";
} else {
$first = "<button class='npage' disabled='disabled'><<</button>";
}
if ($page == 1 and $pages > 3) {
$pageup3 = "<a href='/faq-4'><button class='page'>4</button></a>";
}
if ($page == $pages and $pages > 3) {
$pagedw3 = "<a href='/faq-1'><button class='page'>1</button></a>";
}
if ($broi > $pp) {
echo "<div style='text-align:left; margin:37px 20px 3px 10px; float:left;'>
$first $prevs $pagedw3 $pagedw2 $pagedw1 <button class='npage' disabled='disabled'>$page</button> $pageup1 $pageup2 $pageup3 $nexts $last
</div>";
}
}
?>
</div>
</div>
<!-- END .content-padding -->
</div>
<!-- END #main -->
</div>
<!-- BEGIN #sidebar -->
<aside id="sidebar">
<!-- BEGIN .panel -->
<div class="panel">
<h2>Ask a question</h2>
<div class="panel-content">
<?php
if (isset($_POST['send'])){
$date = date("F j, Y , g:i a");
$ntime = time() + 300;
$time = time();
$ip = $_SERVER['REMOTE_ADDR'];
$zapitwane = htmlspecialchars($_POST['vapros']);
$pital = htmlspecialchars($_POST['tawfaafw']);
$result2 = mysql_query("SELECT * FROM chzv WHERE ip='{$ip}' and time > {$time}") or die(mysql_error());
if (mysql_num_rows($result2) == 0) {
if ($pital == ""){
echo "<div class='info-message' style='background-color: #a2402 role='alert'>Please enter your name.</div>";
} elseif ($zapitwane == ""){
echo "<div class='info-message' style='background-color: #a24026;' role='alert'>Please enter your question.</div>";
}else {
mysql_query("INSERT INTO `chesto_zadavani_vaprosi` (`id`, `vapros`, `pital`, `otgovor`, `otnosno`, `active`,`date`) VALUES (NULL, '$zapitwane', '$pital', '<font color=red>Expect answer within 12 hours.</font>', '', 'no','$date')");
mysql_query("INSERT INTO chzv (ip, time) VALUES('{$ip}','{$ntime}')") or die(mysql_error());
echo '
<div class="info-message" style="background-color: #75a226;">
ВYour request has been sent.<br />Expect a response within 12 hours.</div>';
}
} else {
$row2 = mysql_fetch_array($result2);
$diff = $row2['time'] - time();
$hh = floor($diff / 3600);
$r_mm = floor(($diff - ($hh * 3600)) / 60);
echo '<div class="info-message" style="background-color: #a24026;">
You have already submitted a request. You can send again '.$r_mm.' minutes.</div>';
}
}
?>
<form method="POST" id="commentform" class="comment-form">
Your name:
<input name="tawfaafw" type="text" value="" size="30" aria-required="true" placeholder="Your name">
<br /> <br />
Your question:
<textarea style="width: 235px;" name="vapros" type="text" aria-required="true" placeholder="Your question"></textarea>
<br /> <br />
<p class="form-submit">
<input style="margin: 0px ! important;" id="submit" name="send" value="Sent question" class="button" type="submit">
</p>
</form>
</div>
<!-- END .panel -->
</div>
<!-- END #sidebar -->
</aside>
<div class="clear-float"></div>
</div>
</div>
</div>
<?php
require_once 'inc/footer.php';
?>