Nov 21, 2009

Dynamic Signatures - The Real Way To Go - Forget placing index.php in a signature.png folder.

free web hosting
Open Discussion > MODERATED AREA > Tutorials

Dynamic Signatures - The Real Way To Go - Forget placing index.php in a signature.png folder.

Spectre
This is only a very quick tutorial, meant to complement the dynamic signature tutorials that already exist here. It's nothing new, but it was just brought to my attention that not many people seem to be aware of this method. This does not cover the actual creation of dynamic signatures, per se - but rather a better 'trick' to allow you to use dynamic signatures on forums such as this one.

I've noticed that most of the dynamic signature tutorials on this forum state that you must place a file index.php in a folder <filename>.png, in order to trick Invision Power Board (and other forums) into thinking that it is linking to an image - but when the user's browser attempts to access the folder image.png, it is redirected to the index.php script. However, this is very 'hackish', and in my opinion, not the best way to go about it if you have a choice.

If your host runs Apache and it is configured to allow it, you can create a script with any extension - such as .gif, .png, .jpg, or whatever - and use a .htaccess file to cause the script to be passed to the PHP engine, and therefore treated as a script and not an image. This means there is no 'tricking' the forum into thinking that a folder is a script and causing access to be redirected to the script contained within the folder - the image is the actual script.

So rather than having signature.png/index.php, you can simply have signature.png - and all the PHP code is contained within that file.

In order to use this method, you simply need to add file handling instructions to a .htaccess file located in the same folder as your dynamic signature script. You can name the script whatever you like, but make sure it aligns with whatever type of image the script is creating and the Content-Type header it sends (which seems to be PNG for the majority of tutorials):

CODE
<Files signature.png>
ForceType application/x-httpd-php
</Files>


And that's all there is to it. No more relying on Apache's method of automatically redirecting access of a folder to a pre-defined directory index in order to use dynamic signatures in forums and other areas that only allow images with a recognised image extension to be linked to.

 

 

 


Comment/Reply (w/o sign-up)

sportytalk
Thanks for your post explaining how to go about adding dynamic signatures without having to trick the internet browsers, this will almost certainly help those people who want to have an updating signature, logo or even banner I guess.

I don't really include dynamic images on my website, at least I haven't done yet. I may, however, put a dynamic banner or something on my website in the future.

Even if I don't use this method, no doubt there are other people out there who are pleased they've read this topic. Thanks for sharing smile.gif

Comment/Reply (w/o sign-up)

Sprnknwn
Sorry ¿what do you understand for dynamic? I thought that a dynamic signature was only one which changes between a few images of the same size. An animated gif to speak clearly. So I guess you´re talking about something differente because I don´t need anybody need php code to put an animated gif in his signature. ¿Maybe you say something like... last.fm sigs?

Comment/Reply (w/o sign-up)

NDPA
If you are making the image generator for use in a forum, there's another method similar to this if you use IPB 2.0 or higher.

In the ACP there's a section defining filetypes, if you find it it lists all the allowed extentions on the forum and their mime type. You can just change the one for png from image to application/x-httpd-php and it has the same effect as what Spectre mentions.

If you do this, however, you do it at your own risk. I have used this before but not for this extension.

Comment/Reply (w/o sign-up)

Spectre
QUOTE(Sprnknwn @ Oct 14 2006, 07:10 AM) *

Sorry ¿what do you understand for dynamic? I thought that a dynamic signature was only one which changes between a few images of the same size. An animated gif to speak clearly. So I guess you´re talking about something differente because I don´t need anybody need php code to put an animated gif in his signature. ¿Maybe you say something like... last.fm sigs?


A dynamic image is one that can be changed, for instance a single image that displays different text each time you view it. An animated GIF is not dynamic - although the frames may change to form the animation, the image is still in itself static. A dynamic image can be created in PHP via the imaging functions provided in various libraries.

Comment/Reply (w/o sign-up)

Dooga
hmm.... will that make my images all php files? lol...

Comment/Reply (w/o sign-up)

Spectre
No. Only individual files specified in the .htaccess file. You could add an Apache handler that caused all images to be passed to the PHP engine, but using the mentioned method only allows for individual files to be treated in a certain way (in this case, as a PHP script).

Comment/Reply (w/o sign-up)

AlternativeNick
theres another way to do this (how i do it at least).

The url to one of my dynamic images is www.altscripts.net/image.php/1/sig.gif

anything in /1/sig.gif can be changed, i use 1 as it is my forum ID, and sig.gif just fools a forum software (or whatever else) into thinking its an image file, the sig.gif part is not actually used in the script.

To get the information from the url, i just use explode;
this is how its done
CODE

$stdata = explode("/",$_SERVER['PATH_INFO']);

then to get the '1' out of the url, i use $stdata['1'], and $stdata['2'] would be the sig.gif, that allows for truely dynamic images (where user input of some sort is required, in this case a forum ID to get a few forum stats.)

Comment/Reply (w/o sign-up)

Shining
Oh so very cool. I actualy knew how to do this, but for some people that didn't, it's a very good tutorial. You have explained it very well and made it quite simple to understand. Very well done!

Comment/Reply (w/o sign-up)



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

This textarea will convert to Rich-Text automatically (IE, Firefox, Chrome)

Similar Topics

Keywords : dynamic, signatures, real, forget, placing, index, php, signature, png, folder

  1. Locking A Folder With No Software At All!
    works on XP AND VISTA!!! (4)
  2. Create Dynamic Html/php Pages Using Simple Vb.net Code
    Taking your application data, and creating a webpage for others to vie (1)
    This example will show you how use a string in VB to create PHP code. In order to do this, you need
    a string to store your PHP page and a function that I will list at the bottom of the page for you to
    put in a module. This code is written in VB.NET Public Sub CreatePage(ByVal HTMLTitle As
    String, ByVal HTMLText As String, ByVal HTMLFileName As String) Dim strFile As String '
    ---------------------- ' -- Prepare String -- ' ---------------------- strFile = "" '
    -------------------- ' -- Write Starter -- ' -------------------- strFile = " " ....
  3. Folder View In Kde 4.1
    (4)
    Even though there was a lot of negative criticism over the new KDE, but over the last time there are
    mostly positive critics and they encouraged me to try this DE (some of them even told me that KDE4
    is better than MS Vista's and even OSX's one!). For those which don't know what is KDE
    and what should they expect from it, here is the official link from the devs. :
    http://www.kde.org/announcements/4.1/ With the comming of KDE 4 lots of things changed and lots
    of new things were added in it, but I'll keep on one productive thing in here, and its called ....
  4. Centering A Div
    placing the div to the center of a screen (6)
    Many people would like theire website in the center of the screen. This is how to do that. 1. make
    a new css document. 2. Then place the following code in it. #main-div { position: absolute;
    top: 50%; left: 50%; width: 70em; height: 50em; margin-top: -25em; /*always take 1/2 from the
    size of the height, they have to be negative*/; margin-left: -35em; /*always take 1/2 from the size
    of the width, they have to be negative*/ } Then place in your html: the following code.
    content This wil place the div box in the center of the screen, works mostly for ....
  5. Tutorial : Hide Folder Without Any Softwares
    Descriptive enough! (21)
    It's easy, just a few steps and your folder will be hidden First step : Create folder, name it
    using alt+0160 Second : A folder will be created with name 1 space, then right click the folder,
    properties, customize, change icon, see for a blank icon and press apply Enjoy Video tutorial
    uploaded by me http://www.youtube.com/watch?v=EW8dD3KeUJk Have fun.....
  6. Cakephp On Ubuntu
    using your own public_html folder (1)
    Hi, there are many tutorials about this, but i would like to type the steps i followed in order to
    get cakephp working on my user public_html folder. as many of you probably know, if you have
    apache's userdir module loaded, you can put your web pages on /home/user/public_html , and
    access them with the url: http://localhost/~user/ . I really prefer this, so all my web pages are
    on my personal home, but how to configure cakephp to work with these paths, i got a hard time with
    this, but finally got it!. here's how: in case you don't have apache2's userd....
  7. Dynamic Signature - Yet Another Way To Do It
    Create dynamic sigs for multiple users using .htaccess and RewriteRule (0)
    Ever since I connected a program I made in Visual Basic to MySQL database, I had an idea to create
    some sort of a status page... And I did that, where I updated my connection status every 60 seconds,
    updated my Winamp playlist, and several other interesting things... Then, I figured I could create
    an image, and display all that info, and show it on forums, as a signature... And I made a great
    PHP script, that look real fancy, and does the job perfectly... So, I was adding the reference to
    http://status.galahad.trap17.com/stat.php to all the forums... BUT (there's ....
  8. Making A Dynamic Page On Blogspot
    Using an external server to make your pages hosted on blogspot dynamic (5)
    Good morning everyone. Have you ever wondered how to allow your visitors to edit content on your
    blog? Like adding a post straight off the page, adding a link, editing your profile etc. This will
    be extremely useful if you want your visitors to contribute to your blog besides writing comments or
    tagging. 1. Adding a post straight off the page. Go to blogger.com, login, select your blog. Go to
    settings -> email. By enabling blog email, you can now add a post by simply sending an email to the
    address you specified. The address should look something like: yourusername....
  9. Templating System Using Php Includes
    Building a Dynamic site using Includes and flat-files. (13)
    Php based Templating System http://jlhaslip.trap17.com/template/index.php The Source Code
    for the scripts are included (literally) on the different pages on the Demo, including the Contact /
    Email script. The only page not there yet is the Message Script. Maybe tonight I will upload that.
    This one uses a little bit of query-string checking to confirm that the contents of the page are
    actually available (file_exists())and an allowed page content before serving it up. The
    'allowed page content' is done by checking against a flat-file containing an array....
  10. Building An Unordered List Of Anchors
    From a list of files in a folder (4)
    Building an Unordered List of Anchors from a Folder of files This script reads files from the
    named folder and then builds a list of links from the filenames using the contents of the first
    tag as the link description and the file-name as the anchor href . The file should be a web
    readable file such as html or php. This script may come in handy for creating a list of clickable
    links for use in sidebars and on 'sitemap' pages. Simply build a series of html files and
    store them all in a single folder, ensuring that the description inside the first h3....
  11. Css And Javascript Combined For Dynamic Layout
    use of different CSS files at same site (9)
    This tutorial is meant for people that are dealing with problems while coding their site at 100% of
    width. Important notice: Some people has JavaScript disabled, so they will not be able to load CSS
    file (take this in account when creating your website). How this script works. In the HEAD of your
    HTML document will apply this command, so variable.js file will be load at start: CODE
    In browser JavaScript file variable.js is loaded. This Javascript file consist of this parameters,
    copy this code and name it variable.js CODE // JavaScript Document if (sc....
  12. Php Dynamic Signatures
    Using the GD Module and MySQL (9)
    PHP Dynamic Signatures using the GD Module After much scowering on the internet to find a
    suitable tutorial on this subject, I came up empty-handed. So I was forced to learn it on my own
    through trial & error. And since I had discovered a lack of tutorials on this subject, I dediced to
    write one! Working Example: Abstract : Using the GD Module of PHP allows a developer
    to build custom Images with Dynamic Content. Such content could be the Requesting Users IP Address,
    Web-Browser Type, Operating System, even the number of times the user has seen th....
  13. Php Installed Modules Dynamic Reference Tool
    An effective tool for coding in PHP (4)
    PHP Installed Modules Dynamic Reference Tool A dynamic tool for referencing PHP modules and
    their associated routines, which are installed on your web-server. **Note: Uses only 2 functions
    built-in to PHPs core and should be easy to convert to a later version of PHP. This current version
    uses PHP4. Example: PHP Installed Modules Dynamic Reference Tool Abstract : As a PHP
    Developer, it is nice to know what functionality is available to you, and what you would have to
    implement yourself. Some of this functionality is provided for you by the PHP core,....
  14. Changing A Dynamic Ip
    How to change your dynamic IP. (22)
    In this tutorial I will tell you how to change a dynamic IP if you have Windows XP. First of all go
    to - Start >> Run - and type 'cmd'. A window with a black background and grey text. In
    this window type 'ipconfig' and text should come up saying: IP Address ............. *IP
    HERE* Subnet Mask ................ *SUBNET MASK HERE* Default Gateway .......... *DEFAULT GATEWAY*
    Write this down on a bit of paper on in notepad. You will need them later. Now type
    'ipconfig/release' - this will terminate your internet connection - but don't g....
  15. Secure Dynamic Pages Ii
    (0)
    Just put the following code in every begining of your PHP script: CODE So, you will never
    see any errors. OR CODE if (isset($_GET )){ $thepage=urldecode(base64_decode($_GET ));
    @include($thepage); } ?> ....
  16. Secure Dynamic Pages
    Another good php tutorial. (7)
    Hello all, Recently a friend of mine gave me this code to make your site completley dynamic and
    secure at the same time. Here is what you have to do. Open a new page in your text editor and paste
    in this code. CODE error_reporting (E_ALL ^ E_NOTICE); if(!$page){ $page = $HTTP_GET_VARS ; }
    if($page=="" or $page=="main"){ include("main.php"); } if($page=""){   die("You cannot access this
    page directly..."); } ?> Then save the file as index.php . After that upload the file onto
    your server and make your main content page 'main.php' but dont put any ....

    1. Looking for dynamic, signatures, real, forget, placing, index, php, signature, png, folder

Searching Video's for dynamic, signatures, real, forget, placing, index, php, signature, png, folder
See Also,
advertisement


Dynamic Signatures - The Real Way To Go - Forget placing index.php in a signature.png folder.

Affordable Web Hosting, Low cost Web Hosting - ComputingHost.com