Jump to content
php.lv forumi

courage

Reģistrētie lietotāji
  • Posts

    39
  • Joined

  • Last visited

Posts posted by courage

  1. <TD class=navigation align=middle><A 
    		onmouseover="MM_swapImage('Poga','','pic/butt/bilde2.png',1)" 
    		onmouseout=MM_swapImgRestore() 
    		href="/index.php"><IMG 
    		src="pic/butt/bilde2.png" 
    		border=0 name=Poga></A></TD>

  2. Lieta tada: es meginu uztaisit script kurs pec mouseover maina bildi. Ka navigacija, kas stav piemeram bilde1.gif un kad peliti novirza uz tas bildes vina mainas uz bilde2.gif! Es dazus scriptus dabuju ,bet vini nestrada tiklidz ielieku otro pogu tad abas pogas nemainijas. Ludzu ielieciet script kurs strada !!

  3. Es nezinu ar ko lai saak jo vienu reizi esmu redzejis sadu lietu. Meginasu tagad vinu atstastit un izstastit savu saapi. Kad pavirza kursoru uz piemeram kadu tekstu tad izlec zem teksta tads logs un vina ir piemeram bilde. To es zinu ka uztaisit, bet man vaig tur ieksa dabut PHP scriptu. Ideja tada: es velos izveidot mazu lapu ar server query un uzliekot kursoru uz piemeram cik speletaji ir serveri, izlektu tas logs ara un paraditu. Man jau ir vis sariktets ar pasu query, bet trukst tikai tas scripts tas kas izsviedis ara to logu.

  4. atklaju kad trukst viens mazs kodins! pie bildes nav neka kas vinu samazina

     

    <textarea cols="75" rows="4" readonly name="htmlcode" size="120" value=""></textarea>

     

    pie value nav neka! kads zin kadam kodam butu jabut tur?

  5. Sveiki, es censos uztaisit tadu lietu kad lapa ir kada bilde un uzspiezot kadu noteiktu pogu varetu samazinat bildi. kods kuru esmu uzlicis:

    <select OnChange="Update();" name="size">
    <option value="0" selected>Pilns izmers</option>
    	<option value="0" selected>Mazais izmers</option>
    </select>

     

    un javascript kas updato izmerus

     

    <script language="javascript">
    
    var user;
    var bg;
    var size;
    
    var mpimage_url;
    
    function Update()
    {
    if (!document.getElementById) return true;
    
    var username_elem = document.forms['f'].username;
    user = username_elem.value;
    
    var background_elem = document.forms['f'].background;
    bg = background_elem.value;
    
    var size_elem = document.forms['f'].size;
    size = size_elem.value;
    
    var mpimage = document.getElementById('mpimage');
    mpimage.src="http://sh.cf.lv/pstag/" + bg + "wID=" + size + "" + user + ".jpg";
    var link_elem = document.getElementById('mpimage_link');
    link_elem.href = "http://sh.cf.lv/stats/player.php?id=" + user;
    
    var mpimage_test = document.getElementById('mpimage_test');
    mpimage_test.src="http://sh.cf.lv/pstag/" + bg + "wID=" + "137" + ".jpg";
    
    
    var width;
    var height;
    
    width = 550;
    height = 150;
    
    if (size == 1)
    {
    	width = 277;
    	height = 63;
    }
    
    if (size == 2)
    {
    	width = 450;
    	height = 34;
    }
    
    if (size == 3)
    {
    	width = 149;
    	height = 29;
    }
    
    
    var htmlcode_elem = document.forms['f2'].htmlcode;
    htmlcode_elem.value = "<a href=" + link_elem.href + "><img src=" + mpimage.src + " width=" + width + " height=" + height + "></a>";
    
    
    var bbcode_elem = document.forms['f3'].bbcode;
    bbcode_elem.value = "[url=" + link_elem.href + "][img=" + mpimage.src + "][/url]";
    
    return true;
    }
    
    </script>

     

    esmu sho script nozadzis tapec nebrinaties kad nezinu :)

  6. es esmu tads iesacejs ar php bet es nesaprotu.... http://80.70.31.185/pstag/ps_tag.php?wID=137 dazi zin kas tas ir bet tie kuri nezin pateiksu. ta ir bildes formata statistika(mainiga) bet kapec vins man negrib radit?

     

    <?php
    
    include ("config.inc.php");
    
    //-------------------------------------------------------------
    //This function was taken from the PS2 by StormTrooper
    function compacttime($seconds, $format="hh:mm:ss") {
    $d = $h = $m = $s = "00";
    if (!isset($seconds)) $seconds = 0;
    $old = $seconds;
    $str = $format;
    if ( (strpos($str, 'dd') !== FALSE) && ($seconds / (60*60*24)) >= 1)  { $d = sprintf("%d", $seconds / (60*60*24)); $seconds -= $d * (60*60*24); }
    if ( (strpos($str, 'hh') !== FALSE) && ($seconds / (60*60)) >= 1)	 { $h = sprintf("%d", $seconds / (60*60)); $seconds -= $h * (60*60); }
    if ( (strpos($str, 'mm') !== FALSE) && ($seconds / 60) >= 1)		  { $m = sprintf("%d", $seconds / 60); $seconds -= $m * (60); }
    if ( (strpos($str, 'ss') !== FALSE) && ($seconds % 60) >= 1)		  { $s = sprintf("%d", $seconds % 60); }
    $str = str_replace('dd', sprintf('%02d',$d), $str);
    $str = str_replace('hh', sprintf('%02d',$h), $str);
    $str = str_replace('mm', sprintf('%02d',$m), $str);
    $str = str_replace('ss', sprintf('%02d',$s), $str);
    return $str;
    }
    //-------------------------------------------------------------
    
    function imagettftextalign($image, $size, $angle, $x, $y, $color, $font, $text, $alignment='L') {
      //check width of the text
      $bbox = imagettfbbox ($size, $angle, $font, $text);
      $textWidth = $bbox[2] - $bbox[0];
      switch ($alignment) {
       case "R":
    	   $x -= $textWidth;
    	   break;
       case "C":
    	   $x -= $textWidth / 2;
    	   break;
      }
    
      //write text
      imagettftext ($image, $size, $angle, $x, $y, $color, $font, $text);
    
    }
    //--------------------------------------------------------------
    
    //Get the player information and the player id which will be used on the other queries
    $wID = $_GET['wID'];
    $result_main =  mysql_query("SELECT plrid, name, totaluses FROM pstats_plrids WHERE worldid='" . $wID . "' ORDER BY totaluses DESC");
    if (!$result_main) { die("ERR:" . mysql_error()); }
    while ($row = mysql_fetch_array($result_main)) 
    {
    $playerName = $row[1];
    $playerID = $row[0];
    //mysql_free_result($result);
    
    $result =  mysql_query("SELECT rank, skill FROM pstats_plr WHERE plrid=" . $playerID);
    if (!$result) { die("ERR:" . mysql_error()); }
    $row = mysql_fetch_row($result);
    $playerRank += $row[0];
    $playerSkill += $row[1];
    mysql_free_result($result); 
    
    //Fills the information 
    $result = mysql_query("SELECT kills,deaths,killstreak,deathstreak,shots,hits,games,rounds,plrconnects,onlinetime FROM pstats_plrdata WHERE plrid=".$playerID);
    if (!$result) { die("ERR:" . mysql_error()); }
    while ( $row = mysql_fetch_array($result)) 
    {
    	//On the right side
    	if ($row[4]>1) { $playerAcc = round(($row[5]*100)/$row[4],2); }
    	$playerKills += $row[0];
    	$playerDeaths += $row[1];
    	// Kill and Death streak are only from the last game
    	$playerKStrk = $row[2];
    	$playerDStrk = $row[3];
    	//On the left side
    	$playerGames += $row[6];
    	$playerRounds += $row[7];
    	$playerConnects += $row[8];
    	$playerT += $row[9];
    }
    $playerTOnline = compacttime($playerT,"hh:mm:ss");
    mysql_free_result($result);
    
    //Get the weapon which the player has most kills 
    $result = mysql_query("SELECT kills,weaponid FROM pstats_plrweapons WHERE plrid=".$playerID." ORDER BY kills DESC");
    if (!$result) { die("ERR:" . mysql_error()); }
    $row = mysql_fetch_row($result);
    $weaponID = $row[1];
    mysql_free_result($result);
    
    $result = mysql_query("SELECT plrid,weaponid,kills,deaths,damage,headshots,shots,hits FROM pstats_plrweapons WHERE plrid='".$playerID."' AND weaponid='" . $weaponID ."'");
    if (!$result) { die("ERR:" . mysql_error()); }
    //$row = mysql_fetch_row($result);
    while ( $row = mysql_fetch_array($result)) 
    {
    	$weaponKills += $row[2];
    	$weaponDeaths += $row[3];
    	$weaponDamage += $row[4];
    	$weaponHeadShots += $row[5];
    	$weaponShots += $row[6];
    	$weaponHits += $row[7];
    }
    // Some times weaponShots is being returned as 0
    if ($weaponShots < 1)
    {
    	$weaponAcc = "ERROR";//$weaponShots;
    }
    else
    {
    	$weaponAcc = round(($weaponHits*100)/($weaponShots),2); 
    }
    mysql_free_result($result);
    
    //Get the weapon name from the weapon ID;
    $result = mysql_query("SELECT name FROM pstats_defs_weapons WHERE id='".$weaponID."'");
    if (!$result) {die("ERR:" . mysql_error()); }
    $row = mysql_fetch_row($result);
    if ($weaponName == NULL) { $weaponName = $row[0]; }
    mysql_free_result($result);
    
    } //End loop to get the information of a STEAMID, for unkown reasons to me the same STEAMID can have multiple PlayerIDs
    
    // make sure gd and freetype are loaded; we need them for the signature image
    if (!extension_loaded("gd"))
    {
    echo "gd extension missing";
    exit();
    }
    
    if (!in_array("imagettftext", get_extension_funcs("gd")))
    {
    echo "FreeType extensions missing from gd";
    exit();
    }
    
    //Preares the source image and copies it to the final image
    $srcimage = @imagecreatefromjpeg(IMAGEPATH."/".IMAGEFILE);
    $src_x = imagesx($srcimage); $src_y = imagesy($srcimage);
    $finalimage = imagecreatetruecolor($src_x, $src_y);
    imagecopy ($finalimage, $srcimage, 0, 0, 0, 0, $src_x, $src_y);
    
    /*
    To instert images into the image use:
      $<desc_name> = @imagecreatefrom[type] ( <path> );
      imagecopy ($finalimage, $<desc_name>, <dst_x>, <dst_y>, <src_x>, <src_y>, imagesx($<dsc_name>)-1, imagesy($<dsc_name>-1);
    */
    
    //$fgcolor = imagecolorallocate($finalimage, 239,163 ,015); //Define the color of the TEXT to used in the image
    $fgcolor = imagecolorallocate($finalimage, FONTCOLOR_R, FONTCOLOR_G, FONTCOLOR_B); //Define the color of the TEXT to used in the image
    
    //Information on the left side
    imagettftext($finalimage, FONTSIZE, 0, 115, 15, $fgcolor, FONTFILE, "Player Name: ".$playerName);
    imagettftext($finalimage, FONTSIZE, 0, 115, 27, $fgcolor, FONTFILE, " - Rank:".$playerRank);
    imagettftext($finalimage, FONTSIZE, 0, 115, 39, $fgcolor, FONTFILE, " - Skill: ".$playerSkill);
    imagettftext($finalimage, FONTSIZE, 0, 115, 51, $fgcolor, FONTFILE, " - Games/Rounds: ".$playerGames."/".$playerRounds);
    imagettftext($finalimage, FONTSIZE, 0, 115, 63, $fgcolor, FONTFILE, " - Connects: ".$playerConnects);
    imagettftext($finalimage, FONTSIZE, 0, 115, 75, $fgcolor, FONTFILE, " - Time online: ".$playerTOnline);
    //imagettftext($finalimage, FONTSIZE, 0, 370, 125, $fgcolor, FONTFILE, "");
    
    //Information on the right side
    imagettftext($finalimage, FONTSIZE, 0, 260, 27, $fgcolor, FONTFILE, "Kills: ".$playerKills);
    imagettftext($finalimage, FONTSIZE, 0, 260, 39, $fgcolor, FONTFILE, "Deaths: ".$playerDeaths);
    imagettftext($finalimage, FONTSIZE, 0, 260, 51, $fgcolor, FONTFILE, "Kill Streak: ".$playerKStrk);
    imagettftext($finalimage, FONTSIZE, 0, 260, 63, $fgcolor, FONTFILE, "Death Streak: ".$playerDStrk);
    imagettftext($finalimage, FONTSIZE, 0, 260, 75, $fgcolor, FONTFILE, "Accruacy: ".$playerAcc."%");
    
    //Weapon Statistics
    //imagettftext($finalimage, FONTSIZE, 0, 115, 87, $fgcolor, FONTFILE, "Mostly skilled with");
    imagettftext($finalimage, FONTSIZE, 0, 115, 87, $fgcolor, FONTFILE, "Weapon  Kills  Deaths  Damage  Accruacy  HS");
    
    $weapon = @imagecreatefromgif(WEAPONIMAGES.$weaponName.".gif");
    imagecopy ($finalimage, $weapon, 120,89,0,0,imagesx($weapon),imagesy($weapon));
    imagettftextalign($finalimage, FONTSIZE, 0, 175, 99, $fgcolor, FONTFILE, $weaponKills,"C");
    imagettftextalign($finalimage, FONTSIZE, 0, 209, 99, $fgcolor, FONTFILE, $weaponDeaths,"C");
    imagettftextalign($finalimage, FONTSIZE, 0, 255, 99, $fgcolor, FONTFILE, $weaponDamage,"C");
    imagettftextalign($finalimage, FONTSIZE, 0, 305, 99, $fgcolor, FONTFILE, $weaponAcc."%","C");
    imagettftextalign($finalimage, FONTSIZE, 0, 339, 99, $fgcolor, FONTFILE, $weaponHeadShots,"C");
    
    header('Content-Type: image/jpeg');
    imagejpeg($finalimage, '',100);
    
    ?>

     

     

     

    http://www.the-rota.com/pstag/rota_tag.php?wID=137 <-- piemers kads izskatas

×
×
  • Create New...