-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmy-advertisement.php
executable file
·185 lines (172 loc) · 4.87 KB
/
my-advertisement.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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
<?php
include_once "header.php";
$limit= ceil($_SESSION['ad_count']/6);
$pn=ceil($limit/6);
if(isset($_GET['page']))
{
if($_GET['page']!=1)
{
$ll=(($_GET['page']*6)-6);
$page=$_GET['page'];
}
else{
$ll=0;
$page=1;
}
}
else{
$page=1;
$ll=0;
}?>
<section class="myads-section ">
<div class="ad-block">
<div class="row">
<?php
for($x=$ll;$x<($page*6);$x++)
{
if(isset($_SESSION['Product_Name'][$x]))
{
echo(' <div class="col-xs-12 col-sm-12 col-md-4 col-lg-4 col-xl-4 text-center ad-card-column">
<div class="ad-card">');
echo('<img src="assets/Products/'.$_SESSION['Product_Pic'][$x].'" class="ad-pic"/>
<div class="ad-card-body text-center">');
echo('<p class="ad-head">'.$_SESSION["Product_Name"][$x].'</p><hr class="ad-card-divider"/>');
echo('<p class="ad-info">'. $_SESSION["Product_Type"][$x].'<br/><i class="fas fa-rupee-sign"></i>'.$_SESSION['Product_Price'][$x].'<br/>'.
$_SESSION["Product_Description"][$x].'<br/></p>
<a href="#dialog" onclick="del('.$_SESSION['idno'][$x].')" class="btn-sm btn-danger smooth-scroll" >DELETE</a>
</div>
</div>
</div>');
}
else{
echo('');
}
}
?>
</div>
</div>
<?php
echo("<ul class='ad-pagin text-center'>
<span class='pagin-element-block'><a href='index.php?page=");
if($page>1){echo($page-1);}
else{echo("1");}
echo("'class='pagin-element btn-sm btn-warning'><i class='fas fa-angle-left'></i></li>");
if($page<6)
{
for($x=0;$x<6;$x++)
{
if($x<$limit)
{
echo("<a href='my-advertisement.php?page=".($x+1)."' class='pg-no pagin-element'>".($x+1)."</li>");
}
}}
else if($page%6==0){
for($x=$page;$x<$page+6;$x++)
{
if($x<=$limit)
{
echo("<a href='index.php?page=".($x)."' class='pg-no pagin-element'>".($x)."</li>");
}}}
else if(!($page%6==0) && $page>6 && $page<=$limit){
for($k=$page;$k>0;$k--)
{
if(($k%6==0)&&($k!=$page))
{
for($x=$k;$x<$k+6;$x++)
{
if($x<=$limit)
{
echo("<a href='my-advertisement.php?page=".($x)."' class='pg-no pagin-element'>".($x)."</li>");
}}
}}}
else{
http_response_code(404);
include('my_404.php');
die();
}
echo("<a href='my-advertisement.php?page=");
if($page<$limit){echo($page+1);}
else{echo($limit);}
echo("' class='pagin-element btn-sm btn-warning'><i class='fas fa-angle-right'></i></a>
</span>
</ul><br/>");
?>
<div id="dialog" class="delete-dialog text-center">
</div>
<script>
function del(id){
document.getElementById('dialog').innerHTML= '<p class="delete-warning">THIS ADVERTISEMENT WILL BE DELETED</p><br/>'+
'<a href="includes/delete.inc.php?id='+id+'" ><span class="btn-sm btn-danger btn-dialog">DELETE</span></a><span onclick="go_back()" class="btn-sm btn-success btn-dialog">GO BACK</span>';
document.getElementById('dialog').style.display="block";
document.getElementsByClassName('ad-block')[0].style.opacity="0.7";
}
function go_back(){
document.getElementById('dialog').style.display="none";
document.getElementsByClassName('ad-block')[0].style.opacity="1";
}
$(document).ready(function(){
// Add smooth scrolling to all links
$(".smooth-scroll").click(function (event) {
// Make sure this.hash has a value before overriding default behavior
if (this.hash !== "") {
// Prevent default anchor click behavior
event.preventDefault();
// Store hash
var hash = this.hash;
// Using jQuery's animate() method to add smooth page scroll
// The optional number (800) specifies the number of milliseconds it takes to scroll to the specified area
$('html, body').animate({
scrollTop: $(hash).offset().top -200
}, 800);
}});
});
</script>
<script>
$(document).ready(function(){
var pg = (document.URL).split("=");
var chngclr=parseInt(pg[1],10);
console.log(chngclr);
console.log(typeof chngclr);
if(pg[1]%6==0)
{
chngclr=1;
}else if(pg[1]>6 && !(pg[1]%6==0))
{
for(var k=pg[1];k>0;k--)
{
if(k%6==0 && k!=pg[1])
{
chngclr=(pg[1]-k+1);
}}}
else if(!chngclr){
chngclr=1;
}
$(".pg-no").css("background-color","rgba(254,254,254,0.5)");
document.getElementsByClassName("pg-no")[chngclr-1].style.backgroundColor="#ffc107";
$(window).scroll(function (){
console.log(5);
if($(window).width()>574)
{
if($(this).scrollTop()>35)
{
$(".headblock").css("padding","3");
}
else{
$(".headblock").css("padding","30");
}
}
else{ console.log(5);
if($(this).scrollTop()>35)
{
$(".headblock").css("padding","5");
}
else{
$(".headblock").css("padding","20");
}
}
});
});
</script>
</section>
<?php
include_once "footer.php" ?>