Home Files
Adminer
Execute Command
PHP Eval
Symlink
File Upload
Owner :
www-data
PHP Version
5.6.40-0+deb8u12
Disk Space
41.02 GB
Server Addr
19-www4
Your IP
10.10.10.40
Edit File
File:
<?php function select($table, $campo, $where = ''){ $sql = mysql_query("SELECT $campo FROM $table {$where}"); $result = mysql_num_rows($sql); if($result > 0) { $ln = mysql_fetch_object($sql); return $ln->$campo; } else { return false; } } /* * função para inserir registros no banco de dados * * @param string $field O nome da coluna * @param string $value A informação * @param string $table O nome da tabela Inserir vários campos insert(array("nome","idade","profissao"), array("renan",22,"programador"),"cadastro"); inserir dados em uma única coluna insert("nome","Renan","cadastro"); * */ function insert($field,$value,$table){ if((is_array($field)) and (is_array($value))){ if(count($field) == count($value)){ $sql_ = "INSERT INTO {$table} (".implode(', ', $field).") VALUES ('".implode('\', \'', $value)."')"; $sql = mysql_query($sql_) or die (mysql_error().$sql_); if($sql){ return true; }else{ return false; } }else{ return false; } }else{ $sql_ = "INSERT INTO {$table} ({$field}) VALUES ({$value})"; $sql = mysql_query($sql) or die (mysql_error().$sql_); if($sql){ return true; }else{ return false; } } } /* * função para atualizar registros no banco de dados * * * @param string $field O nome do campo * @param string $value O novo valor * @param string $table O nome da tabela * @param string $where Onde será atualizado * @return TRUE em caso de sucesso update(array("tipo","texto"), array("vinicius","nunes"),"textos","WHERE ID = 7"); */ function update($field,$value,$table,$where){ if((is_array($field)) and (is_array($value))){ if(count($field) == count($value)){ $field_value = NULL; for ($i=0;$i<count($field);$i++){ $field_value .= " {$field[$i]} = '{$value[$i]}',"; } $field_value = substr($field_value,0,-1); $sql_ = "UPDATE {$table} SET {$field_value} {$where}"; $update = mysql_query($sql_) or die (mysql_error().$sql_); if($update){ return true; }else{ return false; } }else{ return false; } }else{ $sql_ = "UPDATE {$table} SET {$field} = '{$value}' {$where}"; $update = mysql_query($sql_) or die (mysql_error().$sql_); if($update){ return true; }else{ return false; } } } function deleteSql($table, $where) { mysql_query("DELETE FROM {$table} {$where}"); } ?>