Jump to content

skatermike21988

Members
  • Posts

    100
  • Joined

  • Last visited

    Never

Posts posted by skatermike21988

  1. Ok here's my problem.

     

    I use simplexml_load_file to load the following xml file:

    http://xboxapi.duncanmackenzie.net/gamertag.ashx?GamerTag=cerebal%20asassin

     

    The file is dynamic and constantly changing and for my purpose I use simple_xml quite frequently. Now when it loads and pulls the data, on the following run it will still pull the same data even though the file has changed and can be noted in a web browser that it has. Is there any way to avoid simple_xml from caching the loaded file?

     

    EDITED: mispelled the function, woops :)

  2. Okay, then replace any spaces with %20 instead:

     

    <?php
    $gamertag = str_replace(' ', '%20', $gamertag);
    ?>

    You are awesome, that worked perfect! thank you so much, I finnally have it working! Thank you again. I could have sworn I tried that before, but I guess not. :/

     

    You can see the final output in my original post.

  3. You're using the GD library functions without checking them for values returned. A lot of the function will return a boolean true or false and it doesn't seem like you're checking to see if anything has failed.

     

    actually as far as the avatar goes i do have it check, if it fails it'll show a blank avatar, but i removed that to actually see why it's failing, the code i have to check it is:

     

    <?php
    if(!$avatar = ImageCreateFromPNG($avatarurl);
    ) {
    $avatar = ImageCreateFromPNG("unknown.png");
    }
    ?>

     

  4. sorry about the tags, but um right now i don't have it using the part to actually d/l it but the line

     

    <?php
    $avatar_url = "http://avatar.xboxlive.com/avatar/$gamertag/avatar-body.png";
    
    
    $avatar = ImageCreateFromPNG($avatarurl);
    
    imagecolortransparent($avatar, imagecolorallocate($avatar, 0, 0, 0));
    imagecopyresampled($image,$avatar, 170, 0, 0, 0, $new_width, $new_height, $width, $height);
    ?>

     

    is where the errors at, now the code I was using to download is:

     

    <?php
    // this must be done somehow how you want
    $avgamer= md5($gamertag);
    $filename = "$avgamer.png";
    
    if(!@copy("http://avatar.xboxlive.com/avatar/$gamertag/avatar-body.png",$filename))
    {
        $errors= error_get_last();
        echo "COPY ERROR: ".$errors['type'];
        echo "<br />\n".$errors['message'];
    } else {
        echo "File copied from remote!";
    }
    ?>

    and is located in xbox.php

     

    this here is of a image without a space copied: http://xboxpremiumthemes.com/gamercard/0a33a2f1a7fd4eaeff8528050057dc68.png

     

    and this is of one with a space copied: http://xboxpremiumthemes.com/gamercard/542346437efbf663b5bcc5d2e669fa2f.png

     

    sorry if its still confusing, I just got home from work and am tired, just that this has been driving me batty for weeks :(

  5. Ok I am having this weird problem, I am using gd to create an xbox live gamercard, the gamercard include the users xbox live avatar. Like so here:

     

    semesic.png

     

    Now the url to get the avatar is:

     

    http://avatar.xboxlive.com/avatar/PERSONS GAMERTAG HERE/avatar-body.png

     

    Now in the above image the users gamertag is semesic and doesn't contain any spaces, but if for say my gamertag which is cerebal asassin where used gd returns an error and does so for any gamertag with a space in it. saying that the image is not a valid png, I have tried copying the file to my site but then when I view just the copied image i get:

     

    "The image “http://xboxpremiumthemes.com/gamercard/1e242025290787daf9cc9f682b0a11c5.png” cannot be displayed, because it contains errors."

     

    but when the same image is viewed on xbox site it's fine. Also I can copy over the avatars that don't have a space with no problems. I don't seem to know why. It's starting to drive me nuts.

     

    My gamercard looks like this because it can't get the avatar.

     

    Cerebal%20Asassin.png I hope I didn't make any of this super confusing. :/

     

    Here is my code:

     

    Imagecreate.php:

    <?
    
    //THESE FILES GET XBOX LIVE DATA, THIS ALL WORKS FINE
    include'gamercard1.php';
    //XBOX RETRIEVE SCRIPT
    include'cache.php';
    
    mysql_connect("localhost", "evenlame_site", "skater2") or die(mysql_error());
    mysql_select_db("evenlame_site") or die(mysql_error());
    
    $query = 'SELECT * FROM `users`';
    
    $result = mysql_query($query) or die('Cannot get data.'.mysql_error());
    
    while ($row = mysql_fetch_assoc($result)) {
    
    $gamertag=$row["gamertag"];
    include'xbox.php';
    
    if($xml->State=="Unknown") {
    $error="1";
    }
    if($xbox_service_error=="true") {
    $error="1";
    }
    
    createthumb('card.png','tn_av.png',$gamertag,$Info,$Zone,$gamerscore,$AccountStatus,$gamerpic,$Games,$online,$error);
    
    
    
    }
    
    

     

    Then here's gamercard1.php

     

    <?
    
    function createthumb($name,$filename,$gamertag,$Info,$Zone,$gamerscore,$AccountStatus,$gamerpic,$Games,$online,$error){
    if($error!="1") {
    
    
    $image = imagecreatetruecolor(290, 168);
    $image=imagecreatefrompng($name);
    imagesetthickness ( $image, 5 );
    $Info=wordwrap($Info,25);
    
    $white = imagecolorallocate($image, 255, 255, 255); 
    
    if($AccountStatus=="Gold") {
    $gccolor= imagecolorallocate($image, 255, 226, 104); 
    }
    elseif($AccountStatus=="Silver"){
    $gccolor= imagecolorallocate($image, 185, 185, 185); 
    }
    $gamerscore = number_format($gamerscore);
    
    $font = 'comicbd.ttf'; // Set the TTF font we want to use
    // This is just a variable set, which we will later use in the imagettftext funciton
    
    $gamertag_fontsize = "15"; // Set the size of the font we want to use
    $fontsize = "8"; // Set the size of the font we want to use
    $fontsize2 = "12"; // Set the size of the font we want to use
    // This again is just a variable like above. 
    
    
    list($width, $height) = getimagesize($name);
    
      
      $percent = 0.6;
    $new_width = $width * 1;
    $new_height = $height * 1;
    
    /////////////////////////////////
    ////////////////////////////////
    //THIS PART HERE COMES UP WITH ERRORS ONLY FOR GAMERTAGS WITH A SPACE, I HAVE TRIED ADDING %20 IN PLACE OF THE SPACE WITH NO LUCK 
    ////////////////////////////////
    
    
    //add the avatar
    $avatar_url = "http://avatar.xboxlive.com/avatar/$gamertag/avatar-body.png";
    
    
    $avatar = ImageCreateFromPNG($avatarurl);
    
    imagecolortransparent($avatar, imagecolorallocate($avatar, 0, 0, 0));
    imagecopyresampled($image,$avatar, 170, 0, 0, 0, $new_width, $new_height, $width, $height);
    
    
    
    
    ////////////////////
    ///////////////////
    //EVERYTHING ELSE BELOW WORKS LIKE IT IS SUPPOSED TO
    
    //add the gamerpic
    $gamerpic = ImageCreateFromPNG($gamerpic);
    imagecolortransparent($gamerpic, imagecolorallocate($gamerpic, 0, 0, 0));
    imagecopyresampled($image,$gamerpic, 10, 9, 0, 0, 64, 64, 64, 64);
    
    //make gamerpic apper 3d'ish
    $gamerpictop = ImageCreateFromPNG('gamertagcover.png');
    imagecolortransparent($gamerpictop, imagecolorallocate($gamerpictop, 0, 0, 0));
    imagecopyresampled($image,$gamerpictop, 10, 9, 0, 0, 64, 64, 64, 64);
    
    $gamesy=10;
    //DO THE MATH FOR THE GAMES:
    $numgames=count($Games);
    if($numgames<=4){
    $numgames=$numgames-1;
    } else {
    $numgames="4";
    }
    
    for($i=0; $i<=$numgames; $i++){
    $gameimage=$Games[$i]->Game->Image32Url;
    $gameimage = ImageCreateFromJPEG($gameimage);
    imagecolortransparent($gameimage, imagecolorallocate($gameimage, 0, 0, 0));
    $gameimagecover = ImageCreateFromPNG('gamecover.png');
    imagecolortransparent($gameimagecover, imagecolorallocate($gameimagecover, 0, 0, 0));
    if($i!=0){
    $gamesy=$gamesy+38;
    }
    imagecopyresampled($image,$gameimage, $gamesy, 105, 0, 0, 32, 32, 32, 32);
    imagecopyresampled($image,$gameimagecover, $gamesy, 105, 0, 0, 32, 32, 32, 32);
    }
    if($online=="true") {
    $online = ImageCreateFromPNG('online.png');
    imagecolortransparent($online, imagecolorallocate($online, 0, 0, 0));
    imagecopyresampled($image,$online, 282, 13, 0, 0, 4, 25, 4, 25);
    }
    else
    {
    $offline= ImageCreateFromPNG('offline.png');
    imagecolortransparent($offline, imagecolorallocate($offline, 0, 0, 0));
    imagecopyresampled($image,$offline, 285, 13, 0, 0, 4, 25, 4, 25);
    }
    $membertype="$AccountStatus Member";
    //ADDS THE TEXT TO THE IMAGE
    imagefttext($image, $gamertag_fontsize, 0, 78, 25, $gccolor, $font, $gamertag); 
    imagefttext($image, $fontsize, 0, 78, 40, $white, $font, $Info); 
    imagefttext($image, $fontsize, 0, 115, 90, $white, $font, $Zone); 
    imagefttext($image, $fontsize, 0, 25, 90, $white, $font, $gamerscore); 
    imagefttext($image, $fontsize2, 0, 45, 155, $gccolor, $font, $membertype); 
    
    
    
    
    
    
    $filename="gamercardimages/$gamertag.png";
    
    imagepng($image,$filename); 
    imagedestroy($image); 
    }
    }
    

  6. well with the colors i'm trying to go with some xbox related colours. the dark gray header is from a popup when a friend is online, something finished downloading, an achievement unlocked etc. and the gold and silver are from the different types of xbox live accounts. gold for paying, silver for free. I do agreewith the font colors, just trying to figure out what would look attractive, but simple

  7. OK, I'm working on a new project. Here's a little description: When microsoft updated the xbox last month they upgraded the xbox dashboard themes also, for those that don't know what the dashboard is it is like your PC desktop, and the themes are like the background. Well they raised prices on said themes but there currently is no way possible to preview before you buy asides from googleing and digging through forum posts. So I'm making a site to provide users with screenshots. So I just registered my domain Saturday and have a basic layout. Of course I'll be doing some rearranging etc. But i want to know how people feel about the overall look of the site so far. It is currently only one page. So there are no links at the moment. My plan is to define a layout that's appealing before going onto functionality. Anyways here is the link. I appreciate all feedback.

     

    http://www.xboxpremiumthemes.com/site

  8. Hello everyone,

     

    I am creating a script that when a user signs up they have the option to input their xbox live gamertag.

     

    With the gamertag I pull their gamercard to display on their profile.

     

    Well I am trying to make a leaderboard that displays leaders by their gamerscore.

     

    So.. I have made a cron job that checks and gathers the required info and inserts it into the mysql which works fine. At the very end of the cron job I have it update their rank position which is where I am having the problem.

     

    The code looks like this for the update:

     

    $getrank = mysql_query("SELECT * FROM xboxleaderboard ORDER BY `gamerscore` DESC;");
    $rank=0;
    while($info = mysql_fetch_array( $getrank ))
    {
    
    $userid = $info['userid'];
    $rank=$rank+1;
    $updaterank = "UPDATE `xboxleaderboard` SET `rank` = '$rank' WHERE userid = '$userid'";
    $updaterankresult = mysql_query($updaterank);
    
    }
    

     

    the $rank adds fine but mysql is not pulling the data right

     

    my database looks like this:

     

    --------------------------------

    gamerscore| gamertag      | rank

    --------------------------------

    450          |skatermike219  | 1

    21922      |NeutralX2     |  3

    36607      |Gemini711     |  2

    ---------------------------------

     

    That's what it looks like after the script runs

     

    as you can see skatermike219 should not be ranked number 1

    and of course Gemini711 should not be ranked number 2

     

    it should be:

    --------------------------------

    gamerscore| gamertag      | rank

    --------------------------------

    450          |skatermike219  | 3

    21922      |NeutralX2     |  2

    36607      |Gemini711     |  1

    --------------------------------

     

    Any help appreciated this is really starting to bug me.

    Thanks

     

     

  9. I give it a 5/10.

     

    1) Some of the icons are very fuzzy.

    2) You have a "show links" tab or something once the user logs in that looks AWFUL.

    3) It doesn't play well at smaller resolutions (even 1024x768).

    4) There are places where you have boxes side by side and they're different sizes.

     

    It just doesn't look polished.

    1.)Had a hard time finding icons, but definately noted and will be replaced thanks.

    2.)I am horrible at photoshop :( so that will also be replaced.

    3.)Never did check it at smaller resolutions but I just did and I agree.

    4.)I know of only one place when you first login that the boxes are different sizes I will fix, but if you seen any more can you please inform me, thanks.

     

    I appreciate your oppinion and will take note of everything said. Thanks

  10. Hello,

     

    I have just finished making a customized whmcs template and would like to make sure everything works like it should.

     

    Here is the link:

     

    http://www.insta-hosting.com/custom/whmcs/

     

    If you would like to log in and view the members area here are demo details:

     

    USER: demo

    PASS: demo

     

    Here is how things should look:

     

    1.) Login box, navigation, and bread crumb should showup in the header.

     

    2.)When logged in, if javascript is enabled, when clicking show links, client links should drop down.

     

    Those are the main things I am looking to make sure are right. If you find any problems please post, when posting could you possibly include what browser you where using when the problem occured.

     

    Thanks everyone.

  11. I do agree with you all as far as the boxes, the corners are white because my background was white before, and I am in the works of coming up with something new for them, When refering to the javascript, it is when you click compare or view full feature list, or full price list, I thank you all for your critique, and it will help me make it better. Thank you.

     

    Also regarding the firefox message, that is there because I have noticed things act much different between the browsers, I do do a browser check and have the scripting change to suite the browser as much as possible.

  12. Hello all,

     

    I am working on a redesign of my current website and am wondering what everybody thinks of the progress.

     

    I have a few things I am mainly wanting critique on:

     

    1.)What do you thing of the new logo compared to the old one, does it blend better?

     

    2.)What do you think of the layout and colors compared to the old one?

     

    3.)If you have javascript enabled, what do you think of the way items are displayed with the javascript?

     

    4.)Is the site easy to navigate?

     

    Feel free to leave any other critique.

     

    **NOTE: the site is still not 100% functional so some links won't work, I am just wanting to know if I am going in the right direction as far as appealing to potential customers**

     

    Here is the before link:

    https://www.insta-hosting.com/index_current.shtml

     

    Here is the after link:

    https://www.insta-hosting.com/newsite/index.php

     

    If you wish to login to the client area and have a look around I have provided a demo login:

     

    Username: demo@insta-hosting.com

    Password: demo

     

    Thanks all, this will help me alot.

  13. Hello,

     

    I am needing to remove all data stored inbetween <style> and <script> tags; reason being is that my script communicates with my server, my server responds with html, well there is only a certain string of text that I need out of the response, and i use strip_tags() but that still leaves everything that was inside the tags. so i want to use regex to remove the data first and then strip_tags() to remove all the other html after the regex has removed the <style> and <script> data. Regex is something I never really understood, so any help is appreciated.

     

    Thanks,

     

    Mike

  14. you can use mysql and then an if statement like

    if($inuse=="yes") {
    echo"Sorry the file is currently in use, please try again later";
    }
    else
    {
    //DISPLAY DATA HERE
    }
    

     

    And then have like a cron job script run to where if the last time it was used was 10 mins ago or so, it clears the mysql, just incase the user exits his/her browser, and have a link to exit, so that way it clears the data.

     

    I know it sounds kinda confusing but I haven't been to sleep yet, so hope this helps

  15. Hello,

     

    It's been quite a while since I posted here, as I have been very busy, but anyways I have an issue with one of my scripts.

     

    I have a header file in which is included in all my pages. I have my server set up to parse .htm, .html, and .shtml files as php. Reason being I use frontpage and I can easily desing my page and just use includes for my php. That all works fine, except for one thing. I am trying to have session id passed through the url from my billing management system so it doesn't always show the login form in theheader when they are logged in, I can get the sid into the url and sent to my .htm etc. pages, but the $_GET[] isn't workign for some reason on those pages, so I am trying an alternative method. I wish to pull all the data out of the url and then strip it to get the sid, but since this is done via header.php, and not index.shtml (header.php is included in index.shtml) if I use php_self it returns header.php, $_SERVER['REQUEST_URI'] it also returns header.php etc. even though I am actually on the page index.shtl?sid=blahblahblah

     

    So my question is, how can I pull the ACTUAL url displayed in the address bar and not where the page is run?

     

    I have thought about putting it on index.shtml but the only ploblem is I am creating the header.php to avoid doing excessive editing of all my files to change one thing. Hope you all can understand this, I know its alot.

     

    Thanks in advance.

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