Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * Created by PhpStorm.
- * User: Bharat
- * Date: 9/24/2015
- * Time: 10:14 AM
- */
- $scode = ""; //Your secret key or whatever
- $email = (isset($_GET['email']) && (filter_var($_GET['email'], FILTER_VALIDATE_EMAIL))) ? $_GET['email'] : '';
- function isSecure(){
- global $scode;
- return ( isset($_GET['scode']) && $_GET['scode'] == $scode ) ? true : false;
- }
- if(!empty($email) && isSecure()){
- $dn = exec("grep -m1 $1: /usr/local/solusvm/includes/solusvm.conf | cut -d ':' -f 1");
- $du = exec("grep -m1 $1: /usr/local/solusvm/includes/solusvm.conf | cut -d ':' -f 2");
- $dp = exec("grep -m1 $1: /usr/local/solusvm/includes/solusvm.conf | cut -d ':' -f 3");
- $dh = exec("grep -m1 $1: /usr/local/solusvm/includes/solusvm.conf | cut -d ':' -f 4");
- $ec = exec("grep -m1 $1: /usr/local/solusvm/includes/solusvm.conf | cut -d ':' -f 5");
- $dsn = sprintf ( 'mysql:host=%s;dbname=%s' , $dh, $dn ) ;
- $pdo = new PDO($dsn,$du,$dp);
- $pdo->setAttribute ( PDO::ATTR_TIMEOUT , 1 ) ;
- $pdo->setAttribute ( PDO::ATTR_PERSISTENT , false ) ;
- $pdo->setAttribute ( PDO::MYSQL_ATTR_INIT_COMMAND , 'SET NAMES utf8' ) ;
- $pdo->setAttribute ( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION );
- $pdo->setAttribute ( PDO::ATTR_EMULATE_PREPARES, false );
- $query = $pdo->prepare("SELECT `clientid` FROM `clients` WHERE `emailaddress` = :email");
- $query->bindParam(':email',$email,PDO::PARAM_STR);
- $query->execute();
- $resullt = $query->fetch(PDO::FETCH_OBJ);
- $clientid = $result->clientid;
- echo "clientID: {$clientid}";
- $query = $pdo->prepare("SELECT `vserverid` FROM `vservers` WHERE `clientid` = :clientid");
- $query->bindParam(':clientid',$clientid,PDO::PARAM_STR);
- $query->execute();
- $result = $query->fetchAll(PDO::FETCH_OBJ);
- foreach($result as $vps){
- $vserverid = $vps->vserverid;
- printf("vserverID: {$vserverid} > \r\n");
- $query = $db->prepare("SELECT `ipaddress` FROM `ipaddresses` WHERE `vserverid` = :vid");
- $query->bindParam(":vid",$vserverid,PDO::PARAM_STR);
- $query->execute();
- $result = $query->fetchAll(PDO::FETCH_OBJ);
- foreach($result as $ip) {
- $ip->ipaddress . " ,\r\n";
- }
- }
- } else {
- throw new Exception("Invalid / No Email entered!");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement