Add new views and styles for music application
- Created new CSS files for styling the application, including home.css and style.css. - Implemented 403 and 404 error views with appropriate messages and navigation. - Developed a dump view to display deleted elements with restoration options. - Enhanced home view to include music search functionality and display results. - Added listplay view for managing music playlists, including creation and deletion options. - Implemented loadmusic view for uploading new music with necessary fields. - Created login and register views for user authentication. - Developed sound view to display individual music tracks with playback controls and options for liking and deleting. - Updated menu view to include navigation links based on user authentication status.
This commit is contained in:
65
controller/connection/Connection.controller.php
Normal file
65
controller/connection/Connection.controller.php
Normal file
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
class Connection{
|
||||
protected $lastID;
|
||||
|
||||
function __construct(){
|
||||
$this->param = include 'param.php';
|
||||
}
|
||||
|
||||
private function getConnection(){
|
||||
$param = include 'param.php';
|
||||
return mysqli_connect($param['host'], $param['username'], $param['password'], $param['dbname']);
|
||||
}
|
||||
|
||||
protected function tableExists(string $table){
|
||||
$tables = $this->getData("SHOW TABLES");
|
||||
foreach($tables as $tableName){
|
||||
if(strtolower($tableName[0]) == strtolower($table)){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected function execNoQuery($sql){
|
||||
$link = $this->getConnection();
|
||||
if(mysqli_query($link, $sql)){
|
||||
$this->lastID = mysqli_insert_id($link);
|
||||
mysqli_close($link);
|
||||
}else{
|
||||
echo mysqli_error($link) . '<br><br>';
|
||||
}
|
||||
}
|
||||
|
||||
private function execQuery($sql){
|
||||
$link = $this->getConnection();
|
||||
$query = mysqli_query($link, $sql);
|
||||
if(mysqli_close($link)){
|
||||
return $query;
|
||||
}else{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
protected function getValue($tableName, $nameParam1, $nameParam2, $valueSearh){
|
||||
$sql = "SELECT $nameParam1 FROM $tableName WHERE $nameParam2='$valueSearh'";
|
||||
$result = $this->execQuery($sql);
|
||||
return mysqli_fetch_array($result)[$nameParam1];
|
||||
}
|
||||
|
||||
protected function getData($sql, $idColumn=null){
|
||||
$result = $this->execQuery($sql);
|
||||
$data = [];
|
||||
$cont = 0;
|
||||
while($row = mysqli_fetch_array($result)){
|
||||
if($idColumn == null){
|
||||
$data[$cont] = $row;
|
||||
$cont++;
|
||||
}else{
|
||||
$data[$row[$idColumn]] = $row;
|
||||
}
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
9
controller/connection/param.php
Normal file
9
controller/connection/param.php
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
"dbname" => "musicdb",
|
||||
"username" => "root",
|
||||
"password" => "",
|
||||
"host" => "localhost"
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user