Putnam
2010-04-05 03:46:56
How Long have You Played Runescape?
1 Year(s)
Are you affilated in anyway with Jagex LTD?
No
Were you Referred to SRL?
What is your general programming knowledge?
PHP, HTML, JavaScript
Very little of Visual Basic, Pascal, and Perl
Are you a member of any other communities?
ProgrammingSEO.com :3
SEOChat
TheAdminZone.com
Do I have to list them all?
YourPCForums.org
screw it, the list would have about 50 communities. Needless to say, a shitload of communities.
Tell us about yourself…
Please show us one (or multiple) of your scripts.
1 Year(s)
Are you affilated in anyway with Jagex LTD?
No
Were you Referred to SRL?
What is your general programming knowledge?
PHP, HTML, JavaScript
Very little of Visual Basic, Pascal, and Perl
Are you a member of any other communities?
ProgrammingSEO.com :3
SEOChat
TheAdminZone.com
Do I have to list them all?
YourPCForums.org
screw it, the list would have about 50 communities. Needless to say, a shitload of communities.
Tell us about yourself…
From: putnam11
I like to program, I play golf, I work at Dairy Queen, I visit the IRC often, my managers say I'm honest and a good worker :3
My scripts I am including are very basic. I am looking to get into members mainly because of bragging rights and interesting discussions. I hate when I get a link in IRC and it's members-only :<
PS Don't expect me to make any great scripts in the near future. I may help some one if they need help, but none directly from me.
Please show us one (or multiple) of your scripts.
SRL Scripts? None.
Will HTML and PHP work? I have a random
quote signature generator I created with
the help of Camo. A functional version can be found
at [url]http://programmingseo.com/siggen.html[/url]
HTML EXAMPLE
siggen.html
-------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<head>
<meta http-equiv="Content-type" content="text/html;charset=ISO-8859-1" >
<title>ProgrammingSEO.com | Random Quote Signature Generator</title>
</head>
<body onload="toggleValueFields();">
<form name="sig" action="sig.php" method="get" onsubmit="return validateForm(this);">
<div style="clear:both;margin-top:25px;">
<div style="clear:both;margin-bottom:25px;">
<div style="text-align: center;">
<big><b><u>Random Quote Signature Generator</u></b></big>
</div>
</div>
</div>
<div style="clear:both;margin-top:25px;">
<div style="text-align: center;">
<u>Image</u>
</div>
</div>
<div style="clear:both;margin-top:10px;">
<div style="text-align: center;">
* Background Image URL<br> <input type="text" name="imgsrc"
onchange="resetError(1);" size="70" > <span id="error1" style="color:white;">*</span>
<br><small>Must be a PNG!!!</small>
</div>
</div>
<div style="clear:both;margin-top:25px;">
<div style="text-align: center;">
<u>Name</u>
</div>
</div>
<div style="clear:both;margin-top:10px;">
<div style="text-align: center;">
<input type="text" name="name" >
<br><small><small>(Appears in top left corner of image)</small></small>
</div>
</div>
<div style="clear:both;margin-top:25px;">
<div style="text-align: center;">
<u>Quotes/Sayings</u>
</div>
</div>
<div style="clear:both;margin-top:10px;">
<div style="text-align: center;">
* Quote1<br> <input type="text" name="quo1" id="quo1" onkeyup="resetError
(2);" > <span id="error2" style="color:white;">*</span>
</div>
</div>
<div style="clear:both;margin-top:10px;">
<div style="text-align: center;">
Quote2<br> <input type="text" name="quo2" id="quo2" >
</div>
</div>
<div style="clear:both;margin-top:10px;">
<div style="text-align: center;">
Quote3<br> <input type="text" name="quo3" id="quo3" >
</div>
</div>
<div style="clear:both;margin-top:10px;">
<div style="text-align: center;">
Quote4<br> <input type="text" name="quo4" id="quo4" >
</div>
</div>
<div style="clear:both;margin-top:10px;">
<div style="text-align: center;">
Quote5<br> <input type="text" name="quo5" id="quo5" >
</div>
</div>
<div style="clear:both;margin-top:10px;">
<div style="text-align: center;">
Quote6<br> <input type="text" name="quo6" id="quo6" >
</div>
</div>
<div style="clear:both;margin-top:10px;">
<div style="text-align: center;">
Quote7<br> <input type="text" name="quo7" id="quo7" >
</div>
</div>
<div style="clear:both;margin-top:10px;">
<div style="text-align: center;">
Quote8<br> <input type="text" name="quo8" id="quo8" >
</div>
</div>
<div style="clear:both;margin-top:10px;">
<div style="text-align: center;">
Quote9<br> <input type="text" name="quo9" id="quo9" >
</div>
</div>
<div style="clear:both;margin-top:25px;">
<div style="text-align: center;">
<u>Coordinates</u>
</div>
</div>
<div style="clear:both;margin-top:10px;">
<div style="text-align: center;">
Use custom X/Y values of quotes?
<input type="checkbox" name="useval" value="Yes" id="chkUseEval"
onclick="toggleValueFields();" > Yes
</div>
</div>
<div style="clear:both;margin-top:10px;">
<div style="text-align: center;">
<span id="xValue">* X Value of quote<br> <input type="text" name="x"
onkeyup="return isNumeric(this.value, 3);" > <span id="error3"
style="color:white;">*</span></span>
</div>
</div>
<div style="clear:both;margin-top:10px;">
<div style="text-align: center;">
<span id="yValue">* Y Value of quote<br> <input type="text" name="y"
onkeyup="return isNumeric(this.value, 4);" > <span id="error4"
style="color:white;">*</span></span>
</div>
</div>
<div style="clear:both;margin-top:10px;">
<div style="text-align: center;">
<input type="submit" >
</div>
</div>
<div style="clear:both;margin-top:10px;">
<div style="clear:both;margin-bottom:10px;">
<div style="text-align: center;">* Indicates a Required field <br> <big>For use
in signatures, please shorten the URL using <a href="http://tinyurl.com/">TinyURL</a>!
</big></div>
</div>
</div>
<div style="text-align: center;"><small>©<a
href="http://programmingseo.com/">ProgrammingSEO</a> - Made by Putnam and KyleUndefined</small>
<br>
<small><small>Got Feedback or Questions? Post <a
href="http://programmingseo.com/php/random-quote-signature-generator-creator/">Here</a>!
</small></small>
</div>
</form>
<script language="javascript" type="text/javascript">
const quote_array_length = 9;
function toggleValueFields(){
if(document.getElementById('chkUseEval').checked){
document.getElementById('xValue').style.display='block';
document.getElementById('yValue').style.display='block';
} else {
document.getElementById('xValue').style.display='none';
document.getElementById('yValue').style.display='none';
}
}
var msg = '';
var error = '';
function validateForm(form){
if(form.imgsrc.value==''){
msg += 'Please select a file for the "Background Image" field\n';
error += '1 ';
} else {
if(form.imgsrc.value.lastIndexOf('.png')==-1){
msg += 'Please upload a valid image format. The valid format is "PNG"
\n';
error += '1 ';
}
}
checkQuotes();
checkXYValues(form);
if(!msg==''){
alert(msg);
showErrors(error);
return false;
}
return true;
}
function checkQuotes(){
var errs = 0;
for(var i=1; i<quote_array_length+1; i++){
if(document.getElementById('quo'+i).value==''){
errs = errs+1;
}
}
if(errs==9){
msg += 'Please insert at least 1 "Quote"\n';
error += '2 ';
}
}
function checkXYValues(form){
if(form.useval.checked){
if(form.x.value==''){
msg += 'Please insert a value into the "X" field\n';
error += '3 ';
} else {
if(!isNumeric(form.x.value, '3')){
msg += 'Please insert a valid "Numeric" value in the "X"
field\n';
error += '3 ';
}
}
if(form.y.value==''){
msg += 'Please insert a value into the "Y" field\n';
error += '4 ';
} else {
if(!isNumeric(form.y.value, '4')){
msg += 'Please insert a valid "Numeric" value in the "Y" field\n';
error += '4 ';
}
}
}
}
function showErrors(errors){
var theError = errors.split(' ');
for(var i=0; i<theError.length-1; i++){
document.getElementById('error'+theError[i]).style.color="red";
}
error = '';
msg = '';
}
function isNumeric(str, id){
var ValidChars = "0123456789.";
var Char;
var showErrorNow = false;
for (var i=0; i<str.length; i++){
Char = str.charAt(i);
if(ValidChars.indexOf(Char)==-1){
showErrorNow = true;
}
}
if(showErrorNow){
showErrors(id+' ');
return false;
} else {
resetError(id);
}
return true;
}
function resetError(id){
document.getElementById('error'+id).style.color="white";
}
</script>
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." :
"http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-
analytics.com/ga.js' type='text'% 3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-15484424-1");
pageTracker._trackPageview();
} catch(err) {}
</script>
</body>
</html>
PHP EXAMPLE
sig.php
----------
<?php
header("Content-type: image/png");
function setGetArray(){
$getArray = array();
foreach($_GET as $keyname => $value){
if(!empty($value)){
if(strpos($keyname, 'quo') !== false){
$getArray[] = $value;
}
}
}
return $getArray;
}
function getArrayValue($num){
$array = setGetArray();
return $arrayValue = $array[$num];
}
function getString(){
$number = rand(0, count(setGetArray()) - 1);
return $string2 = getArrayValue($number);
}
$im = imagecreatefrompng($_GET["imgsrc"]);
$color = imagecolorallocate($im, 255, 255, 255);
if(!empty($_GET["useval"])){
$px = $_GET["x"];
$py = $_GET["y"];
} else {
$px = 60;
$py = 0;
}
if(!empty($_GET["name"])){
$name = $_GET["name"];
} else {
$name = ' ';
}
$hx=10;
$hy=10;
imagestring($im, 3, $px, $py, $string, $color);
imagestring($im, 2, $px, $py+12, getString(), $color);
imagestring($im, 4, $hx, $hy, $name, $color);
imagepng($im);
imagedestroy($im);
?>