Vagrant Setup

Map vartual host directory with local drive directory
ln -s /vagrant/src /var/www/html

sudo su
apt-get install apache2 php5
service apache2 restart

Advertisements

Scan directory recursively and search text in files

<?php

die('-1');

if (!isset($_GET['code']) || $_GET['code']!='chkapmlp') {
 die('error');
}

if (isset($_POST['s']) && $_POST['s']!='' ) {
 
 define('DS', DIRECTORY_SEPARATOR);
 define('SEARCH', $_POST['s']);

//$base_path = 'D:\wamp\www\wp';
 $base_path = dirname(__FILE__);

function txtSrc($a, $b)
 {

//header('Content-Type: text/plain');
 //echo $a.'==='.$b; exit;
 $output = '';

$contents = file_get_contents($a);
 $pattern = preg_quote($b, '/');
 $pattern = "/^.*$pattern.*\$/m";
 if(preg_match_all($pattern, $contents, $matches)){
 $output .= "Found matches:\n";
 $output .= htmlentities(implode("\n", $matches[0]));
 }
 else{
 //echo "No matches found";
 } 
 return $output;
 }

function dirItr($cpath='')
 {
 $allow_ext = array('php','html');

$allow_dir = array('dir1','dir2');

$directoryIterator = new DirectoryIterator($cpath);
 foreach ($directoryIterator as $fileInfo) {
 if($fileInfo->isDot()) continue;

if($fileInfo->isFile()) {
 $fullpath = $fileInfo->getPath().DS.$fileInfo->getFilename();
 
 if (in_array($fileInfo->getExtension(), $allow_ext) &&
 '/chroot/home/augustap/augustapreciousmetals.com/html' != $fileInfo->getPath()
 ) {
 $output = txtSrc($fullpath, SEARCH);
 if ($output!='') {
 echo $output . "<br />";
 //echo "<b>".$fileInfo->getPathname() . "</b><br />";
 echo "<b>".$fullpath . "</b><br /><br />";
 } 
 }
 }
 elseif($fileInfo->isDir()) {
 if (in_array($fileInfo->getFilename(), $allow_dir)) {
 //echo '<b>';
 //echo $fileInfo->getPath().DS.$fileInfo->getFilename() . "<br>\n";
 //echo '</b>';
 dirItr($fileInfo->getPath().DS.$fileInfo->getFilename()); 
 }
 
 }
 }
 }
 dirItr($base_path);
 echo 'Done!<br />';

}
?>
<!DOCTYPE html>
<html>
<head>
 <title>Search Text</title>
</head>
<body>
 <form action="" method="post">
 <input type="text" name="s" value="<?php echo (isset($_POST['s'])) ? $_POST['s'] : '' ;?>">
 <!-- <input type="text" name=""> -->
 <input type="submit" name="submit" value="Submit">
 </form>
</body>
</html>

Skype : Sorry, we couldn’t connect to skype

Recently in my laptop and i had an problem with skype. It shows following message,

Sorry, we couldn’t connect to skype

and here is the solution for this problem,

  • open internet explorer browser
  • click “tools” -> “internet options” (if you don’t see the menu bar, then right click near tab and check “menu bar”)
  • click “advance” then click “reset” button
  • save and close internet explorer.

that’s it, now completely quit from skype and start again, hope you can login now ­čÖé

 

 

Multi-level CSS Menu

Use this css to generate multilevel css drop down menu.

.nav{
width:450px;
padding-top:64px;
float:right;
position:relative;
}

.nav ul
{
list-style-type: none;
padding: 0px;
margin: 0px;
}

.nav li{ font-family:Arial, Helvetica, sans-serif; font-size:12px; font-weight:normal; color:#bcbdc0; list-style:none; display:inline; float:left; padding-left:20px; }

.nav li a, .nav li a:link, .nav li a:visited {
display:block;
margin: 0px;
color:#bcbdc0;
text-decoration:none;
}

.nav li a:hover, .nav li a:active {
color:#FFFFFF;
text-decoration: none;
margin-top: 0px;
}

.nav li li a, .nav li li a:link, .nav li li a:visited {
background:#00427A;
width: 100px;
font-family:Arial, Helvetica, sans-serif; font-size:12px; font-weight:normal; color:#bcbdc0;
float: none;
margin: 0px;
padding: 5px 7px 5px 7px;
border-bottom: 1px solid #0E3B62;
border-left: 1px solid #0E3B62;
border-right: 1px solid #0E3B62;
}

.nav li li a:hover, .nav li li a:active {
background:#00427A;
color: #FFFFFF;
margin: 0px;
padding: 5px 7px 5px 7px;
}

.nav li ul {
position: absolute;
left: -999em;
height: auto;
width: 170px;
margin: 0px;
padding: 0px;
z-index: 100;
margin: 0 0 0 -12px;
}

/*my*/
.nav li ul li{

float: left;
list-style: none;
background: none;
font-family:Georgia, “Times New Roman”, Times, serif;
font-size:21px;
font-weight:normal;
color:#FFFFFF;
padding-left:11px;
padding-right:4px;
display:inline;
}
/*my*/

.nav li li {
}

.nav li ul a {
width: 140px;
}

.nav li ul a:hover, .nav li ul a:active {
}

.nav li ul ul {
margin: -27px 0 0 104px;
}

.nav li:hover ul ul, .nav li:hover ul ul ul, .nav li.sfhover ul ul, .nav li.sfhover ul ul ul {
left: -999em;
}

.nav li:hover ul, .nav li li:hover ul, .nav li li li:hover ul, .nav li.sfhover ul, .nav li li.sfhover ul, .nav li li li.sfhover ul {
left: auto;
}

.nav li:hover, .nav li.sfhover {
position: static;
}