-
Notifications
You must be signed in to change notification settings - Fork 0
/
search.php
135 lines (114 loc) · 4.66 KB
/
search.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
<!DOCTYPE html>
<html>
<head>
<title>Search By Audio</title>
<style>
form{
background-color:blue;
padding:30px;
color:white;
border-radius: 20px;
text-align:center;
font-size:20px;
}
input:hover{
background-color:blue;
color:white;
}
form:hover{
background-color:black;
color:white;
font-size:20px;
}
div{
background-color:black;
color:white;
font-size:20px;
padding:10px;
width:70%;
border-radius:9px;
}
div:hover{
background-color:red;
padding:10px;
font-size:20px;
}input{
background-color:white;color:blue;padding:10px;font-size:20px;border:none;border-radius:4px;
}
</style>
</head>
<body>
<form action="" method="post" enctype="multipart/form-data">
Select Audio to Search:
<input type="file" name="fileToUpload" id="fileToUpload">
<input type="submit" value="Search" name="submit">
</form>
</body>
</html>
<?php
if(isset($_POST["submit"])){
$con=mysqli_connect('localhost','root','SNEHA143guddu','audio');
$target_dir = "upload/";
$target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]);
$uploadOk = 1;
$imageFileType = strtolower(pathinfo($target_file,PATHINFO_EXTENSION));
// Check if image file is a actual image or fake image
// Check if file already exists
if (file_exists($target_file)) {
echo "<h1><center>Nothing To Search</h1>";
$uploadOk = 0;
}
// Check file size
// Allow certain file formats
if($imageFileType != "mp3") {
echo "<script>alert('Sorry, only MP3 files are allowed');</script>";
$uploadOk = 0;
}
// Check if $uploadOk is set to 0 by an error
if ($uploadOk == 0) {
echo "<h2><marquee>Sorry,No file was uploaded.</marquee></h2>";
// if everything is ok, try to upload file
} else {
if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) {
$filename=$target_file;
$a=explode(".",$filename);
$ex=end($a);
$p1=base64_encode(file_get_contents($filename, FALSE, NULL,0,600));
$p2=base64_encode(file_get_contents($filename, FALSE, NULL,601,1200));
$p3=base64_encode(file_get_contents($filename, FALSE, NULL,1201,1800));
$p4=base64_encode(file_get_contents($filename, FALSE, NULL,1801,2400));
$p5=base64_encode(file_get_contents($filename, FALSE, NULL,2401,3000));
$p6=base64_encode(file_get_contents($filename, FALSE, NULL,3001,3600));
$p7=base64_encode(file_get_contents($filename, FALSE, NULL,3601,4200));
$p8=base64_encode(file_get_contents($filename, FALSE, NULL,4201,4800));
$p9=base64_encode(file_get_contents($filename, FALSE, NULL,4801,5400));
$p10=base64_encode(file_get_contents($filename, FALSE, NULL,5401,6000));
///////////////////////////////////////////////////////
$name=explode("/",$filename);
$name=end($name);
echo"<h3><center>Your Search is For Audio:- <font color='red'>".ucwords(htmlentities($name))."</font></h3><hr><center>";
$sql="SELECT * FROM audio WHERE `name`LIKE '%$name%' OR `p1`LIKE '%$p1%' OR `p2`LIKE '%$p2%' OR`p3`LIKE '%$p3%' OR`p4`LIKE '%$p4%'OR`p5`LIKE '%$p5%'OR`p6`LIKE '%$p6%'OR`p7`LIKE '%$p7%'OR`p8`LIKE '%$p8%'OR`p9`LIKE '%$p9%'OR`p10`LIKE '%$p10%' OR `p1`LIKE '%$p2%'OR `p1`LIKE '%$p3%'OR `p1`LIKE '%$p4%'OR `p1`LIKE '%$p5%'OR `p1`LIKE '%$p6%'OR `p1`LIKE '%$p7%'OR `p1`LIKE '%$p8%'OR `p1`LIKE '%$p9%'OR `p1`LIKE '%$p10%'OR `p2`LIKE '%$p1%'OR `p2`LIKE '%$p1%'OR `p2`LIKE '%$p2%'OR `p2`LIKE '%$p3%'OR `p2`LIKE '%$p4%'OR `p2`LIKE '%$p5%'OR `p2`LIKE '%$p6%'OR `p2`LIKE '%$p7%'OR `p2`LIKE '%$p8%'OR `p2`LIKE '%$p9%'OR `p2`LIKE '%$p10%'OR `p3`LIKE '%$p1%'OR `p3`LIKE '%$p2%'OR `p3`LIKE '%$p3%'OR `p3`LIKE '%$p4%'OR `p3`LIKE '%$p5%'OR `p3`LIKE '%$p6%'OR `p3`LIKE '%$p7%'OR `p3`LIKE '%$p8%'OR `p3`LIKE '%$p9%'OR `p3`LIKE '%$p10%'OR `p4`LIKE '%$p1%'OR `p4`LIKE '%$p1%'OR `p4`LIKE '%$p2%'OR `p4`LIKE '%$p3%'OR `p4`LIKE '%$p4%'OR `p4`LIKE '%$p5%'OR `p4`LIKE '%$p6%'OR `p4`LIKE '%$p7%'OR `p4`LIKE '%$p8%'OR `p4`LIKE '%$p9%'OR `p4`LIKE '%$p10%' ORDER BY time DESC limit 100";
//---------------------------------------------------------------------------------Display Mails-------------------------------
$result=$con->query($sql);
if($result->num_rows>0){
while($row=$result->fetch_assoc()){
$id=$row["id"];
$name=$row["name"];
$link=$row["link"];
echo"<div><b>Audio Name:-".ucwords(htmlentities($name))."<br><audio controls>
<source src='".$link."'type='audio/".$row['ex']."'></audio></div><br>
";
}
}
unlink($filename);
} else {
echo "Sorry, there was an error uploading your file.";
}
}
}
else{
echo"<h1><center>Welcome to Search By Audio System.
Nothing To Search....For any help,suggest,advice,query call or whatsapp +919547551208.<hr>
Thanks for View<br>This system was Founded,Invent & Developed by Guddu Modok & his company</h1>";
}
?>