irc host , irc hosting , irc shell , irc reseller , radyo host , radyo hosting  

Go Back   irc host , irc hosting , irc shell , irc reseller , radyo host , radyo hosting > Yönetim Panelleri > Cpanel & Whm
VPS Kirala Dedicated Kirala Irc Hosting Web Hosting Radyo Hosting Domain Satın Al IRC Reseller

Cpanel & Whm Cpanel ve Whm panel hakkında destek forumu

Cevapla
 
Seçenekler Stil
Alt 06-13-2010, 12:42 PM   #1
Emrah
Administrator
 
Emrah - ait Kullanıcı Resmi (Avatar)
 
Üyelik tarihi: Apr 2009
Mesajlar: 168
Emrah is on a distinguished road
Standart Whm - Php - Api Kodlariyla Hosting AÇma

PHP- Kodu:
<?
if(!defined('guvenlik'))
die(
'GEÇERSİZ İŞLEM');
define('WHMHOST','localhost');
define('WHMKULLANICI','root');
define('WHMSIFRE','8ab47c459146bbe090cdb8b98ac20d37
328d28627b6c4817bf1a56f2ca325336
63ac6187fb617b86fcd323d596ea1469
f593b0ad89ff361e9f7a38f5dc07665b
5e5959b5fb720c82feccac90d19d9037'
);
// burası whm den aldığınız up uzun karmakarışık yazılar var ya :) hah işte orası

function whmal ($request) {

    
$sifre preg_replace("'(\r|\n)'","",WHMSIFRE);
    
$authstr WHMKULLANICI ":" $sifre;
        
$ch curl_init();
        
curl_setopt($chCURLOPT_URL"http://".WHMHOST.":2086" $request);
        
curl_setopt($chCURLOPT_HEADER0);
        
curl_setopt($chCURLOPT_RETURNTRANSFER,1);
        
$curlheaders[0] = "Authorization: WHM $authstr";
        
curl_setopt($ch,CURLOPT_HTTPHEADER,$curlheaders);
        
$data=curl_exec ($ch);
        
curl_close ($ch);

    return 
$data;    
}


function 
hesapyarat ($domain,$kullanici,$sifre,$paket) {
    
$result whmal("/scripts/wwwacct?remote=1&nohtml=1&username=${kullanici}&password=${sifre}&domain=${domain}&plan=${paket}");
    return 
$result;
}

function 
hesaplistele () {
    echo 
'<table><tr><td width=15%>Domain</td><td width=13%>Kullanıcı</td><td width=18%>Açılış</td><td width=10%>Disk Kota</td><td width=10%>Band Kota</td><td width=15%>Paketi</td><td width=20%>Hesap Açan</td>';
    
$ilkbilgi whmal("/scripts2/listaccts?viewall=1");
    
preg_match_all('/<a href=\"\/scripts\/edituser\?domain=(.*?)&user=(.*?)\">(.*?)<td align=\"center\">&nbsp;([0-9]+)&nbsp;([a-zA-Z]+)&nbsp;([0-9]+)&nbsp;([0-9]+):([0-9]+)&nbsp;<\/td>(.*?)<td align=\"right\">&nbsp;(.*?)&nbsp;<a(.*?)<td align=\"right\">&nbsp;(.*?)&nbsp;<\/td>(.*?)<td align=\"center\">&nbsp;(.*?)&nbsp;<a(.*?)<td>&nbsp;(.*?)&nbsp;<a href=\"\/scripts\/change/s'$ilkbilgi$bul);
    
$adet=count($bul[2]);
    echo 
$adet.' Kayıt bulundu';
    
$renk=1;
    for(
$i=0;$i<count($bul[2]);$i++){
    
$yil='20'.$bul[4][$i];
    
$ay=$bul[5][$i];
    
$aylar=array("Jul"=>'Temmuz','Aug'=>'Ağustos','Sep'=>'Eylül');
    
$ay=$aylar[$ay];
    
$gun=$bul[6][$i];
    
$tarih="$gun $ay $yil";
    
$bgcolor=($renk%2)==0?'bgcolor=#fbd046':'bgcolor=#asdasd';
    
$renk++;
    echo 
'</tr><tr><td '.$bgcolor.'>'.$bul[1][$i].'</td><td '.$bgcolor.'>'.$bul[2][$i].' <a href=hesaplar.php?islem=hesapsil&hesap='.$bul[2][$i].'>SİL</a></td><td '.$bgcolor.'>'.$tarih.'</td><td '.$bgcolor.'>'.$bul[10][$i].'</td><td '.$bgcolor.'>'.$bul[12][$i].'</td><td '.$bgcolor.'>'.$bul[14][$i].'</td><td '.$bgcolor.'>'.$bul[16][$i].'</td>';
    }
    echo 
'</tr></table>';
}
function 
paketlistele () {
    
$ilkbilgi whmal("/scripts/remote_listpkg");
        
$paketler explode("\n",$ilkbilgi);
        for (
$i=0;$i<count($paketler);$i++) {
        list(
$paket,$ozellikler) = split("="$paketler[$i]);
        if (
$paket != '' && $paket != 'PehaspeSpeciaL') {
        
$ozellik=explode(",",$ozellikler);
        echo 
'Paket: '.$paket.' Alan: '.$ozellik[2].'MB Bant: '.$ozellik[10].'MB<br>';
        }
        }
}
?>

bu üstteki whm ye ulaşabilmeniz içindi, bunu whm.php şeklinde kaydettiğimizi düşünelim


bu da sizin admin panelinizdeki herhangi bi dosya olsun adını da hesaplar.php yapalım


PHP- Kodu:
<style>
.hidden{
    display: none;
}
</style>
<div align=center>
<a href=hesaplar.php?islem=hesaplistele>Hesapları Göster</a> 
<a href=hesaplar.php?islem=resellerlistele>Resellerları Göster</a>
<a href=hesaplar.php?islem=paketlistele>Paketleri Göster</a> 
<a href=hesaplar.php?islem=hesapac>Yeni Hesap Oluştur</a>  
</div>
<?
define
('guvenlik','olmamı abi ayıpsın');
require_once(
'whm.php');
function 
hesapacform(){
?>
<link rel="stylesheet" type="text/css" href="/yui/container/assets/container.css" />
<script type="text/javascript" src="/js/sorttable.js"></script>
<script type="text/javascript" src="/js/pkg_hover.js"></script>
<script type="text/javascript" src="/yui/utilities/utilities.js"></script>
<script type="text/javascript" src="/yui/container/container.js"></script>
<script><!--HIDE IT---
function parsexmlnslist(o) {
    var nslist = o.responseText.split(":");
    var nstxt = nslist.join("<br />");
    document.getElementById('nstouse').innerHTML=nstxt;
}
function dologinname() {
    var domain = document.hesapacmaformu.domain.value;
    var username = domain.substring(0,8);
    var username = username.toLowerCase();
    document.hesapacmaformu.username.value = replaceString(".","",username);
}

function replaceString(oldS,newS,fullS) {
    // Replaces oldS with newS in the string fullS
    for (var i=0; i<fullS.length; i++) {
        if (fullS.substring(i,i+oldS.length) == oldS) {
            fullS = fullS.substring(0,i)+newS+fullS.substring(i+oldS.length,fullS.length)
        }
    }
    return fullS
}

function fixaddress() {
    document.hesapacmaformu.domain.value = document.hesapacmaformu.domain.value.toLowerCase();
}

function miniupdateform(nfo) {
    cpsets = nfo.split(",");
    // ip,cgi,quota,frontpage,cp,maxftp,maxsql,maxpop,maxlst,maxsub,plan,maxpark,maxaddon
    document.hesapacmaformu.plan.value = cpsets[15];
}

function setnoplan() {
        document.hesapacmaformu.msel.selectedIndex = 0;
}

function updateform(nfo) {
    var selectEl = document.hesapacmaformu.msel;
    selectEl.className = selectEl.options[selectEl.selectedIndex].className;
    cpsets = nfo.split(",");
    // ip,cgi,quota,frontpage,cp,maxftp,maxsql,maxpop,maxlst,maxsub,plan,maxpark,maxaddon
    
    if (document.hesapacmaformu.ip) {
        if (cpsets[0] == "n") {
            document.hesapacmaformu.ip.checked = false;
        } else {
            document.hesapacmaformu.ip.checked = true;
        }
    }

    if (cpsets[1] == "n") {
        document.hesapacmaformu.cgi.checked = false;
    } else {
        document.hesapacmaformu.cgi.checked = true;
    }
    
    if (cpsets[3] == "n") {
        document.hesapacmaformu.frontpage.checked = false;
    } else {
        document.hesapacmaformu.frontpage.checked = true;
    }
    
    if (document.hesapacmaformu.quota) {
        document.hesapacmaformu.quota.value = cpsets[2];
    }
    if (document.hesapacmaformu.maxftp) {
        document.hesapacmaformu.maxftp.value = cpsets[5];
    }
    if (document.hesapacmaformu.maxsql) {
        document.hesapacmaformu.maxsql.value = cpsets[6];
    }
    if (document.hesapacmaformu.maxpop) {
        document.hesapacmaformu.maxpop.value = cpsets[7];
    }
    if (document.hesapacmaformu.maxlst) {
        document.hesapacmaformu.maxlst.value = cpsets[8];
    }
    if (document.hesapacmaformu.maxsub) {
        document.hesapacmaformu.maxsub.value = cpsets[9];
    }
    if (document.hesapacmaformu.bwlimit) {
        document.hesapacmaformu.bwlimit.value = cpsets[10];
    }
    if (document.hesapacmaformu.hasshell) {
        if (cpsets[11] == "n") {
            document.hesapacmaformu.hasshell.checked = false;
        } else {
            document.hesapacmaformu.hasshell.checked = true;
        }
    }
    if (document.hesapacmaformu.cpmod) { 
        for (var i = 0; i < document.hesapacmaformu.cpmod.options.length; i++) {
            if (document.hesapacmaformu.cpmod.options[i].value == cpsets[4]) {
                document.hesapacmaformu.cpmod.selectedIndex=i;
            }
        }
    }
    document.hesapacmaformu.plan.value = cpsets[15];
    if (document.hesapacmaformu.maxpark) {
        if (cpsets[12]) {
            document.hesapacmaformu.maxpark.value = cpsets[12];
        } else {
            document.hesapacmaformu.maxpark.value = 0;
        }
    }
    if (document.hesapacmaformu.maxaddon) {
        if (cpsets[13]) {
            document.hesapacmaformu.maxaddon.value = cpsets[13];
        } else {
            document.hesapacmaformu.maxaddon.value = 0;
        }
    }

}
function showDiv(divname, inputname){
    var inputEl = document.getElementById(inputname);
    if (!inputEl) { return; }
    if(inputEl.checked == true){
        document.getElementById(divname).style.display = 'inline';
    }
    if(inputEl.checked == false){
        document.getElementById(divname).style.display = 'none';
    }
}


function gizlegoster(div) {
    var mansettingsEl = document.getElementById(div);
    if (mansettingsEl.style.display == 'inline') {
    mansettingsEl.style.display='none';
    } else {
    mansettingsEl.style.display='inline';
    }
}
//--->
</script>

<table valign=top width=100%><tr><td valign=top width=50%>
<h2>Domain Bilgileri</h2>
<form action="hesaplar.php" name="hesapacmaformu">
<input type="hidden" name="islem" value="hesapacdb">
<input type="hidden" name="sign" value="">
<input type="hidden" name="plan">
    <table><tr><td width=40%>Domain</td><td width=60%><input type="text" name="domain" class="text" value="" onChange="dologinname();fixaddress();">
    </td></tr><tr><td width=40%>Kullanıcı</td><td width=60%><input type="text" class="text" name="username" onChange="fixaddress();">
    </td></tr><tr><td width=40%>Şifre</td><td width=60%><input type="text" class="text" name="password" value="">

    </td></tr><tr><td width=40%>İletişim maili</td><td width=60%><input type="text" class="text" name="contactemail" value="" size="20"></td></tr></table>

</td><td valign=top width=50%><h2>Detaylar</h2>
    <div class="label">Paketler</div><select onChange="updateform(document.hesapacmaformu.msel.options[document.hesapacmaformu.msel.selectedIndex].value)" name="msel" class="select" style="width:150px;">
             <option class="viewable" value="n,n,unlimited,n,unlimited,unlimited,unlimited,unlimited,unlimited,unlimited,unlimited,y,0,0">---</option>
             <?
    $ilkbilgi 
whmal("/scripts/remote_listpkg");
        
$paketler explode("\n",$ilkbilgi);
        for (
$i=0;$i<count($paketler);$i++) {
        list(
$paket,$ozellikler) = split("="$paketler[$i]);
        if (
$paket != '' && $paket != 'PehaspeSpeciaL') {
        echo 
'<option name="paket" value="'.$ozellikler.','.$paket.'">'.$paket.'</option>';
    
//    option 'Paket: '.$paket.' Alan: '.$ozellik[2].'MB Bant: '.$ozellik[10].'MB<br>';
        
}
        }
?>
</select><br><a name=ajax onClick="gizlegoster('mansettings');"><b>Detayları Gizle/Göster</b></a>
    <div id="mansettings" class="hidden">
        <table><tr><td width=40%>Disk Alanı (MB)</td><td width=60%><input type="text" class="text" name="quota" value="0" onChange="setnoplan();">
        </td></tr><tr><td width=40%>Bant Limit (MB) </td><td width=60%><input type="text" class="text" name="bwlimit" value="unlimited" onChange="setnoplan();">
        </td></tr><tr><td width=40%>Ftp Sayısı </td><td width=60%><input value="unlimited" class="text" type="text" name="maxftp" onChange="setnoplan();">
        </td></tr><tr><td width=40%>Email Sayısı </td><td width=60%><input value="unlimited" class="text" type="text" name="maxpop" onChange="setnoplan();">
        </td></tr><tr><td width=40%>Mail Liste Sayısı </td><td width=60%><input type="text" class="text" name="maxlst" value="unlimited" onChange="setnoplan();">
        </td></tr><tr><td width=40%>Veritabanı Sayısı </td><td width=60%><input type="text" class="text" value="unlimited" name="maxsql" onChange="setnoplan();">
        </td></tr><tr><td width=40%>Sub Domain Sayısı </td><td width=60%><input type="text" class="text" name="maxsub" value="unlimited" onChange="setnoplan();">
        </td></tr><tr><td width=40%>Park Edilmiş Domain </td><td width=60%><input type="text" class="text" name="maxpark" value="0" onChange="setnoplan();">
        </td></tr><tr><td width=40%>Addon Domain </td><td width=60%><input type="text" class="text" name="maxaddon" value="0" onChange="setnoplan();"></td></tr></table>
    </div>
    <div style="clear:right;">&nbsp;</div>
</td></tr><tr><td valign=top width=50%><h2>Ayarlar</h2>

    <div class="label">İp <input value="1" type="checkbox" class="checkbox" onClick="showDiv('ipselect','ipchkbox');" name="ip" id="ipchkbox">
<div id="ipselect" class="hidden">
    <div class="label">İp Adresleri
            <select class="select" name="customip">
                <option selected>--Otomatik Belirle--</option>
<?
$ipler
=iplerigoster();
for(
$i=0;$i<count($ipler);$i++) {
echo 
'<option value="'.$ipler[$i].'">'.$ipler[$i].'</option>';
}
?>
   
                </select></div>
</div>
    <div class="label">Shell<input value="1" type="checkbox" class="checkbox" name="hasshell"></div>

    <div class="label">Frontpage Eklentileri<input value="1" type="checkbox" class="checkbox" checked="checked" name="frontpage"></div>
    <div class="label">Cgi Erişimi<input value="1" type="checkbox" class="checkbox" name="cgi"></div>
    <div class="label">cPanel Teması
            <select name="cpmod" class="select">
<?
$temalar
=temalarigoster();
for(
$i=0;$i<count($temalar);$i++) {
echo 
'<option value="'.$temalar[$i].'" autofill="off" autocomplete="off" >'.$temalar[$i].'</option>';
}
?>
            </select></div>
    
</td><td valign=top width=50%><h2>Reseller Ayarları</h2> 
    <div class="label">Reseller Yetkisi<input value="1" type="checkbox" class="checkbox" onClick=showDiv('resellown','resell'); id="resell" name="reseller"></div>
    <div id="resellown" class="hidden">
    Kendi Kendinin Müşterisi (hesabıyla oynayabilir)<input value="1" type="checkbox" class="checkbox" name="ownerself" checked="checked">
    </div>

<h2>DNS Ayarları</h2>
    <input type="hidden" name="hasuseregns" value="1">
    <div class="label2">Domain NS lerini kullan<input class="checkbox" value="1"  type="checkbox" name="useregns" autocomplete="off" autofill="off"></div>
    <div class="label2">Var olan DNS kayıtlarının üzerine yaz<input value="1" type="checkbox" class="checkbox" name="forcedns"></div>
</td></tr>
 </table>
<div align="left"><input type="submit" class="input-button" value="Oluştur"></div>

</form>


<?

}
function 
hesapacdb(){
$sign=$_GET['sign'];
$plan=$_GET['plan'];
$domain=$_GET['domain'];
$username=$_GET['username'];
$password=$_GET['password'];
$contactemail=$_GET['contactemail'];
$msel=$_GET['msel'];
$quota=$_GET['quota'];
$bwlimit=$_GET['bwlimit'];
$maxftp=$_GET['maxftp'];
$maxpop=$_GET['maxpop'];
$maxlst=$_GET['maxlst'];
$maxsql=$_GET['maxsql'];
$maxsub=$_GET['maxsub'];
$maxpark=$_GET['maxpark'];
$maxaddon=$_GET['maxaddon'];
$customip=$_GET['customip'];
if(
$customip=='--Otomatik+Belirle--')
$customip='--Auto+Assign--';
$cgi=$_GET['cgi'];
$cpmod=$_GET['cpmod'];
$ownerself=$_GET['ownerself'];
$hasuseregns=$_GET['hasuseregns'];
$sonucwhmal("/scripts/wwwacct?sign=${sign}&plan=${plan}&domain=${domain}&username=${username}&password=${password}&contactemail=${contactemail}&msel=${msel}&quota=${quota}&bwlimit=${bwlimit}&maxftp=${maxftp}&maxpop=${maxpop}&maxlst=${maxlst}&maxsql=${maxsql}&maxsub=${maxsub}&maxpark=${maxpark}&maxaddon=${maxaddon}&customip=${customip}&cgi=${cgi}&cpmod=${cpmod}&ownerself=${ownerself}&hasuseregns=${hasuseregns}");
if(
eregi('Account Creation Status: ok ',$sonuc)){
echo 
"+===================================+<br>
İşleminiz başarıyla gerçekleştirildi<br>
+===================================+"
;
} else {
$sonuc=str_replace("icons/error.gif","images/error.gif",$sonuc);
preg_match_all('/<script>if \(update_ui_status\) { update_ui_status\(\"Checking input data\"\); }<\/script>(.*?)<script>if \(clear_ui_status\) { clear_ui_status\(\); }<\/script>/s'$sonuc$bul);
echo 
$bul[1][0];
}
}    

function 
hesapsil($kullanici) {
$sonucwhmal("/scripts/killacct?domain=silinece&user=${username}");
if(
eregi('Account Removal Complete!!!',$sonuc)){
echo 
"+===================================+<br>
İşleminiz başarıyla gerçekleştirildi<br>
+===================================+"
;
} else
echo 
"İşleminizde beklenmeyen bir problem oluştu";
}
switch(
$_GET['islem']){
    case 
"hesaplistele":
    
hesaplistele();
    break;

    case 
"paketlistele":
    
paketlistele();
    break;

    case 
"hesapac":
    
hesapacform();
    break;

    case 
"hesapacdb":
    
hesapacdb();
    break;

    case 
"suresibitenler":
    
surekontrol();
    break;

    case 
"suspend":
    
suspend($_REQUEST['hesap']);
     break;

    case 
"resellerlistele":
    
resellerlistele();
    break;
    
    case 
"hesapsil":
    
hesapsil($_REQUEST['hesap']);
    break;

    default:
    
hesaplistele();
    break;
}
?>

fonksiyonların hepsini vermedim, örnek olsun diye bi kaç tanesini yazdım zaten o da mantığı kapmak için yeterli

Not: baştaki whm.php dosyası, awbs gibi domaine üst klasörlere erişim hakkı vermemek içindir
Emrah isimli Üye şimdilik offline konumundadır   Alıntı ile Cevapla
Cevapla

Seçenekler
Stil

Yetkileriniz
Konu Acma Yetkiniz Yok
Cevap Yazma Yetkiniz Yok
Eklenti Yükleme Yetkiniz Yok
Mesajınızı Değiştirme Yetkiniz Yok

BB code is Açık
Smileler Açık
[IMG] Kodları Açık
HTML-Kodu Kapalı

Hizli Erisim


Tüm Zamanlar GMT +2 Olarak Ayarlanmış. Şuanki Zaman: 01:17 AM.


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.