Jump to content

processing pop up..?


efficacious

Recommended Posts

Hello everyone,

 

I was just wondering if someone would be able to help me setup a "Processing..." pop up for my php script..

 

I have an automatic update script that checks users version info against our current version info and the decides which files the users need and zips just those files up inside a zip document.

 

The problem I've ran across is that the script execution takes alil long.. like (25sec) or so.

 

But our users are not that computer savvy and would be calling us thinking there is something wrong..

So I'd like to be able to have a "Proccessing.." pop up that does a stupid cheap animation or something.. just to show them .. we are working on it... lol

 

I've never done anything like this so plz do explain as if I knew nothing.

 

thanks,

 

eff

Link to comment
Share on other sites

here is the script:

 

<?php

//* COLLECT ALL VERSION INPUT *//

$AnnR = (!(isset($_GET['AnnR']))) ? '' : $_GET['AnnR'];		//GET Annual Reports
$AtchM = (!(isset($_GET['AtchM']))) ? '' : $_GET['AtchM'];	//GET Attachment Manager
$CapA = (!(isset($_GET['CapA']))) ? '' : $_GET['CapA'];		//GET Attachment Manager
$Capit = (!(isset($_GET['Capit']))) ? '' : $_GET['Capit'];	//GET Capital Assets
$Direct = (!(isset($_GET['Direct']))) ? '' : $_GET['Direct'];	//GET Direct DP
$Humres = (!(isset($_GET['Humres']))) ? '' : $_GET['Humres'];	//GET Human Resources
$Inven = (!(isset($_GET['Inven']))) ? '' : $_GET['Inven'];	//GET Inventory
$Inves = (!(isset($_GET['Inves']))) ? '' : $Inves=$_GET['Inves'];	//GET Investments
$Invoi = (!(isset($_GET['Invoi']))) ? '' : $_GET['Invoi'];	//GET Invoice
$Payr = (!(isset($_GET['Payr']))) ? '' : $_GET['Payr'];		//GET Payroll
$POR = (!(isset($_GET['POR']))) ? '' : $_GET['POR'];		//GET PO Request
$POS = (!(isset($_GET['POS']))) ? '' : $_GET['POS'];		//GET POS (Point of Sale)
$Purch = (!(isset($_GET['Purch']))) ? '' : $_GET['Purch'];	//GET Purchase Orders
$Tax = (!(isset($_GET['Tax']))) ? '' : $_GET['Tax'];		//GET Tax Reports
$Ttrax = (!(isset($_GET['Ttrax']))) ? '' : $_GET['Ttrax'];	// GET Time Trax
$Utility = (!(isset($_GET['Utility']))) ? '' : $_GET['Utility'];	// GET Utility Billing

////////////////////////////////////////////////////////////////////////////////////

//* HAS INPUT? *//
if(isset($_GET['CapA']))
{
//* CREATE MODULE NAME ARRAY *//
$Module=array(
	'Annual Reports',
	'Attachment Manager',
	'General Ledger/Accounts Payable',
	'Capital Assets',
	'Direct Deposit',
	'Human Resources',
	'Inventory Control',
	'Investment Management',
	'Invoice',
	'Payroll',
	'Purchase Order Request',
	'(POS)Point of Sale',
	'Purchase Orders',
	'IN Tax Reports',
	'Time Trax',
	'Utility Billing'
);

//* SEARCH DIRECTORY FOR VERSION INFO *//
$DIR = scandir("../update/");
$DirCount=count($DIR);

for($x=0;$x<$DirCount;$x++)
{
	if(is_dir($DIR[$x]))
	{
		if($DIR[$x]=='.' || $DIR[$x]=='..')
		{
			echo('');
		}
		else
		{
			for($x=0;$x<$DirCount;$x++)
			{
				if(is_dir($DIR[$x]))
				{
					if($DIR[$x]=='.' || $DIR[$x]=='..')
					{
						echo('');
					}
					else
					{
						$Folderz[$x]=$DIR[$x];
						$IFolderz=array_values($Folderz);	
					}
				}
			}
		}
	}
}

$FolderCount=count($IFolderz);
for($q=0;$q<$FolderCount;$q++)
{	
	//* CREATE MOST RECENT VERSIONS ARRAY *//
	$NameConvert[$q]=substr($IFolderz[$q],-5);
	if($NameConvert[$q]=='6.0.0')
	{
		$NameConvert[$q]='6.0';
		//echo($NameConvert[$q]."<br />");
	}

	$Rversion[$q]=$NameConvert[$q];
}


//echo("<br />");
//print_r($IFolderz);
//echo("<br /><br />");

for($z=0;$z<$FolderCount;$z++)
{
	//* GET FILES FROM FOLDERS *//
	if(is_dir($IFolderz[$z]))
	{
		if($IFolderz[$z]=='.' || $IFolderz[$z]=='..')
		{
			echo('');
		}
		else
		{
			$ScanFiles = scandir($IFolderz[$z]);
			$ScanCount = count($ScanFiles);
			for($x=0;$x<$ScanCount;$x++)
			{
				if($ScanFiles[$x]=='.' || $ScanFiles[$x]=='..')
				{
					echo('');
				}
				else
				{
					$mod[$x]=$ScanFiles[$x];												
				}

				if(isset($mod))
				{
					$TheFile[$x]=$mod[2];
					$ZTheFile=array_unique($TheFile);
					$NFilez=array_values($ZTheFile);
				}					
			}				
		}
	}
}
//echo"<br />";
//print_r($NFilez);
//echo"<br />";

//* CREATE USER VERSIONS ARRAY *//
$Uversion=array(
	$AnnR,		//Anuual Reports
	$AtchM,		//Attachment Manager
	$CapA,		//Cap Accounting
	$Capit,		//Capital Assets
	$Direct,	//Direct Deposit
	$Humres,	//Human Resources
	$Inven,		//Inventory Control
	$Inves,		//Investment Management
	$Invoi,		//Invoice
	$Payr,		//Payroll
	$POR,		//Purchase Order Request
	$POS,		//(POS)Point of Sale
	$Purch,		//Purchase Orders
	$Tax,		//IN Tax Reports
	$Ttrax,		//Time Trax
	$Utility	//Utility Billing
);

$U_Count=count($Uversion);

//* START DISPLAY *//
echo("
	<style>
		body {
			background:gray;
			text-align:center;
		}
		table,td {
			border-bottom:2px solid black;
			border-right:2px solid black;
			background:white;
		}
	</style>
	<br /><center><img src='logo2.png' border='0' /></center><br />
	<table style='margin:auto;' border='1' cellspacing='5'>
		<tr>
			<td colspan='2' style='text-align:center;'>
				<h2>Available Updates</h2>
			</td>
		</tr>
		<tr>
			<td colspan='2' style='padding-left:10px;'>
			<b>Key: </b><br /><br />
			<font color='blue'><b>Blue:</b> If Your Version is BLUE it means your module is Up-To-Date.</font><br /><br />
			<font color='red'><b>Red:</b> If Your Version is RED it means your module is Out-Of-Date.</font><br /><br /><br />
			<font color='green'><b>Green:</b> If Current Versions are GREEN it means that module can be updated.<br /><br />	
			</td>
		</tr>
		<tr>
			<td style='text-align:center'><h3><b>Your Version</b></h3></td>
			<td style='text-align:center'><h3><b>Current Version</b></h3></td>
		</tr>
");

/////////////////////////////////////////
//* SETUP INDICATORS FOR FILES TO ZIP *//
/////////////////////////////////////////

$Z_AnnR=0;
$Z_AtchM=0;	
$Z_CapA=0;
$Z_Capit=0;	
$Z_Direct=0;
$Z_Humres=0;
$Z_Inven=0;
$Z_Inves=0;
$Z_Invoi=0;
$Z_Payr=0;
$Z_POR=0;
$Z_POS=0;
$Z_Purch=0;
$Z_Tax=0;
$Z_Ttrax=0;
$Z_Utility=0;

$Z_Array= array(
	$Z_AnnR,
	$Z_AtchM,
	$Z_CapA,
	$Z_Capit,
	$Z_Direct,
	$Z_Humres,
	$Z_Inven,
	$Z_Inves,
	$Z_Invoi,
	$Z_Payr,
	$Z_POR,
	$Z_POS,
	$Z_Purch,
	$Z_Tax,
	$Z_Ttrax,
	$Z_Utility
	);

$Zcount=count($Z_Array);

//* SETUP FILE NAME ARRAY *//
$FN_Array= array(
	'AnnualReports.accde',
	'Attachment Manager.accde',
	'CapAccounting.accde',
	'CapitalAssets.accde',
	'DirectDP.accde',
	'Human Resource.accde',
	'Inventory.accde',
	'Investments.accde',
	'Invoice.accde',
	'Payroll.accde',
	'PORequest.accde',
	'POS.accde',
	'PurchaseOrders.accde',
	'TaxReports.accde',
	'TimeTrax.accde',
	'UB Billing.accde',
);

/////////////////////////////////////
///* LOOP THROUGH USERS VERSIONS *///
//* CHECK AGAINST CURRENT VERSION *//
/////////////////////////////////////
for($x=0;$x<16;$x++)
{
	if($Uversion[$x]<$Rversion[$x] && $Uversion[$x]!='')
	{
		//VERSION IS OUT OF DATE!
		echo("
			<tr>
				<td style='color:red'> ".$Module[$x]." v".$Uversion[$x]." </td>
				<td style='color:green'> ".$Module[$x]." v".$Rversion[$x]." </td>
			</tr>
		");

		//* MARK MODULE OUT-OF-DATE! *//
		$Z_Array[$x]++;


	}		
	elseif($Uversion[$x]==$Rversion[$x])
	{
		//VERSION IS UP-TO-DATE.
		echo("
			<tr>
				<td style='color:blue'> ".$Module[$x]." v".$Uversion[$x]." </td>
				<td> ".$Module[$x]." v".$Rversion[$x]." </td>
			</tr>
		");
	}		

}//END LOOP

//* GET DATE STAMP *//
$TheDate = date("m-d-y");
$TheTime = 


////////////////////////
//* ZIP UP THE FILES *//
////////////////////////
$zip = new ZipArchive();

$filename = "CTE_Update".$TheDate.".zip";

//if(!(file_exists($filename)))
//{
	if ($zip->open($filename, ZIPARCHIVE::CREATE)!==TRUE) 
	{
		exit('cannot open <'.$filename.'>');
	}
	else
	{
		for($x=0;$x<16;$x++)
		{
			//* GRAB NEW FILES 2 Be Zipped *//
			if($Z_Array[$x]==0)
			{
				echo('');//DON'T GRAB THIS FILE
			}
			else
			{
				$zip->addFile($IFolderz[$x]."/".$FN_Array[$x],$FN_Array[$x]);		
			}
		}			
	}

	$zip->close();
//}

//* SERVE UP DOWNLOAD ZIP *//
if(file_exists($filename))
{
	echo("
		<tr>
			<td colspan='2' style='text-align:center;vertical-align:middle;height:75px;'>

				<a href='".$filename."'>CLICK HERE TO DOWNLOAD UPDATE!</a>

			</td>
		</tr>	
	");
}

//* DELETE OLD ZIPS *//

	// UNDERCONSTRUCTION //

//* END DISPLAY *//
echo("</table>");
}//END CHECK
?>

 

not familiar with ajax 8(

Link to comment
Share on other sites

ah ic

 

Been wanting to do some stuff on linux/unix systems but havn't been able to for somtime now..

I run my own websites and stuff off my pc aswell as playing games on it.. 8P

 

And I don't have another pc to run it on..

 

Your hosting companies don't yell at you for hosting your sites on their connection?  Surprising.  Well, if you get a decent amount of traffic, it's surprising.  If it's like, 30 hits a month, then w/e. >_<  You should really get some experience with Linux if you can though.  Such a great system.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.