codingtcher.com
Theme Night
Home
Login

Get cpanel username php

Home » Tutorial Post » Get cpanel username php
Php Code
<?php
function getCpanelUsername($label=''){
	$parts = preg_replace('/\/+/', '/',$_SERVER["DOCUMENT_ROOT"]);
	$path_parts = array_pad(explode('/', $parts),100,null);
	if(is_int($label)){
	return $path_parts[$label];
	}else{
	 return $path_parts[2];
	}
}

echo getCpanelUsername();
?>

Related Post