Crmgo Blog

PHP

← Blog / Programming

PHP

Posts: 11

PHP PDO

PHP PDO

· PHP

PDO Usage Examples Setting up a MySQL connection: connection with encoding consideration: PDO provides two ways to execute a query: preparing variables – recommended for speed && security direct execution Queries that modify information are executed via the exec() method: The exec method returns a value –…

Asterisk log file to MySQL

Asterisk log file to MySQL

· PHP

I record phone calls in ogg format and store their information in a MySQL database. Recently, because I reinstalled Asterisk and overwrote the configuration file for connecting to MySQL, all the data was lost for half a month. Fortunately, the information was being written in parallel...

PHP: Recursive Search and Deletion of Empty Folders

PHP: Recursive Search and Deletion of Empty Folders

· PHP

# made by Lomaka Dmitriy <?php echo date("h:i:s")." start"; chdir ("/home/"); @browser(); echo date("h:i:s")." stop"; //$all = ""; function browser($dir){ $files=glob("*"); foreach ($files as $file){ if ($file == "." || $file == "..") continue; if (is_dir ($file)){ chdir ($file); $all_dir=getcwd();…

PHP, example of interaction with the command line

PHP, example of interaction with the command line

· PHP

<div align="center" style="margin-top: 100px; border: 1px solid; width: 500px; padding-top: 9px;"> <form method="post" action="search.php?action=complited"> <input type="text" name="text" size="40"> <input type="submit" value="grep"> </form> <?php if ($_SERVER['REQUEST_URI']=='/search.php?action=complited'){ echo '<pre>'; // Outputs the entire result of the shell command "ls", and returns // the last line of output to…

PHP script for logging from 3proxy to MySQL

PHP script for logging from 3proxy to MySQL

· PHP

<?php /////////////////////////////////////example of a 3PROXY config file/////////////////////////////// //log /var/log/3proxy/3proxy.log D //logformat "G%t|%C|%R:%r|%O|%I|%n|%T" //rotate 60 //daemon //users promo:CL:xxxx //auth strong //allow promo //proxy -p7777 -n -i192.168.x.xxx -exxx.xxx.xxx.xxx //flush //end /////////////////////////////////////MYSQL//////////////////////////////// //mysql -p //create database 3proxy; //use 3proxy; //CREATE TABLE logs (time datetime, ip_local…

PHP script for creating and running a bash file

PHP script for creating and running a bash file

· PHP

<?php //#$dir_search=$_GET['dir']; $name_search=$_GET['name']; //path and the file itself $file="search.sh"; //if the file doesn't exist... then //if( !file_exists($file)) { $fp = fopen($file, "w"); // ("r" - read, "w" - create, "a" - append to text), we create the file fwrite($fp, "#!bin/bash\n grep -lr '".$name_search."' ./…

Links

Links

· PHP

Working with MySQL (main functions) Example of retrieving information from MySQL Examples of adding records to MySQL