Jump to content

How To Use Php Script To Turn String Into Image


BradMeyer

Recommended Posts

How can I take the result of this link (true or false) and be able to use it as an embedded image?

 

https://minecraft.ne...p?user=username

 

For example, if the result in the browser of the link above is false, can we use a script to display an image?... something like this:

 

<img src="thescript.php?something=somestuffidontknow">

 

It should show one image for false, and another image for true.

 

I am not a web developer or anything, so if this is possible and isn't too much work I would really appreciate if someone could write the script for me. If it's too much work, I am more than willing to donate for a coffee or beer.

 

Why?

I run a game server & website for the game Minecraft and would like an easy visual way of showing my staff if a Minecraft player has a legit account when applying to our website.

Edited by BradMeyer
Link to comment
Share on other sites

Make you two images, one as a check, and another as an x.

 

Then retrieve the results of your minecraft check, as they have made it easy.

 

if the contents return true, then display the check, and if it is false, display the x.

 

<?php
if(isset($_GET['username'])) {
if(file_get_contents('https://minecraft.net/haspaid.jsp?user=' . $_GET['username']) == 'true') {
echo '<img src="check.png">';
} else {
echo '<img src="x.png">';
}
}

Link to comment
Share on other sites

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.