Jump to content

Recommended Posts

I currently have my sig generator running,  the problme Im facing is that it outputs like this http://mysite.com/image.php?sigimage.png

I need to have it out put like this -> http://mysite.com/image.png?sigimage.png or something like it because a lot of sites do not allow image.php.

 

Heres the codes

Config.php

<?	
$hostname = "localhost";
$username = "name";
$password = "password";
$dbname = "database";
$webDir = "http://www.mysite/sig/";
?>

 

Sig.php

<?php
require_once('config.php');
header("Content-type: image/png");

if ($_POST){
  $id   = $_POST['id'];
  $sig  = $_POST['sig'];
  $colour= $_POST['colour'];
  $test = urlencode($id.",".$sig);
  $url  =$webDir ."image.php?image=".$test;
  echo  "<img src=\"".$url."\"><br><br>";
  echo  "HTML<input size=480px value='" .htmlentities("<img src=".$url.">") ."'><br><br>";
  echo  "BBCODE<input size=480px value='" .htmlentities("[img=".$url."]") ."'><br><br>";

}
?>
<style type="text/css">
<!--
.style1 {
color: #FFFFFF;
font-weight: bold;
}
-->
</style>
<form name="form1" action="" method="post">
  <div align="center">
<body bgcolor="#2C2C2C" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
    <p><span class="style1">ID:</span>      
      <input name="id" type="text" value="" />
<span class="style1">Design:</span>      
    <!--<input name="type" type="radio" value="1" />Player<input name="type" type="radio" value="2" />Team-->
    <select name="sig">
        <option value="">--Select--</option>
        <option value="1.png">1name</option>
        <option value="2.png">2name</option>
        <option value="3.png">3name</option>
        <option value="4.png">4name</option>
        <option value="5.png">5name</option>
        <option value="6.png">6name</option>
        <option value="7.png">7name</option>
        <option value="8.png">8name</option>
    </select>

  
    <input type="submit" name="submit" value="Generate" onclick="javascript:{if (form1.sig.value=='') {alert('please select a template');return false;}}" />
</p>
</div>
</form> 

 

Heres the image.php

<?php
  require_once('config.php');
  $link = mysql_connect($hostname, $username, $password)
	or die('Could not connect : ' . mysql_error()); 
  mysql_select_db($dbname,$link) or die('Could not select database');
  if ($_GET)
  {  
    $content= $_GET['image'];
    $test   = explode(",",urldecode($content));
    $id     = $test[0];
    $sig    = $test[1];
    $query  = "SELECT * FROM users WHERE id = '{$id}'";
    $result = mysql_query($query) or die('Query failed : ' . mysql_error());
    $row    = mysql_fetch_array($result);
    $join   = date("F d, Y",strtotime($row['joindate']));
    $last   = date("F d, H:i A",strtotime($row['lastlogin']));

    header("Content-type: image/png");
    $string = "ID: ".$id;
    $im     = imagecreatefrompng($sig);
    $name   = "Name: ".$row['alias'];
    $tag    = "Live GamerTag: ".$row['icq'];
    $join   = "Join Date: ".$join;
    $last   = "Last Match: ".$last;
    $tw     = "Total Wins: ".$row['matcheswon'];
    $tl     = "Total Losses: ".$row['matcheslost'];

$white  = imagecolorallocate($im, 255,255,255);


switch ($test[2]) {
	case "white": 
	    $colour = $white;
		break;
}

    $px     = (imagesx($im) - 7.5 * strlen($string)) / 2;
    imagestring($im, 2, 200, 8, $string,$white);
    imagestring($im, 2, 16, 8, $name, $white);
    imagestring($im, 2, 16, 18, $tag,$white);
    imagestring($im, 2, 16, 78, $join, $white);
    imagestring($im, 2, 16, 88, $last, $white);
    imagestring($im, 2, 16, 38, $tw, $white);
    imagestring($im, 2, 16, 48, $tl, $white);
    imagepng($im);
    imagedestroy($im);

  }
?>

 

How do I have it output like http://mysite.com/sig/image.png?signame.png??

 

All help would be greatful.

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/75090-standalone-sig-generator-help/
Share on other sites

Well, you can set up apache to parse files with extensions other than .php as php files. Therefore, you can set up apache to parse .png files as php files. Of course, this would mean any images that you normally use that are png files would be a problem, but you could use a .htaccess file, placed in the appropriate sub directory, to ensure this only covers this particular thing.

 

See this tutorial: http://www.phpfreaks.com/tutorials/34/0.php

 

Other than that, you would probably have to generate the images prior to them being used, save them on the server as .png images, which could then be used. This would remove the dynamic aspect, but would still allow users to generate their own signitures.

Of course, this would mean any images that you normally use that are png files would be a problem, but you could use a .htaccess file, placed in the appropriate sub directory,

 

What would the .htaccess file look like?  I have never messed with one.

Heres mine...what would I do to change it to work with my sig gen?

# -FrontPage-

IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*

<Limit GET POST>
order deny,allow
deny from all
allow from all
</Limit>
<Limit PUT DELETE>
order deny,allow
deny from all
</Limit>
AuthName mysite.com
AuthUserFile /home/mysite/public_html/_vti_pvt/service.pwd
AuthGroupFile /home/msite/public_html/_vti_pvt/service.grp

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.