php sql server connection : connect to MS SQL Server database

<?php $myServer = “localhost”; $myUser = “your_name”; $myPass = “your_password”; $myDB = “examples”; //connection to the database $dbhandle = mssql_connect($myServer, $myUser, $myPass) or die(“Couldn’t connect to SQL Server on $myServer”); //select a database to work with $selected = mssql_select_db($myDB, $dbhandle) or die(“Couldn’t open database $myDB”); //declare the SQL statement that will query the database $query … Read more

Execute root commands via PHP

I have a CentOS 5.7 linux server and use php5.3.x. On a pfSense system, you can restart services-that required root permissions using a php web page. I’m trying to do something similar, I have written some php code to execute shell commands. For example, to restart the sshd service: <?php exec(‘/sbin/service sshd restart’); ?> and … Read more

Backup and Restore Mysql database table

MySQL Cluster

Dump and restore from .sql Dump mysqldump db_name table_name > table_name.sql Restore mysql -u <user_name> -p db_name mysql> source <full_path>/table_name.sql or in one line mysql -u username -p db_name < /path/to/table_name.sql Dump and restore from a compressed (.sql.gz) format Dump mysqldump db_name table_name | gzip > table_name.sql.gz Restore gunzip < table_name.sql.gz | mysql -u username … Read more

Setting to Limit SIP channels

Asterisk dial command

You have the 6 channels, and basically you have 6 calls going on… Now when you hang up the do hang up, they dont get stuck right? So you have 6 different peopel on the line and when 7 hits they block you and essentially your phone system is dead….? Ok, one thing you could … Read more

No route to host (113)

In host machine iptables is running and is blocking the port 5901. Kill all the vncserver desktop in the host machine and run the following command in the terminal. Type the password for the user when prompted. sudo iptables -I INPUT 1 -p tcp –dport 5901 -j ACCEPT The above command will add the port 5901 … Read more

Asterisk RealTime database Architecture

Asterisk dial command

Terminology/Files Driver – A compiled module containing database specific code that accepts the generalized function calls that RealTime makes. As of this writing, only ODBC, MySQL (via asterisk-addons) and LDAP (see http://free.oxymium.net/Asterisk/ and http://bugs.digium.com/view.php?id=5768) drivers are available. Family – A name associated with a RealTime call. Examples: sippeers, sipusers, voicemail. extconfig.conf – The configuration file … Read more

httpd: unrecognized service

I’ve installed the Apache web server on Kali Linux and I’m able to start/stop it with: /usr/usr/local/apache2/bin/apachectl restart[start/stop] But if I try to launch it with service command service httpd restart[start/stop] it says httpd: unrecognized service I would use the second way to launch Apache because it’s shorter and I can keep it in mind. … Read more