<?php
function full_copy($source,$target)
{
if(is_dir($source))
{
@mkdir($target);
$d = dir($source);
while(FALSE !== ($entry = $d->read()))
{
if($entry == '.' || $entry == '..')
{
continue;
}
$Entry = $source . '/' . $entry;
if(is_dir($Entry))
{
full_copy( $Entry, $target . '/' . $entry );
continue;
}
copy($Entry,$target.'/'.$entry);
}
$d->close();
}
else
{
copy($source,$target);
}
}
$strSubdomain = "SIS";
/// absolute path///////
$strSource = $dir['root']."resources/affiliate/";
$strDest = $dir['root']."subdomain/affiliate/$strSubdomain";
full_copy($strSource,$strDest);
?>
Research and Development work on PHP, MYSQ,JQuery,Angular Js,React Native,Laravel,Wordpress,Magento,Joomla
Sunday, June 24, 2012
Create subdomains in php
<?php
function create_subdomain($subDomain,$cPanelUser,$cPanelPass,$rootDomain) {
// to be change ///// x3 on different server///
$buildRequest = "/frontend/x3/subdomain/doadddomain.html?rootdomain=" . $rootDomain . "&domain=" . $subDomain . "&dir=public_html/beta/subdomain/affiliate/" . $subDomain;
$openSocket = fsockopen('localhost',2082);
if(!$openSocket) {
return "Socket error";
exit();
}
$authString = $cPanelUser . ":" . $cPanelPass;
$authPass = base64_encode($authString);
$buildHeaders = "GET " . $buildRequest ."\r\n";
$buildHeaders .= "HTTP/1.0\r\n";
$buildHeaders .= "Host:localhost\r\n";
$buildHeaders .= "Authorization: Basic " . $authPass . "\r\n";
$buildHeaders .= "\r\n";
fputs($openSocket, $buildHeaders);
while(!feof($openSocket)) {
fgets($openSocket,128);
}
fclose($openSocket);
$newDomain = "http://" . $subDomain . "." . $rootDomain . "/";
return "Created subdomain $newDomain";
}
function delete_subdomain($subDomain,$cPanelUser,$cPanelPass,$rootDomain)
{
///////// to be change different server name x3/////////////
$buildRequest = "/frontend/x3/subdomain/dodeldomain.html?domain=" . $subDomain . "_" . $rootDomain;
$openSocket = fsockopen('localhost',2082);
if(!$openSocket) {
return "Socket error";
exit();
}
$authString = $cPanelUser . ":" . $cPanelPass;
$authPass = base64_encode($authString);
$buildHeaders = "GET " . $buildRequest ."\r\n";
$buildHeaders .= "HTTP/1.0\r\n";
$buildHeaders .= "Host:localhost\r\n";
$buildHeaders .= "Authorization: Basic " . $authPass . "\r\n";
$buildHeaders .= "\r\n";
fputs($openSocket, $buildHeaders);
while(!feof($openSocket)) {
fgets($openSocket,128);
}
fclose($openSocket);
$passToShell = "rm -rf /home/" . $cPanelUser . "/public_html/beta/subdomain/affiliate/" . $subDomain;
system($passToShell);
}
$subdomain = create_subdomain('sisconsultancy','newyugco','9730951424','newyug.com');
echo $subdomain;
?>
function create_subdomain($subDomain,$cPanelUser,$cPanelPass,$rootDomain) {
// to be change ///// x3 on different server///
$buildRequest = "/frontend/x3/subdomain/doadddomain.html?rootdomain=" . $rootDomain . "&domain=" . $subDomain . "&dir=public_html/beta/subdomain/affiliate/" . $subDomain;
$openSocket = fsockopen('localhost',2082);
if(!$openSocket) {
return "Socket error";
exit();
}
$authString = $cPanelUser . ":" . $cPanelPass;
$authPass = base64_encode($authString);
$buildHeaders = "GET " . $buildRequest ."\r\n";
$buildHeaders .= "HTTP/1.0\r\n";
$buildHeaders .= "Host:localhost\r\n";
$buildHeaders .= "Authorization: Basic " . $authPass . "\r\n";
$buildHeaders .= "\r\n";
fputs($openSocket, $buildHeaders);
while(!feof($openSocket)) {
fgets($openSocket,128);
}
fclose($openSocket);
$newDomain = "http://" . $subDomain . "." . $rootDomain . "/";
return "Created subdomain $newDomain";
}
function delete_subdomain($subDomain,$cPanelUser,$cPanelPass,$rootDomain)
{
///////// to be change different server name x3/////////////
$buildRequest = "/frontend/x3/subdomain/dodeldomain.html?domain=" . $subDomain . "_" . $rootDomain;
$openSocket = fsockopen('localhost',2082);
if(!$openSocket) {
return "Socket error";
exit();
}
$authString = $cPanelUser . ":" . $cPanelPass;
$authPass = base64_encode($authString);
$buildHeaders = "GET " . $buildRequest ."\r\n";
$buildHeaders .= "HTTP/1.0\r\n";
$buildHeaders .= "Host:localhost\r\n";
$buildHeaders .= "Authorization: Basic " . $authPass . "\r\n";
$buildHeaders .= "\r\n";
fputs($openSocket, $buildHeaders);
while(!feof($openSocket)) {
fgets($openSocket,128);
}
fclose($openSocket);
$passToShell = "rm -rf /home/" . $cPanelUser . "/public_html/beta/subdomain/affiliate/" . $subDomain;
system($passToShell);
}
$subdomain = create_subdomain('sisconsultancy','newyugco','9730951424','newyug.com');
echo $subdomain;
?>
Read user data from facebook through api
$fbUrl = "https://graph.facebook.com/?id=$identity&access_token=".$aData["Session"]["access_token"];
$curl = curl_init($fbUrl);
curl_setopt ($curl,CURLOPT_RETURNTRANSFER,1);
$data = curl_exec ($curl);
$arrdata = json_decode($data);
?>
refer the following/////////
https://developers.facebook.com/docs/reference/api/
$curl = curl_init($fbUrl);
curl_setopt ($curl,CURLOPT_RETURNTRANSFER,1);
$data = curl_exec ($curl);
$arrdata = json_decode($data);
?>
refer the following/////////
https://developers.facebook.com/docs/reference/api/
PHP Script to read curl data from other site
<?php
$curl = curl_init();
/*curl_setopt ($curl, CURLOPT_URL, "http://api.careerbuilder.com/v1/jobsearch?&DeveloperKey=WDH38FQ65G6P0DTBZ09C&Keywords=php&PageNumber=1");*/
curl_setopt ($curl, CURLOPT_URL, "http://api.careerbuilder.com/v1/jobsearch?&DeveloperKey=111&Keywords=php&PageNumber=1");
curl_setopt ($curl,CURLOPT_RETURNTRANSFER,1);
$data = curl_exec ($curl);
$arrData = simplexml_load_string($data);
echo "<pre>";
print_r($arrData);
curl_close ($curl);
?>
$curl = curl_init();
/*curl_setopt ($curl, CURLOPT_URL, "http://api.careerbuilder.com/v1/jobsearch?&DeveloperKey=WDH38FQ65G6P0DTBZ09C&Keywords=php&PageNumber=1");*/
curl_setopt ($curl, CURLOPT_URL, "http://api.careerbuilder.com/v1/jobsearch?&DeveloperKey=111&Keywords=php&PageNumber=1");
curl_setopt ($curl,CURLOPT_RETURNTRANSFER,1);
$data = curl_exec ($curl);
$arrData = simplexml_load_string($data);
echo "<pre>";
print_r($arrData);
curl_close ($curl);
?>
PHP Script to create subdomains
function create_subdomain($subDomain,$cPanelUser,$cPanelPass,$rootDomain)
{
$buildRequest = "/frontend/x3/subdomain/doadddomain.html?rootdomain=" . $rootDomain . "&domain=" . $subDomain . "&dir=public_html/subdomains/affiliate/" . $subDomain;
$openSocket = fsockopen('localhost',2082);
if(!$openSocket)
{
return "Socket error";
exit();
}
$authString = $cPanelUser . ":" . $cPanelPass;
$authPass = base64_encode($authString);
$buildHeaders = "GET " . $buildRequest ."\r\n";
$buildHeaders .= "HTTP/1.0\r\n";
$buildHeaders .= "Host:localhost\r\n";
$buildHeaders .= "Authorization: Basic " . $authPass . "\r\n";
$buildHeaders .= "\r\n";
fputs($openSocket, $buildHeaders);
while(!feof($openSocket))
{
fgets($openSocket,128);
}
fclose($openSocket);
//$newDomain = "http://" . $subDomain . "." . $rootDomain . "/";
return "Created subdomain $newDomain";
}
function full_copy($source,$target)
{
if(is_dir($source))
{
@mkdir($target);
$d = dir($source);
while(FALSE !== ($entry = $d->read()))
{
if($entry == '.' || $entry == '..')
{
continue;
}
$Entry = $source . '/' . $entry;
if(is_dir($Entry))
{
full_copy( $Entry, $target . '/' . $entry );
continue;
}
copy($Entry,$target.'/'.$entry);
}
$d->close();
}
else
{
copy($source,$target);
}
}
///////////////////////// for insert into table ////////////////////////////////////////
if(isset($_POST["txtSubmitAffiliate"]))
{
$strSubdomain = $_POST["txtSubdomainname"];
$sqlAffiliateQuery = "INSERT INTO affiliate SET
username='".$_POST["txtUsername"]."',
password='".$_POST["txtPassword"]."',
name='".$_POST["txtName"]."',
email='".$_POST["txtEmail"]."',
sub_domain_name='".$_POST["txtSubdomainname"]."',
street_address='".$_POST["txtStreetAddress"]."',
city='".$_POST["txtCity"]."',
state='".$_POST["txtState"]."',
country='".$_POST["txtCountry"]."',
zipcode='".$_POST["txtZipcode"]."',
status='1',
created_at=NOW(),
updated_at=NOW()";
db_res($sqlAffiliateQuery);
$intLastId = mysql_insert_id();
@mkdir($dir['root']."subdomains/affiliate/".$strSubdomain, 0777);
full_copy($dir['root']."resources/affiliate/",$dir['root']."subdomains/affiliate/".$strSubdomain."/");
@unlink($dir['root']."subdomains/affiliate/".$strSubdomain."/inc/config.inc.php");
$strContentfile = file_get_contents($dir['root']."resources/affiliate/inc/config.sample.inc.php", true);
$strContentfile = str_replace('#aff_id#',$intLastId,$strContentfile);
$strContentfile = str_replace('#sub_url#',$strSubdomain,$strContentfile);
$strContentfile = str_replace('#root_dir#',$strSubdomain,$strContentfile);
$myFile = $dir['root']."subdomains/affiliate/".$strSubdomain."/inc/config.sample.inc.php";
$fh = fopen($myFile, 'w');
fwrite($fh, $strContentfile);
fclose($fh);
$oldFile = $dir['root']."subdomains/affiliate/".$strSubdomain."/inc/config.sample.inc.php";
$newFile = $dir['root']."subdomains/affiliate/".$strSubdomain."/inc/config.inc.php";
@rename($oldFile,$newFile);
$subdomain = create_subdomain($strSubdomain,'newyugco','9730951424','newyug.com');
@mkdir($dir['root']."subdomains/affiliate/".$strSubdomain, 0755);
header("Location:".$site["url"]."affiliate_success.php?msg=success");
}
{
$buildRequest = "/frontend/x3/subdomain/doadddomain.html?rootdomain=" . $rootDomain . "&domain=" . $subDomain . "&dir=public_html/subdomains/affiliate/" . $subDomain;
$openSocket = fsockopen('localhost',2082);
if(!$openSocket)
{
return "Socket error";
exit();
}
$authString = $cPanelUser . ":" . $cPanelPass;
$authPass = base64_encode($authString);
$buildHeaders = "GET " . $buildRequest ."\r\n";
$buildHeaders .= "HTTP/1.0\r\n";
$buildHeaders .= "Host:localhost\r\n";
$buildHeaders .= "Authorization: Basic " . $authPass . "\r\n";
$buildHeaders .= "\r\n";
fputs($openSocket, $buildHeaders);
while(!feof($openSocket))
{
fgets($openSocket,128);
}
fclose($openSocket);
//$newDomain = "http://" . $subDomain . "." . $rootDomain . "/";
return "Created subdomain $newDomain";
}
function full_copy($source,$target)
{
if(is_dir($source))
{
@mkdir($target);
$d = dir($source);
while(FALSE !== ($entry = $d->read()))
{
if($entry == '.' || $entry == '..')
{
continue;
}
$Entry = $source . '/' . $entry;
if(is_dir($Entry))
{
full_copy( $Entry, $target . '/' . $entry );
continue;
}
copy($Entry,$target.'/'.$entry);
}
$d->close();
}
else
{
copy($source,$target);
}
}
///////////////////////// for insert into table ////////////////////////////////////////
if(isset($_POST["txtSubmitAffiliate"]))
{
$strSubdomain = $_POST["txtSubdomainname"];
$sqlAffiliateQuery = "INSERT INTO affiliate SET
username='".$_POST["txtUsername"]."',
password='".$_POST["txtPassword"]."',
name='".$_POST["txtName"]."',
email='".$_POST["txtEmail"]."',
sub_domain_name='".$_POST["txtSubdomainname"]."',
street_address='".$_POST["txtStreetAddress"]."',
city='".$_POST["txtCity"]."',
state='".$_POST["txtState"]."',
country='".$_POST["txtCountry"]."',
zipcode='".$_POST["txtZipcode"]."',
status='1',
created_at=NOW(),
updated_at=NOW()";
db_res($sqlAffiliateQuery);
$intLastId = mysql_insert_id();
@mkdir($dir['root']."subdomains/affiliate/".$strSubdomain, 0777);
full_copy($dir['root']."resources/affiliate/",$dir['root']."subdomains/affiliate/".$strSubdomain."/");
@unlink($dir['root']."subdomains/affiliate/".$strSubdomain."/inc/config.inc.php");
$strContentfile = file_get_contents($dir['root']."resources/affiliate/inc/config.sample.inc.php", true);
$strContentfile = str_replace('#aff_id#',$intLastId,$strContentfile);
$strContentfile = str_replace('#sub_url#',$strSubdomain,$strContentfile);
$strContentfile = str_replace('#root_dir#',$strSubdomain,$strContentfile);
$myFile = $dir['root']."subdomains/affiliate/".$strSubdomain."/inc/config.sample.inc.php";
$fh = fopen($myFile, 'w');
fwrite($fh, $strContentfile);
fclose($fh);
$oldFile = $dir['root']."subdomains/affiliate/".$strSubdomain."/inc/config.sample.inc.php";
$newFile = $dir['root']."subdomains/affiliate/".$strSubdomain."/inc/config.inc.php";
@rename($oldFile,$newFile);
$subdomain = create_subdomain($strSubdomain,'newyugco','9730951424','newyug.com');
@mkdir($dir['root']."subdomains/affiliate/".$strSubdomain, 0755);
header("Location:".$site["url"]."affiliate_success.php?msg=success");
}
Select Query Fetch multiple result function
<?php
mysql_connect("localhost","root","");
mysql_select_db("fetch");
function fnFetchMultipleResults($resResource, $strFetchType = 'ARR')
{
$resResource = mysql_query($resResource);
$intRows = mysql_num_rows($resResource);
if($intRows > 0)
{
if($strFetchType == 'OBJ')
{
while($arrRecord = mysql_fetch_object($resResource))
{
$arrResults[] = $arrRecord;
}
}
else if($strFetchType == 'ARR')
{
while($arrRecord = mysql_fetch_assoc($resResource))
{
$arrResults[] = $arrRecord;
}
}
}
else
{
$arrResults = array();
}
return $arrResults;
}
function fnFetchSingleResult($resResource, $strFetchType = 'ARR')
{
$resResource = mysql_query($resResource);
$intRows = mysql_num_rows($resResource);
if($intRows > 0)
{
if($strFetchType == 'OBJ')
{
$arrRecord = mysql_fetch_object($resResource);
}
else if($strFetchType == 'ARR')
{
$arrRecord = mysql_fetch_assoc($resResource);
}
}
else
{
return array();
}
return $arrRecord;
}
$sqlQuery = "SELECT * FROM `fetch`";
$arrRes = fnFetchMultipleResults($sqlQuery, $strFetchType = 'ARR');
print_r($arrRes);
?>
Javascript disable right click
<script type="text/javascript">
function md(e)
{
try { if (event.button==2||event.button==3) return false; }
catch (e) { if (e.which == 3) return false; }
}
document.oncontextmenu = function() { return false; }
document.ondragstart = function() { return false; }
document.onmousedown = md;
</script>
safsdfsfsdfsdfsdafsdfsadf
Javascript to bookmark your page
<script language="javascript">
function addBookmark()
{
bookmarkurl = "http://www.tildemark.com";
bookmarktitle="Tildemark blogs";
if (document.all)
window.external.AddFavorite(bookmarkurl,bookmarktitle)
else if ( window.sidebar ) {
window.sidebar.addPanel(bookmarktitle, bookmarkurl,"");
}
}
</script>
<a href="javascript:addBookmark();">Bookmark this page!</a>
Javascript onclick Display n number of textbox
<SCRIPT language="javascript">
function addRow(tableID)
{
var table = document.getElementById(tableID);
var rowCount = table.rows.length;
var row = table.insertRow(rowCount);
var colCount = table.rows[0].cells.length;
var cnt = document.getElementById('cntdiv').innerHTML;
document.getElementById('cntdiv').innerHTML=parseInt(cnt) + 1;
for(var i=0; i<colCount; i++)
{
var newcell = row.insertCell(i);
//alert("error_"+cnt);
newcell.innerHTML = '<div id="error_'+cnt+'"></div>'+table.rows[0].cells[i].innerHTML;
switch(newcell.childNodes[0].type)
{
case "text":
newcell.childNodes[0].value = "";
break;
case "radio":
newcell.childNodes[0].checked = false;
break;
case "textarea":
newcell.childNodes[0].selectedIndex = 0;
break;
}
}
cnt++;
}
</SCRIPT>
<div id='cntdiv' style="display:none;"></div>
<form action="/index.php?option=com_business" method="post" id="josForm" name="adminForm" class="form-validate"
enctype="multipart/form-data">
<table id="dataTable" border="0">
<div id="error_0" align="center"></div>
<tr>
<td><label>Category Name</label>
<span class="strk">*</span>
<div class="clr"></div>
<input type="text" title="Menu Category" name="name[]" id="name[]" class="textbox validate(required)" style="width: 245px;" value="">
<div class="clr"></div>
<br>
</td>
</tr>
</table>
<div class="rs">
<INPUT type="button" value="Add Category" onClick="addRow('dataTable')" />
</div>
</form>
Display image at the center of content
<?php
function displayImage($intGetWidth,$intGetHeight,$intNewWidth,$intNewHeight)
{
$intWidth = $intNewWidth;
$intHeight = $intNewHeight;
if( $intGetWidth > $intNewWidth)
{
$intWidth = $intNewWidth;
$intHeight = (($intGetHeight * $intNewWidth)/$intGetWidth);
}
if($intHeight > $intNewHeight)
{
$intHeight = $intNewHeight;
$intWidth = (($intWidth * $intNewHeight)/$intHeight);
}
return array($intWidth,$intHeight);
}
$intNewWidth = 100;
$intNewHeight = 100;
$strSource = "image/Google22.jpg";
$arrDimensions = getimagesize($strSource);
$intOrigionalWidth = $arrDimensions[0];
$intOrigionalHeight = $arrDimensions[1];
$intNewDim = displayImage($intOrigionalWidth,$intOrigionalHeight,$intNewWidth,$intNewHeight);
$intWhiteWidth = (($intNewWidth - $intNewDim[0])/2);
$intWhiteHeight = (($intNewHeight - $intNewDim[1])/2);
?>
<div style="height:100px;width:100px;border:1px solid #FF0000;">
<img src="http://localhost/display_image/image/Google22.jpg" width="<?php echo $intNewDim[0];?>" height="<?php echo $intNewDim[1];?>" style="margin-top:<?php echo $intWhiteHeight;?>;margin-left:<?php echo $intWhiteWidth;?>"/>
</div>
Saturday, June 23, 2012
PHP Script header cannot send problem solutions
if(!isset($_SESSION["email"]))
{
if(!headers_sent())
{
$strRedirectUrl = $site['url'].'admin/index.php';
header("Location:".$strRedirectUrl);
}
else
{
$strRedirectUrl = $site['url'].'admin/index.php';
?>
{
if(!headers_sent())
{
$strRedirectUrl = $site['url'].'admin/index.php';
header("Location:".$strRedirectUrl);
}
else
{
$strRedirectUrl = $site['url'].'admin/index.php';
?>
location.href = '';
}
}
}
PHP Script header cannot send problem solutions
if(!isset($_SESSION["email"]))
{
if(!headers_sent())
{
$strRedirectUrl = $site['url'].'admin/index.php';
header("Location:".$strRedirectUrl);
}
else
{
$strRedirectUrl = $site['url'].'admin/index.php';
?>
{
if(!headers_sent())
{
$strRedirectUrl = $site['url'].'admin/index.php';
header("Location:".$strRedirectUrl);
}
else
{
$strRedirectUrl = $site['url'].'admin/index.php';
?>
location.href = '';
<?php
}
}
}
}
PHP Read curl data
<?php
$curl = curl_init();
curl_setopt ($curl, CURLOPT_URL, "http://api.google.com/v1/jobsearch?&DeveloperKey=WDH38FQ65G6P0DTBZ09C&Keywords=php&PageNumber=1");
curl_setopt ($curl,CURLOPT_RETURNTRANSFER,1);
$data = curl_exec ($curl);
$curl = curl_init();
curl_setopt ($curl, CURLOPT_URL, "http://api.google.com/v1/jobsearch?&DeveloperKey=WDH38FQ65G6P0DTBZ09C&Keywords=php&PageNumber=1");
curl_setopt ($curl,CURLOPT_RETURNTRANSFER,1);
$data = curl_exec ($curl);
$arrData = simplexml_load_string($data);
/*echo "
/*echo "
"; print_r($arrData);*/ echo "
Total Result : ".$arrData->TotalCount."
";
echo "
echo "
Total Pages : ".$arrData->TotalPages."
";
echo "
echo "
Limit Start : ".$arrData->FirstItemIndex."
";
echo "
echo "
Limit End : ".$arrData->LastItemIndex."
";
echo "
";
echo "
echo "
";
echo "
"; echo "";echo "";
echo "Description";
echo "Date";
echo "";
foreach($arrData->Results->JobSearchResult as $key=>$obj)
{/*$arrvalues[] = array(
'location'=>$obj->Location,
'company_name'=>$obj->Company,
'description'=>$obj->DescriptionTeaser,
'date_added'=>$obj->PostedDate
);*/
$arrvalues[] = array(
'title'=>(string)$obj->JobTitle,
'location'=>(string)$obj->Location,
'company_name'=>(string)$obj->Company,
'description'=>(string)$obj->DescriptionTeaser,
'date_added'=>(string)$obj->PostedDate
);
echo "
";echo "".$obj->Location."";
echo "".$obj->DescriptionTeaser."";
echo "".$obj->PostedDate."";
echo "";
}
/*echo "";
print_r($arrvalues);*/
echo "
echo "Description";
echo "Date";
echo "";
foreach($arrData->Results->JobSearchResult as $key=>$obj)
{/*$arrvalues[] = array(
'location'=>$obj->Location,
'company_name'=>$obj->Company,
'description'=>$obj->DescriptionTeaser,
'date_added'=>$obj->PostedDate
);*/
$arrvalues[] = array(
'title'=>(string)$obj->JobTitle,
'location'=>(string)$obj->Location,
'company_name'=>(string)$obj->Company,
'description'=>(string)$obj->DescriptionTeaser,
'date_added'=>(string)$obj->PostedDate
);
echo "
";echo "".$obj->Location."";
echo "".$obj->DescriptionTeaser."";
echo "".$obj->PostedDate."";
echo "";
}
/*echo "";
print_r($arrvalues);*/
echo "
Location |
---|
";
curl_close ($curl);
?>
curl_close ($curl);
?>
PHP Resize image on both side
function fnCreatBigThumbnail($strSourcePath,$strFilename,$strDestinationPath,$intGetWidth,$intGetHeight)
{
$strSourcePath = $strSourcePath.$strFilename;
$info = pathinfo($strSourcePath);
if (strtolower($info['extension']) == 'jpg') {$img = imagecreatefromjpeg( "{$strSourcePath}");}
elseif(strtolower($info['extension']) == 'gif'){$img = imagecreatefromgif( "{$strSourcePath}");}
elseif(strtolower($info['extension']) == 'png'){$img = imagecreatefrompng( "{$strSourcePath}");}
{
$strSourcePath = $strSourcePath.$strFilename;
$info = pathinfo($strSourcePath);
if (strtolower($info['extension']) == 'jpg') {$img = imagecreatefromjpeg( "{$strSourcePath}");}
elseif(strtolower($info['extension']) == 'gif'){$img = imagecreatefromgif( "{$strSourcePath}");}
elseif(strtolower($info['extension']) == 'png'){$img = imagecreatefrompng( "{$strSourcePath}");}
$intNewWidth = $intOrigionalWidth = imagesx( $img );
$intNewHeight = $intOrigionalHeight = imagesy( $img );
$intNewHeight = $intOrigionalHeight = imagesy( $img );
if($intOrigionalWidth > $intGetWidth)
{
$intNewWidth = $intGetWidth;
$intNewHeight = (($intOrigionalHeight * $intGetWidth)/$intOrigionalWidth);
}
if($intNewHeight > $intGetHeight)
{
$intNewHeight = $intGetHeight;
$intNewWidth = (($intOrigionalWidth * $intGetHeight)/$intOrigionalHeight);
}
{
$intNewWidth = $intGetWidth;
$intNewHeight = (($intOrigionalHeight * $intGetWidth)/$intOrigionalWidth);
}
if($intNewHeight > $intGetHeight)
{
$intNewHeight = $intGetHeight;
$intNewWidth = (($intOrigionalWidth * $intGetHeight)/$intOrigionalHeight);
}
$tmp_img = imagecreatetruecolor($intGetWidth,$intGetHeight);
$strWhiteBackground = imagecolorallocate($tmp_img, 255, 255, 255);
imagefill($tmp_img, 0, 0, $strWhiteBackground);
$strWhiteBackground = imagecolorallocate($tmp_img, 255, 255, 255);
imagefill($tmp_img, 0, 0, $strWhiteBackground);
$floatWhiteWidth = (($intGetWidth - $intNewWidth)/2);
$floatWhiteHeight = (($intGetHeight - $intNewHeight)/2);
$floatWhiteHeight = (($intGetHeight - $intNewHeight)/2);
imagecopyresized( $tmp_img, $img, $floatWhiteWidth, $floatWhiteHeight, 0, 0, $intNewWidth, $intNewHeight, $intOrigionalWidth, $intOrigionalHeight );
if(strtolower($info['extension']) == 'jpg'){imagejpeg($tmp_img,"{$strDestinationPath}{$strFilename}");}
elseif(strtolower($info['extension']) == 'gif'){imagegif( $tmp_img, "{$strDestinationPath}{$strFilename}");}
elseif(strtolower($info['extension']) == 'png'){imagepng( $tmp_img, "{$strDestinationPath}{$strFilename}");}
}
if(isset($_REQUEST["submit"]))
{
$type = strtolower($_FILES['file']['type']);
if(($type=="image/gif")||($type=="image/jpeg") ||($type=="image/png") ||($type=="image/jpeg"))
{
move_uploaded_file($_FILES['file']['tmp_name'],'upload/'.$_FILES['file']['name']);
$strSourcePath = "upload/";
$strFilename = $_FILES['file']['name'];
$strDestinationPath = "resize/";
fnCreatBigThumbnail($strSourcePath,$strFilename,$strDestinationPath,935,440);
}
else
{
echo "Invalid value";
}
}
elseif(strtolower($info['extension']) == 'gif'){imagegif( $tmp_img, "{$strDestinationPath}{$strFilename}");}
elseif(strtolower($info['extension']) == 'png'){imagepng( $tmp_img, "{$strDestinationPath}{$strFilename}");}
}
if(isset($_REQUEST["submit"]))
{
$type = strtolower($_FILES['file']['type']);
if(($type=="image/gif")||($type=="image/jpeg") ||($type=="image/png") ||($type=="image/jpeg"))
{
move_uploaded_file($_FILES['file']['tmp_name'],'upload/'.$_FILES['file']['name']);
$strSourcePath = "upload/";
$strFilename = $_FILES['file']['name'];
$strDestinationPath = "resize/";
fnCreatBigThumbnail($strSourcePath,$strFilename,$strDestinationPath,935,440);
}
else
{
echo "Invalid value";
}
}
fnCreatThumbnail(TEMPLATEPATH.'/images/banners/','abc.jpg',TEMPLATEPATH.'/images/banners/large/',300,300);
Javascript get screen height and width
function fnGetScreenSize()
{
var screenW = 640, screenH = 480;
if (parseInt(navigator.appVersion)>3)
{
screenW = screen.width;
screenH = screen.height;
}
else if (navigator.appName == "Netscape" && parseInt(navigator.appVersion)==3 && navigator.javaEnabled())
{
var jToolkit = java.awt.Toolkit.getDefaultToolkit();
var jScreenSize = jToolkit.getScreenSize();
screenW = jScreenSize.width;
screenH = jScreenSize.height;
}
return screenW;
}
intWidth = fnGetScreenSize();
{
var screenW = 640, screenH = 480;
if (parseInt(navigator.appVersion)>3)
{
screenW = screen.width;
screenH = screen.height;
}
else if (navigator.appName == "Netscape" && parseInt(navigator.appVersion)==3 && navigator.javaEnabled())
{
var jToolkit = java.awt.Toolkit.getDefaultToolkit();
var jScreenSize = jToolkit.getScreenSize();
screenW = jScreenSize.width;
screenH = jScreenSize.height;
}
return screenW;
}
intWidth = fnGetScreenSize();
Apply Class through javascript
jQuery('body').addClass('width1024');
jQuery('.main-container').css('min-height',screen.height);
Javascript Checkall Code
function fnCheckAll()
{
var nam="";
var mainchk = document.frmManage.mycheckbox;
var chklen = document.frmManage.elements.length;
if(mainchk.checked==true)
{
for(var n=0; n {
nam="check"+ n;
var currobj = document.getElementById(nam);
if(currobj.type == "checkbox" )
currobj.checked=true;
}
}
else if(mainchk.checked==false)
{
for(var n=0; n= 0)
{
allInputs = document.getElementsByTagName("input");
var flag=1;
for (i = 0; i< allInputs.length; i++)
{
if (allInputs[i].checked==true)
{
flag=0;
}
}
if (flag != 0 )
{
alert("Please select at least one.");
return false;
}
else
{
if(confirm('Are You Sure Want To Delete Selected Employee?'))
{
document.frmManage.submit();
}
}
}
}
{
var nam="";
var mainchk = document.frmManage.mycheckbox;
var chklen = document.frmManage.elements.length;
if(mainchk.checked==true)
{
for(var n=0; n
nam="check"+ n;
var currobj = document.getElementById(nam);
if(currobj.type == "checkbox" )
currobj.checked=true;
}
}
else if(mainchk.checked==false)
{
for(var n=0; n= 0)
{
allInputs = document.getElementsByTagName("input");
var flag=1;
for (i = 0; i< allInputs.length; i++)
{
if (allInputs[i].checked==true)
{
flag=0;
}
}
if (flag != 0 )
{
alert("Please select at least one.");
return false;
}
else
{
if(confirm('Are You Sure Want To Delete Selected Employee?'))
{
document.frmManage.submit();
}
}
}
}
for($intI=0;$intI
Bulk Action :
Please Select
Iframe code to display google map
http://maps.google.co.in/maps?source=s_q&hl=en&geocode=&q=Mayank+M+Patel,+1,+PatelFaliyu,+Unn,+Udhana-Navsari+Main+Rd,&aq=0&sll=21.125498,81.914063&sspn=42.891601,56.513672&vpsrc=6&ie=UTF8&hq=Mayank+M+Patel,+1,+Patel+Faliya,+Unn,+Udhana-Navsari+Main+Rd,&hnear=Udhana+Zone,+Surat,+Gujarat&ll=21.109609,72.862124&spn=0.073774,0.049263&t=m&output=embed
View Larger Map
View Larger Map
Iframe call
function callIframe(strUrl,height,width)
{
document.getElementById('companyiframe').src = strUrl;
document.getElementById('companyiframe').style.height = height;
document.getElementById('companyiframe').style.width = width;
document.getElementById('companyiframe').style.border = 'none';
}
{
document.getElementById('companyiframe').src = strUrl;
document.getElementById('companyiframe').style.height = height;
document.getElementById('companyiframe').style.width = width;
document.getElementById('companyiframe').style.border = 'none';
}
var url = "http://192.168.0.1/";
callIframe(url,"400px","710px");
callIframe(url,"400px","710px");
Subscribe to:
Posts (Atom)