Advertisement
Guest User

solus

a guest
Sep 24th, 2015
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.29 KB | None | 0 0
  1. <?php
  2. /**
  3.  * Created by PhpStorm.
  4.  * User: Bharat
  5.  * Date: 9/24/2015
  6.  * Time: 10:14 AM
  7.  */
  8.  
  9. $scode = ""; //Your secret key or whatever
  10. $email = (isset($_GET['email']) && (filter_var($_GET['email'], FILTER_VALIDATE_EMAIL))) ? $_GET['email'] : '';
  11. function isSecure(){
  12.     global $scode;
  13.     return ( isset($_GET['scode']) && $_GET['scode'] == $scode ) ? true : false;
  14. }
  15.  
  16. if(!empty($email) && isSecure()){
  17.     $dn = exec("grep -m1 $1: /usr/local/solusvm/includes/solusvm.conf | cut -d ':' -f 1");
  18.     $du = exec("grep -m1 $1: /usr/local/solusvm/includes/solusvm.conf | cut -d ':' -f 2");
  19.     $dp = exec("grep -m1 $1: /usr/local/solusvm/includes/solusvm.conf | cut -d ':' -f 3");
  20.     $dh = exec("grep -m1 $1: /usr/local/solusvm/includes/solusvm.conf | cut -d ':' -f 4");
  21.     $ec = exec("grep -m1 $1: /usr/local/solusvm/includes/solusvm.conf | cut -d ':' -f 5");
  22.  
  23.     $dsn = sprintf ( 'mysql:host=%s;dbname=%s' , $dh, $dn ) ;
  24.     $pdo = new PDO($dsn,$du,$dp);
  25.     $pdo->setAttribute ( PDO::ATTR_TIMEOUT , 1 ) ;
  26.     $pdo->setAttribute ( PDO::ATTR_PERSISTENT , false ) ;
  27.     $pdo->setAttribute ( PDO::MYSQL_ATTR_INIT_COMMAND , 'SET NAMES utf8' ) ;
  28.     $pdo->setAttribute ( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION );
  29.     $pdo->setAttribute ( PDO::ATTR_EMULATE_PREPARES, false );
  30.     $query = $pdo->prepare("SELECT `clientid` FROM `clients` WHERE `emailaddress` = :email");
  31.     $query->bindParam(':email',$email,PDO::PARAM_STR);
  32.     $query->execute();
  33.     $resullt = $query->fetch(PDO::FETCH_OBJ);
  34.     $clientid = $result->clientid;
  35.     echo "clientID: {$clientid}";
  36.     $query = $pdo->prepare("SELECT `vserverid` FROM `vservers` WHERE `clientid` = :clientid");
  37.     $query->bindParam(':clientid',$clientid,PDO::PARAM_STR);
  38.     $query->execute();
  39.     $result = $query->fetchAll(PDO::FETCH_OBJ);
  40.     foreach($result as $vps){
  41.         $vserverid = $vps->vserverid;
  42.         printf("vserverID: {$vserverid} > \r\n");
  43.         $query = $db->prepare("SELECT `ipaddress` FROM `ipaddresses` WHERE `vserverid` = :vid");
  44.         $query->bindParam(":vid",$vserverid,PDO::PARAM_STR);
  45.         $query->execute();
  46.         $result = $query->fetchAll(PDO::FETCH_OBJ);
  47.         foreach($result as $ip) {
  48.             $ip->ipaddress . " ,\r\n";
  49.         }
  50.     }
  51. } else {
  52.     throw new Exception("Invalid / No Email entered!");
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement