Scripts

PHP Setup

Ik heb een stand-alone setup script om bestanden op de server op te slaan. Hij haalt dan ook de plaatjes van een andere server af... Je moet wel even de bestanden instellen... Ik heb dan ook de functie create gemaakt. Er is een config stuk waar je alles kunt instellen, bij $open moet je instellen wat hij opent als de setup compleet is. Ik ben nog bezig met een setup creator te maken... Als dit script niet werkt moet je proberen je server te updaten naar minimaal versie: 4.3.0

php-setup
/////////////////////
////Setup.php/////
////////////////////
[code]
<?php

//Start Config Part
$name='Setup Test';
$img_host='http://renrik.freehostia.com/setup/img/';
$open='index.php';
//End of Config Part

function create($filename, $filedata)
{
   $fh = fopen($filename, 'w') or die("can't open file");
   fwrite($fh, $filedata);
   fclose($fh);

}

$step=$_GET['step'];
If ( $step == '' )
{
   $step=1;
}
echo '<HTML><HEAD><meta http-equiv="imagetoolbar" content="no"><title>'.$name.' setup :: Step: '.$step.'</title>';

If ( $step == '1' )
{
   $text='Welcome to the setup of '.$name.'. We are happy you decided to use our software on your webserver. This setup will create the neccesary files on your server.<br><br><br><br>Press the Next button!';
}
Else If ( $step == '2' )
{
   create("index.php", '<a href="index2.php">index2.php</a>');
   create("index2.php", '<button onclick="javascript:history.go(-1);">Ga terug</button>');
   $text='The file: index.php and index2.php have been created!';
}
Else If ( $step == '3' )
{
   $text='The setup is complete, thank you!<br>Dont forget to delete setup.php<br><br><br>Click on Finish to open the created program. If you dont want to open the program, press exit.';
}
Else
{
   ?> <script language=javascript>
   alert("You left the knows steps, please try again!");
   history.go(-1);
   </script><?php
}

$next=$step + 1;
$prev=$step - 1;
If ( $prev == '0' )
{
   $prev='1';
}

?>
<!-- Start Design Part --!>
<IMG src="<?php echo $img_host ?>back.jpg" alt="" align="top" border="0" width="574" height="439" style="position:absolute;left:188px;top:40px;width:574px;height:439px;z-index:0">
<A href="javascript:window.close();"><IMG src="<?php echo $img_host ?>close.jpg" alt="Close the setup of <?php echo $name ?>" align="top" border="0" width="34" height="40" style="position:absolute;left:713px;top:43px;width:34px;height:40px;z-index:1"></A>
<DIV style="position:absolute;left:231px;top:55px;width:481px;height:16px;z-index:2" align="left">
<FONT style="font-size:13px" color="#FFFFFF" face="Arial"><?php echo $name ?> setup :: Step: <?php echo $step ?></FONT>
</DIV>
<DIV style="position:absolute;left:373px;top:96px;width:353px;height:16px;z-index:3" align="left">
<FONT style="font-size:13px" color="#000000" face="Arial"><?php echo $text ?></FONT>
</DIV>
<button onclick="javascript:window.close();" style="position:absolute;left:650px;top:423px;width:75px;height:24px;z-index:4">Exit</button>
<?php
If ( $step == '3' )
{
   ?><form action="<?php echo $open ?>" type="application/x-www-form-urlencoded">
   <INPUT type="submit" name="" value="Finish" style="position:absolute;left:563px;top:423px;width:75px;height:24px;z-index:5">
   </form><?php
}
Else
{
   ?><form action="setup.php" type="application/x-www-form-urlencoded">
   <INPUT type="hidden" name="step" value="<?php echo $next ?>">
   <INPUT type="submit" name="" value="Next" style="position:absolute;left:563px;top:423px;width:75px;height:24px;z-index:5">
   </form><?php
}
?><form action="setup.php" type="application/x-www-form-urlencoded">
<INPUT type="hidden" name="step" value="<?php echo $prev ?>">
<INPUT type="submit" name="" value="Previous" style="position:absolute;left:476px;top:423px;width:75px;height:24px;z-index:6">
</form>
<!-- End Design Part --!>
[/code]

Nou wat vinden jullie ervan?

Reacties

0
Nog geen reacties.