|
Posted by windandwaves on 08/25/05 04:29
Hi
This maybe a nice little script for some new-newbies to get amongst a bit of
php action (I am still a newish-b myself)
http://www.sunnysideup.co.nz/clients/go.php
To follow is the PHP:
<?php
$content = '
<html>
<head>
<title>test me</title>
<script src="j/j.js" type="text/javascript"></script>
<style type="text/css"> img.iletter { display: none; } </style>
</head>';
$location = $_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'];
if(($_POST["submit"] && $_POST["txt"]) || $x) {
$content .= '<body onload="reveal(\'l\', 1, 300);" style="margin: 0px;
padding: 50px; background-color: #000;">';
if($x) {
$letters = urldecode(base64_decode($x));
}
else {
$letters = htmlentities($_POST["txt"], ENT_QUOTES);
$code = urlencode(base64_encode($letters));
$content .= '<p style="color: white;">link is :
http://'.$location.'?x='.$code.'</p>';
}
$content .= letterer($letters).'<p style="clear: both;"><br><br><a
href="go.php" style="color: white;">try another one</a></p>';
}
else {
$content .= '
<body style="margin: 50px;">
<form method="post" action="go.php">
<textarea name="txt" cols="30" rows="10">type anything you want
here</textarea>
<br><br><input name="submit" type="submit" value="show me the money">
</form>';
}
function letterer ($letters) {
$v = '<div id="letters">';
$len = strlen($letters);
for($i = 0; $i < $len; $i++){
$let = substr($letters,$i, 1);
$let = replacer($let);
$v .= '<div class="iletter" id="divl'.($i+1).'" style="float: left";><img
src="a/'.strtolower($let).'.gif" alt="'.$let.'" class="iletter"
id="l'.($i+1).'"></div>'; //
}
$v .= '</div>';
return $v;
}
$content .= '</body></html>';
echo $content;
function replacer($letter) {
$search = array (
' ',
'?',
'>',
'<',
'*',
':',
'.',
);
$replace = array (
'_space',
'_questionmark',
'_gt',
'_lt',
'_asterix',
'_colon',
'_dot',
);
return str_replace($search, $replace, $letter);
}
?>
[Back to original message]
|