Go Back   Computer Forums > General Computing > Programming
Click Here to Login
Join Computer forums Today


Reply
 
Thread Tools Search this Thread Display Modes
 
Old 09-06-2006, 09:11 PM   #1
Beta Member
 
Join Date: Sep 2006
Posts: 4
Default need some help with PHP

i have been trying this for about 2 days

I'm trying to make an xbox gamercard generator i can get the stuff no problem but when i try to add the stuff to the an image it gives me about 5 lines of errors

this is my source code so far any help is needed

Code:
<html>
<head>
<title>The Online Nation </title>

<LINK REL="StyleSheet" HREF="themes/XD-Obstuse/style/style.css" TYPE="text/css"><body>
<center><font color="#ffffff">GamerTag:</font> <form action="./index2.php" method="post"><input name="tag" alt="Your Gamer Tag"><input type="Submit" value="Submit"></form></center>
<?




if (!($_GET['timeout'])) {
$timeout = 400;
}

if (!($_GET['tag'])) {

}
$tag = str_replace(" ","%20",$tag);

$file1 = file('./gamercard_cache.html');
$file = array_map('trim', $file1);

$abstand = time() - $file[0];

if ($abstand > $timeout || $tag != $file[1]) {
include('./snoopy.php');
$snoopy = new Snoopy; 
if($snoopy->fetch("http://gamercard.xbox.com/". $tag .".card")) 
$in = ($snoopy->results);

preg_match('#<h3 class="XbcGamertag(.+?)">#',$in, $gamertagstyle1); 
preg_match('#width="64" src="(.+?)" /></a>#',$in, $gamertile1);
preg_match('#XbcFRAR"><img src="(.+?)" /></span></p>#',$in, $gamerrep1);  
preg_match('#Gamerscore" src="(.+?)" />#',$in, $gamerscore_img1);  
preg_match_all('#<span class="XbcFRAR">(.+?)</span>#',$in, $gamer);
preg_match_all('#<div class="XbcgcGames">(.+?)</div>#',$in, $gamesa);

$gamerrep = "http://gamercard.xbox.com". $gamerrep1[1];
$gamerscore_img = "http://gamercard.xbox.com". $gamerscore_img1[1];
$gamerscore = $gamer[1][1];
$gamerzone = $gamer[1][2];
$gamerarchivements = $gamesa[1][0];
$gamerarchievements = $gamesa[1][0];

$cache_string = time() ."\n". $tag ."\n". $gamertagstyle1[1] ."\n". $gamertile1[1] ."\n". $gamerrep ."\n". $gamerscore ."\n". $gamerscore_img ."\n". $gamerzone ."\n". $gamerarchivements ."\n". $stat ;


$cache = fopen ("./gamercard_cache.html", "w");
fwrite($cache, $cache_string );
fclose($cache);

$gamertagstyle = $gamertagstyle1[1];
$gamertile = $gamertile1[1];
$gamertag = str_replace("%20"," ", $tag);

} else {


$tag = $file[1];
$gamertag = str_replace("%20"," ", $tag);
$gamertagstyle = $file[2];
$gamertile = $file[3];
$gamerrep = $file[4];
$gamerscore = $file[5];
$gamerscore_img = $file[6];
$gamerzone = $file[7];
$gamerarchivements = $file[8];
$gamerarchievements = $file[8];

}

echo " <center><font color=\"\"><b>GamerTag</b>: $gamertag<br> Gamer pic:<br><img src=\"$gamertile\"> <br>Code To Copy:<br><textarea name=\"textarea\" cols=\"40\" rows=\"3\">$gamertile</textarea><br><br> Recent Activities:<br>$gamerarchievements</font></center> ";

include ('./testing.php');

?> 
</body></html>
__________________

EV0LUTION is offline   Reply With Quote
Old 09-07-2006, 06:31 AM   #2
Site Team
 
root's Avatar
 
Join Date: Mar 2004
Posts: 8,003
Default Re: need some help with PHP

it'd help if you could either copy/paste the error message, or point us to the page where this is hosted so that we could see exactly where the error is...
__________________

__________________
I didn’t fight my way to the top of the food chain to be a vegetarian…
Im sick of people saying 'dont waste paper'. If trees wanted to live, they'd all carry guns.
"The inherent vice of capitalism is the unequal sharing of blessings; The inherent vice of socialism is the equal sharing of miseries."
root is offline   Reply With Quote
Old 09-07-2006, 06:22 PM   #3
Beta Member
 
Join Date: Sep 2006
Posts: 4
Default Re: need some help with PHP

ok the file is http://theonlinenation.com/dl/index2.php

and i added the following code

Code:
echo " <img src=\"$gamertag.test.png\" border=\"0\"> <br><br><center><b>GamerTag</b>: $gamertag<br> Gamer pic:<br><img src=\"$gamertile\"> <br>Code To Copy:<br><textarea name=\"textarea\" cols=\"40\" rows=\"3\">$gamertile</textarea><br><br> Recent Activities:<br>$gamerarchievements</font></center> ";


// create a 100*30 image
imagecreate("100", "30");
$im = imagecreatefrompng("./$gamercard.test.png");

// white background and blue text
$bg = imagecolorallocate($im, 255, 255, 255);
$textcolor = imagecolorallocate($im, 0, 0, 255);

// write the string at the top left
imagestring($im, 5, 0, 0, "$gamercard", $textcolor);

// output the image
imagepng($im);

?> 
</body></html>
EV0LUTION is offline   Reply With Quote
Old 09-08-2006, 10:18 AM   #4
Site Team
 
root's Avatar
 
Join Date: Mar 2004
Posts: 8,003
Default Re: need some help with PHP

I think the problem is that you don't have the GD extension installed on your webserver...

have been able to make anything in the past that has used graphic creation in this way?
__________________
I didn’t fight my way to the top of the food chain to be a vegetarian…
Im sick of people saying 'dont waste paper'. If trees wanted to live, they'd all carry guns.
"The inherent vice of capitalism is the unequal sharing of blessings; The inherent vice of socialism is the equal sharing of miseries."
root is offline   Reply With Quote
Old 09-08-2006, 06:34 PM   #5
Beta Member
 
Join Date: Sep 2006
Posts: 4
Default Re: need some help with PHP

no i dont have a gd

and is there anyother way to get a pic generated withought gd?
EV0LUTION is offline   Reply With Quote
Old 09-09-2006, 05:16 PM   #6
Site Team
 
root's Avatar
 
Join Date: Mar 2004
Posts: 8,003
Default Re: need some help with PHP

well that explains the errors!

Umm... as for graphics generation... are you able to install GD, or get it installed... (it's free and easy to install).

it is possible to generate graphics in 'other ways', but it's not as easy as usings GD...

I think the best way that you can do this is to use flash with php... (A little unorthadox I know...).
the standard use of php and flash is to get flash files to call PHP files, however, you can make flash movies dependant on external data, (this is how they make flash graphs). so you can control things on a Pixel based thing... I'm not sure how you'd go about importing external pictures. perhaps this is something you could ask a 'flash person' about -I'm not all that hot on flash...

another choice is that you could have the pictures generated by GD on a different server, and then just included with regular HTML image tags...
__________________

__________________
I didn’t fight my way to the top of the food chain to be a vegetarian…
Im sick of people saying 'dont waste paper'. If trees wanted to live, they'd all carry guns.
"The inherent vice of capitalism is the unequal sharing of blessings; The inherent vice of socialism is the equal sharing of miseries."
root is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off



All times are GMT -5. The time now is 06:12 AM.


Powered by vBulletin® Version 3.8.8 Beta 4
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO 3.6.0