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.

I am not sure what is meant by "the result of this link." That said, it is not too hard to evaluate a boolean and render a variable image based on the results. Still, if you want help in here you are going to need to be more specific. Someone could write you a function, but they're going to need to see some code.

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">';
}
}

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.