Sunday, 30 December 2018

Delete Web page cache

Many time we edit web page but user browers not showing latest contents due to browers cache.
Just copy this code and paste between <head> given code here </head> section and save your file. You user always show latest content on your web page.

<----code start here --->

<meta http-equiv="cache-control" content="max-age=0" />
<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="expires" content="0" />
<meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT" />
<meta http-equiv="pragma" content="no-cache" />

<---- code end here ------->

This code delete all old previous cache for your web page from user browers

Friday, 28 December 2018

get data from sql by join three table

Using This code you can join three table for fetching data from mysql.
mysql data and table details :
hostname : localhost
dbusername : dbusername
dbpassword : yourpassword
dbname : dbname
Table Details :
Table 1 : wp_users ( column name : ID , user_login )
Table 2 : user_transactions ( column : user_id , referral_amnt )
Table 3 : user_plans ( column : user_id , amount_paid )

Just copy and paste this code and modify mysql and table details as per your details

<?php
 $connect = mysqli_connect("localhost", "dbusername", "yourpassword", "dbname");
 $sql = "SELECT * FROM wp_users INNER JOIN user_transactions ON wp_users.ID = user_transactions.user_id 
JOIN user_plans ON wp_users.ID = user_plans.user_id";
 $result = mysqli_query($connect, $sql);
 ?>


 <!DOCTYPE html>
 <html>
      <head>
           <title>Get Data from Join Three Table</title>
           <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
           <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" />
           <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
      </head>
      <body>
           <br />
           <div class="container" style="width:980px;">
<Img src="https://yourdomain.com/wp-content/uploads/2018/12/transparent-logo-1-1.png"width="150px" height="150px"><br>
                <h3 align="">Join Three Table</h3><br />               
                <div class="table-responsive">
                     <table class="table table-striped">
                          <tr>
                               <th>User Name</th>
                               <th>Total Invested Amount</th>
                               <th>Referral Amount</th>
                             
                          </tr>
                          <?php
                          if(mysqli_num_rows($result) > 0)
                          {
                               while($row = mysqli_fetch_array($result))
                               {
                          ?>
                          <tr>
                               <td><?php echo $row["user_login"];?></td>
<td><?php echo $row["amount_paid"]; ?></td>
                               <td><?php echo $row["referral_amnt"]; ?></td>
                             
                          </tr>
                          <?php
                               }
                          }
                          ?>
                     </table>
                </div>
           </div>
           <br />
      </body>
 </html>

get data from sql by join two table

Using This code you can join two table for fetching data from mysql.
mysql data and table details :
hostname : localhost
dbusername : dbusername
dbpassword : yourpassword
dbname : dbname
Table Details :
Table 1 : wp_users ( column name : ID , user_login )
Table 2 : user_transactions ( column : user_id , referral_amnt )

Just copy and paste this code and modify mysql and table details as per your details

<?php
 $connect = mysqli_connect("localhost", "investment_new", "yourpassword", "investment_wp");
 $sql = "SELECT * FROM wp_users INNER JOIN user_transactions ON wp_users.ID = user_transactions.user_id";
 $result = mysqli_query($connect, $sql);
 ?>
 <!DOCTYPE html>
 <html>
      <head>
           <title>Get Data from Join Two Table</title>
           <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
           <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" />
           <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
      </head>
      <body>
           <br />
           <div class="container" style="width:980px;">
<Img src="https://www.yourdomain.com/wp-content/uploads/2018/12/transparent-logo-1-1.png"width="150px" height="150px"><br>
                <h3 align="">Join Two Table</h3><br />               
                <div class="table-responsive">
                     <table class="table table-striped">
                          <tr>
                               <th>User Name</th>
                               <th>Referral Amount</th>
                             
                          </tr>
                          <?php
                          if(mysqli_num_rows($result) > 0)
                          {
                               while($row = mysqli_fetch_array($result))
                               {
                          ?>
                          <tr>
                               <td><?php echo $row["user_login"];?></td>
                               <td><?php echo $row["referral_amnt"]; ?></td>
                             
                          </tr>
                          <?php
                               }
                          }
                          ?>
                     </table>
                </div>
           </div>
           <br />
      </body>
 </html>

Simple search form in php

Using This code you can fetching data from mysql.
mysql data and table details :
hostname : localhost
dbusername : dbusername
dbpassword : yourpassword
dbname : dbname
Table Details :
Table 1 : table_users ( column name : pk_i_id , name , username , password  )


Just copy and paste this code and modify mysql and table details as per your details

<?php

if(isset($_POST['search']))
{
    $valueToSearch = $_POST['valueToSearch'];
    // search in all table columns
    // using concat mysql function
    $query = "SELECT * FROM `table_user` WHERE CONCAT(`pk_i_id`, `s_name`, `s_username`, `s_password`) LIKE '%".$valueToSearch."%'";
    $search_result = filterTable($query);
 
}
 else {
    $query = "SELECT * FROM `osoh_t_user`";
    $search_result = filterTable($query);
}

// function to connect and execute the query
function filterTable($query)
{
    $connect = mysqli_connect("localhost", "dbusername", "yourpassword", "dbname");
    $filter_Result = mysqli_query($connect, $query);
    return $filter_Result;
}

?>

<!DOCTYPE html>
<html>
    <head>
        <title>PHP HTML TABLE DATA SEARCH</title>
        <style>
            table,tr,th,td
            {
                border: 1px solid black;
            }
        </style>
    </head>
    <body>
     
        <form action="1d.php" method="post">
            <input type="text" name="valueToSearch" placeholder="Value To Search"><br><br>
            <input type="submit" name="search" value="Filter"><br><br>
         
            <table>
                <tr>
                    <th>Id</th>
                    <th>Name</th>
                    <th>Username</th>
                    <th>Password</th>
                </tr>

      <!-- populate table from mysql database -->
                <?php while($row = mysqli_fetch_array($search_result)):?>
                <tr>
                    <td><?php echo $row['pk_i_id'];?></td>
                    <td><?php echo $row['s_name'];?></td>
                    <td><?php echo $row['s_username'];?></td>
                    <td><?php echo $row['s_password'];?></td>
                </tr>
                <?php endwhile;?>
            </table>
        </form>
     
    </body>
</html>

Monday, 29 October 2018

Full Marquee Code Details

In the this page you can find almost details about marquee
id="scorll_news if you want stop marquee on mouse over
style = text style
color = text color
bgcolor = background color
width = marquee width
height = marquee height
direction = marquee sliding
( up for down to up
down for up to down
left for right to left
right for  right to left )
scrolldelay = marquee scroll speed
loop = how many time content slide in marquee.

------------ Code Start ---------
<marquee id='scroll_news' width="300px" height="100%"  direction="down"scrolldelay="500" loop="3" style="font-family:Book Antiqua; color: #FFFFFF" bgcolor="#000080"><div onMouseOver="document.getElementById('scroll_news').stop();" onMouseOut="document.getElementById('scroll_news').start();">
Your Contect Here
</div></marquee>
------------Code End ---------------

Thursday, 25 October 2018

How to refresh a page after random times?

If you want refresh your web page randomly timer then just copy this code and paste your web page.
This script automatic refresh your web page between 30 to 60 seconds.
This script very helpful if you provided CPM banner ads on your web page.

Coding Start


<head>

<script>

function reloadMe() {

window.location.reload();

}

function getInterval(){

var lowerBound = 10;

var upperBound = 15;


var randNum = Math.floor((upperBound-lowerBound+1)*Math.random()+lowerBound) * 1000;

return randNum;

}

var interval = getInterval();

var srcInterval = setInterval("reloadMe()",interval);

</script>

</head>

<body> <script type="text/javascript">document.write ("This page will reload after "+interval/1000+" seconds");</script>
Your content here </body>

Script End

Monday, 8 October 2018

Open Popup on Leaving Page

Are you want open a popup on leaving page. You can use given script for leaving page pop up.
You need create three pages.

1.) ouibounce.js

<!-------------- coding start ------------->

(function(root, factory) {
  if (typeof define === 'function' && define.amd) {
    define(factory);
  } else if (typeof exports === 'object') {
    module.exports = factory(require,exports,module);
  } else {
    root.ouibounce = factory();
  }
}(this, function(require,exports,module) {

return function ouibounce(el, config) {
  var config     = config || {},
    aggressive   = config.aggressive || false,
    sensitivity  = setDefault(config.sensitivity, 20),
    timer        = setDefault(config.timer, 1000),
    callback     = config.callback || function() {},
    cookieExpire = setDefaultCookieExpire(config.cookieExpire) || '',
    cookieDomain = config.cookieDomain ? ';domain=' + config.cookieDomain : '',
    sitewide     = config.sitewide === true ? ';path=/' : '',
    _html        = document.getElementsByTagName('html')[0];

  function setDefault(_property, _default) {
    return typeof _property === 'undefined' ? _default : _property;
  }

  function setDefaultCookieExpire(days) {
    // transform days to milliseconds
    var ms = days*24*60*60*1000;

    var date = new Date();
    date.setTime(date.getTime() + ms);

    return "; expires=" + date.toGMTString();
  }

  setTimeout(attachOuiBounce, timer);
  function attachOuiBounce() {
    _html.addEventListener('mouseleave', handleMouseleave);
    _html.addEventListener('keydown', handleKeydown);
  }

  function handleMouseleave(e) {
    if (e.clientY > sensitivity || (checkCookieValue('viewedOuibounceModal', 'true') && !aggressive)) return;
    fire();
    callback();
  }

  var disableKeydown = false;
  function handleKeydown(e) {
    if (disableKeydown || checkCookieValue('viewedOuibounceModal', 'true') && !aggressive) return;
    else if(!e.metaKey || e.keyCode != 76) return;

    disableKeydown = true;
    fire();
    callback();
  }

  function checkCookieValue(cookieName, value) {
    // cookies are separated by '; '
    var cookies = document.cookie.split('; ').reduce(function(prev, curr) {
      // split by '=' to get key, value pairs
      var el = curr.split('=');

      // add the cookie to fn object
      prev[el[0]] = el[1];

      return prev;
    }, {});

    return cookies[cookieName] === value;
  }

  function fire() {
    // You can use ouibounce without passing an element
    // https://github.com/carlsednaoui/ouibounce/issues/30
    if (el) el.style.display = 'block';
    disable();
  }

  function disable(options) {
    var options = options || {};

    // you can pass a specific cookie expiration when using the OuiBounce API
    // ex: _ouiBounce.disable({ cookieExpire: 5 });
    if (typeof options.cookieExpire !== 'undefined') {
      cookieExpire = setDefaultCookieExpire(options.cookieExpire);
    }

    // you can pass use sitewide cookies too
    // ex: _ouiBounce.disable({ cookieExpire: 5, sitewide: true });
    if (options.sitewide === true) {
      sitewide = ';path=/';
    }

    // you can pass a domain string when the cookie should be read subdomain-wise
    // ex: _ouiBounce.disable({ cookieDomain: '.example.com' });
    if (typeof options.cookieDomain !== 'undefined') {
      cookieDomain = ';domain=' + options.cookieDomain;
    }

    document.cookie = 'viewedOuibounceModal=true' + cookieExpire + cookieDomain + sitewide;

    // remove listeners
    _html.removeEventListener('mouseleave', handleMouseleave);
    _html.removeEventListener('keydown', handleKeydown);
  }

  return {
    fire: fire,
    disable: disable
  };
}
;

}));


<!-------------- coding end ------------->

2.) ouibounce.min.css


<!-------------- coding start ------------->

#ouibounce-modal{font-family:'Open Sans',sans-serif;display:none;position:fixed;top:0;left:0;width:100%;height:100%}#ouibounce-modal .underlay{width:100%;height:100%;position:absolute;top:0;left:0;background-color:rgba(0,0,0,.5);cursor:pointer;-webkit-animation:fadein .5s;animation:fadein .5s}#ouibounce-modal .modal{width:600px;height:450px;background-color:#f0f1f2;z-index:1;position:absolute;margin:auto;top:0;right:0;bottom:0;left:0;border-radius:4px;-webkit-animation:popin .3s;animation:popin .3s}#ouibounce-modal .modal-title{font-size:18px;background-color:#252525;color:#fff;padding:10px;margin:0;border-radius:4px 4px 0 0;text-align:center}#ouibounce-modal h3{color:#fff;font-size:1em;margin:.2em;text-transform:uppercase;font-weight:500}#ouibounce-modal .modal-body{padding:20px 35px;font-size:.9em}#ouibounce-modal p{color:#344a5f}#ouibounce-modal form{text-align:center;margin-top:35px}#ouibounce-modal form input[type=text]{padding:12px;font-size:1.2em;width:300px;border-radius:4px;border:1px solid #ccc;-webkit-font-smoothing:antialiased}#ouibounce-modal form input[type=submit]{text-transform:uppercase;font-weight:700;padding:12px;font-size:1.1em;border-radius:4px;color:#fff;background-color:#4ab471;border:none;cursor:pointer;-webkit-font-smoothing:antialiased}#ouibounce-modal form p{text-align:left;margin-left:35px;opacity:.8;margin-top:1px;padding-top:1px;font-size:.9em}#ouibounce-modal .modal-footer{position:absolute;bottom:20px;text-align:center;width:100%}#ouibounce-modal .modal-footer p{text-transform:capitalize;cursor:pointer;display:inline;border-bottom:1px solid #344a5f}@-webkit-keyframes fadein{0%{opacity:0}100%{opacity:1}}@-ms-keyframes fadein{0%{opacity:0}100%{opacity:1}}@keyframes fadein{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes popin{0%{-webkit-transform:scale(0);transform:scale(0);opacity:0}85%{-webkit-transform:scale(1.05);transform:scale(1.05);opacity:1}100%{-webkit-transform:scale(1);transform:scale(1);opacity:1}}@-ms-keyframes popin{0%{-ms-transform:scale(0);transform:scale(0);opacity:0}85%{-ms-transform:scale(1.05);transform:scale(1.05);opacity:1}100%{-ms-transform:scale(1);transform:scale(1);opacity:1}}@keyframes popin{0%{-webkit-transform:scale(0);-ms-transform:scale(0);transform:scale(0);opacity:0}85%{-webkit-transform:scale(1.05);-ms-transform:scale(1.05);transform:scale(1.05);opacity:1}100%{-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1);opacity:1}}


<!-------------- coding end ------------->

3.) index.php


<!-------------- coding start ------------->
<html>
<head><script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="ouibounce.js"></script>
<link rel="stylesheet" href="ouibounce.min.css">
</head>
<body>
<!-- OuiBounce Modal popup start-->
<div id="ouibounce-modal">
<div class="underlay"></div>
<div class="modal">
<div class="modal-title">
<h3>Offer for You!</h3>
</div>
<div class="modal-body"><iframe  src="https://adslinks.in/popup/index.php" frameborder="0" scrolling="auto" width="100%" height="350px" marginwidth="0" marginheight="0" ></iframe>
<p> <a href="#" onclick="close_window();return false;">-</a></p>

</div>
<div class="modal-footer">
<p>no thanks</p>
</div>
</div>
</div>

<!-- Example page JS        -->
<!-- Used to fire the modal -->
<script>

      // if you want to use the 'fire' or 'disable' fn,
      // you need to save OuiBounce to an object
      var _ouibounce = ouibounce(document.getElementById('ouibounce-modal'), {
        aggressive: true,
        timer: 0,
        callback: function() { console.log('ouibounce fired!'); }
      });

      $('body').on('click', function() {
        $('#ouibounce-modal').hide();
      });

      $('#ouibounce-modal .modal-footer').on('click', function() {
        $('#ouibounce-modal').hide();
      });

      $('#ouibounce-modal .modal').on('click', function(e) {
        e.stopPropagation();
      });
    </script>
   
<!-------------- coding end -------------></body>
</html>

Saturday, 22 September 2018

Redirect to a landing page after adding a new listing in Osclass

This code tested on Osclass 3.7.4
If you want to redirect to a static page after adding a new listing. You can get that result using the posted_item hook. Example:
    function redirect_to_landing($item) {
        osc_get_static_page('example_page');
        header('Location: ' . osc_static_page_url()); exit;
    }
    osc_add_hook('posted_item', 'redirect_to_landing');
    // add this code in the functions.php of your theme
The code from above would redirect to a static page that has example_page ( This is internal page name ) as a slug. So, remember that you will have to create first that static page.

If you want to redirect to a specific theme page after adding a new listing. You can get that result using the posted_item hook. Example:
The next example will redirect to the listing page:
    function redirect_to_landing($item) {
        View::newInstance()->_exportVariableToView('item', $item);
        header('Location: ' . osc_item_url()); exit;
    }
    osc_add_hook('posted_item', 'redirect_to_landing');
    // add this code in the functions.php of your theme
The hook posted_item it’s available since the version 2.0.

Saturday, 1 September 2018

Boxbilling Licence.php

Go to /bb-library/Box/License.php and edit

<?php
/**
 * BoxBilling
 *
 * @copyright BoxBilling, Inc (http://www.boxbilling.com)
 * @license   Apache-2.0
 *
 * Copyright BoxBilling, Inc
 * This source file is subject to the Apache-2.0 License that is bundled
 * with this source code in the file LICENSE
 */


class Box_License implements \Box\InjectionAwareInterface
{
    protected $di;

    public function setDi($di)
    {
        $this->di = $di;
    }

    public function getDi()
    {
        return $this->di;
    }

    /**
     * @return string
     */
    public function getKey()
    {
        return true;
    }

    public function check()
    {
        return ture;
    }

    public function isValid()
    {
        return true;
    }

    public function isPro()
    {
        return true;
    }

    private function getBBType()
    {
        return true;
    }

    public function getDetails($from_server = false)
    {
        return $data;
    }

    public function _getLicenseDetailsFromServer(array $servers)
    {
        $params = array();
        $params['license']  = $this->di['config']['license'];
        $params['host']     = BB_URL;
        $params['path']     = BB_PATH_ROOT;
        $params['version']  = \Box_Version::VERSION;
        $params['os']       = PHP_OS;
        $params['format']   = 2;

        return array();
    }

    private function _tryLicensingServer($url, $params)
    {
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_VERBOSE, 0);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 20);
        curl_setopt($ch, CURLOPT_TIMEOUT, 20);
        curl_setopt($ch, CURLOPT_POST, true);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
        $result = curl_exec($ch);

        curl_close($ch);
        return $result;
    }
}

Thursday, 30 August 2018

install EHCP control panel on UBUNTU server

For EHCP installation you need :
Ubuntu Server 14.x

Login your server using PUTTY

Start coding :

 lsb_release -a ; getconf LONG_BIT ; hostname -I ; hostname

 apt update -y ; apt upgrade build-essential dpkg-dev net-tools git nano gedit cmake curl wget dpkg-dev gdebi aptitude -y

 reboot

wget http://ehcp.net/ehcp_yeni.tgz

tar -zxvf ehcp_yeni.tgz

cd ehcp

./install.sh

Follow the step as per show display
putty ask some question like :
Your Name
Your Email Address
admin password

Main website for EHCP script visit http://www.ehcp.net/?q=node/153

Monday, 27 August 2018

Install Vistacp Control Panel on Ubuntu server

For VISTACP  Control Panel Installation :
Step 1 – Login to your Ubuntu server as root
Step 2 – Install Vesta CP using command below:
curl -O http://vestacp.com/pub/vst-install.sh
bash vst-install.sh --force --nginx yes --apache yes --phpfpm no --named yes --remi yes --vsftpd yes --proftpd no --iptables yes --fail2ban yes --quota yes --exim yes --dovecot yes --spamassassin yes --clamav yes --softaculous yes --mysql yes --postgresql yes --hostname vesta.sakhihoting.in --email youremailaddress --password yourpasswordhere

Now system ask your email address then ask your hostname 
then press y 
now installation running please wait 15 - 20 minute for installtion complatetion .
After complate installation on your putty display your user name and password for control panel.
visit https://your server ip:8083
and login.

Change default port

set port 2083 in firewell on your vps provider console 

Action: Accept
Protocol: TCP
Port: 2083
IP Address: 0.0.0.0/0
cd /usr/local/vesta/nginx/conf/
nano nginx.conf
Change
listen          8083;
To
listen          2083;
save file 
service vesta restart






FILEMANAGER
login with root
nano /usr/local/vesta/conf/vesta.conf
add FILEMANAGER_KEY='ILOVEREO'
save and exit
set cronjob
crontab -e

0 */1 * * * /usr/bin/sed -i "/FILEMANAGER_KEY=''/d" /usr/local/vesta/conf/vesta.conf >> /usr/local/vesta/conf/vesta.conf && sudo /usr/bin/grep -q -F "FILEMANAGER_KEY='ILOVEREO'" /usr/local/vesta/conf/vesta.conf || /usr/bin/echo "FILEMANAGER_KEY='ILOVEREO'" >> /usr/local/vesta/conf/vesta.conf
save and exit
You also login in http://your server ip/phpmyadmin

If you're tired of the message "The phpMyAdmin configuration storage is not completely configured, some extended features have been deactivated", this patch for you ;-)

run this command as root on your ubuntu server

curl -O -k https://raw.githubusercontent.com/skurudo/phpmyadmin-fixer/master/pma-ubuntu.sh && chmod +x pma-ubuntu.sh && ./pma-ubuntu.sh

OR

sudo wget --no-check-certificate https://raw.githubusercontent.com/skurudo/phpmyadmin-fixer/master/pma-ubuntu.sh && sudo chmod +x pma-ubuntu.sh &&
sudo ./pma-ubuntu.sh



Edit Template
nano /usr/local/vesta/data/templates/web/skel/public_html/index.html



IF YOU WANT UNINSTALL

apt-get remove vesta*
rm -f /etc/apt/sources.list.d/vesta.list

3. Delete data directory and cron
rm -rf /usr/local/vesta