Comunidad de diseño web y desarrollo en internet online

Encriptado de contraseña php-mysql

Citar            
MensajeEscrito el 26 Feb 2010 04:58 am
Tengo un cliente que tiene un servidor de un Juego Online (World of Warcraft), usa base de datos mysql.

El problema es que la base de datos encripta la contraseñas en un formato que desonosco.

Contraseña:
admin18

Contraseña encriptada:
C7EC859E3F4D5095A858DEF80C408B2649190C94

Que metodo de encriptado usa y como tendria que quedar esta parte del codigo de la web de registro? (para que agregue las claves encriptadas)

//insertar datos en la base de datos
$query = mysql_query("INSERT INTO account (username , sha_pass_hash, email)
VALUES('$cuenta', ACA QUE TENDRIA QUE PONER PARA QUE SE ENCRIPTE? , '$email')") or die(mysql_error());

Datos:
Tabla: account
Columna de nombre de usuario: username
Columna de clave encriptada: sha_pass_hash
Columna de email: email

Desde ya muchas gracias

Por remix90

11 de clabLevel



 

chrome
Citar            
MensajeEscrito el 26 Feb 2010 05:19 am
Usa la funcion MD5 para realizar el encryptado

Por bucle_infinito

Claber

166 de clabLevel

1 tutorial

 

.NET Developer

firefox
Citar            
MensajeEscrito el 26 Feb 2010 05:26 am
$query = mysql_query("INSERT INTO account (username , sha_pass_hash, email)
VALUES('$cuenta', md5'clave' , '$email')")

asi no?

Por remix90

11 de clabLevel



 

chrome
Citar            
MensajeEscrito el 26 Feb 2010 05:34 am
despues de responder me di cuenta..

asi seria

//insertar datos en la base de datos (.remi8.)
$clave2 = md5 ( $clave );
$query = mysql_query("INSERT INTO account (username , sha_pass_hash, email)
VALUES('$cuenta', '$clave2', '$email')") or die(mysql_error());

pero sigue sin reconocer las contraseñas :S

Por remix90

11 de clabLevel



 

chrome
Citar            
MensajeEscrito el 26 Feb 2010 06:42 am
Mas bien parece una cadena generada con SHA1 (tiene 40 caracteres, mientras que md5 solo genera 32).

Por DriverOp

Claber

2510 de clabLevel



 

opera
Citar            
MensajeEscrito el 26 Feb 2010 04:41 pm
ya intente con los siguientes metodos y ninguna sirve:

Md5
Sha1
based64encode

este tema me esta rompiendo la cabeza, lo peor es que no puedo desencriptar la DB porque tendría que hacer un cambio completo del servidor y eso se va de mis manos, solo me contrataron para diseñarles una web.

otra cosa, también use strtoupper() para que genere el código encriptado en mayúsculas, ya que en la DB aparecen todas las pass (las que funcionan) en mayúsculas.

Y ACA DEJO UN CODIGO DE UNA WEB PRE DISEÑADA QUE ENCONTRE EN SAN GOOGLE

Código :

<?php
/* 
   SPORA  v1.4.4.1
   Simple Page Of Registration of Accounts for MangOs
     heavy updated by (c) Vladonix at gmail dot com - last changes 26.03.2008
       please, read my changelog below, read HowToInstall.txt and configuration_example.txt

   It is made in the form of one page with fields of input of the 
   information of an account and the list of players being on a server.
   
   Configuration of all options of main page can be done from second - config page.
 
   14.09.2006      http://pomm.da.ru/
   
   Created by mirage666 (c) (mailto:[email protected] icq# 152263154)
        ####################################################################
        SPORA The Burning Crusade Edition Build V1.4.2 on SPORA 

        
  *     17.09.2007              http://www.powerlogy.net/
        !Turkey Rulaz!
        
  Vladonix's changelog:
  *     12.03.2008              (c) vladonix at gmail dot com
                                all messages to array
                                test format email (must be @, ., min. 6 characters)
                                test username and password - min. 4 chars and can't be equal
                                style - .error class color changed to white (#fff)
                                all tags with small letters
                                slovak translation (all texts)
                                translated races, classes and ranks - ONLY Slovak
                                slovak button (blank button for other translations - without text - added too)
                                added &copy; signs ;-) 
                                whole script dies after unsuccessful DB connection (You can comment it, if you want)
                                changed error() function - html head and foot added - DB errors a bit concrete, I think
                                added 'back' link after successful acount creation
                                coding of this script changet to UTF-8
                                deleted ifif function - replaced with ?: operator
                                information box width changed to 230
                                switch field in plr_array - valid sort on page
                                added sql files to create test database (without running mangos), see 'HOW to test' in HowToInstall.txt
        
   *    13.03.2008              (c) vladonix at gmail dot com   
                                added !!!simple!!! shoutbox to right side of the main page - AJAX based ;-), NO IFRAMES USED!
                                  to activate it, set $show_board varialble to 1 (in configuration.php),   
                                  create file minichat00.txt in main roSpora directory and set its permissions to 666 (everyone read/write)
                                  used AJAX - don't refresh page with F5
                                aded new texts   
                                updated style.css       
                                updated HowToInstall.txt
                                                                                         
   *    15.03.2008              (c) vladonix at gmail dot com
                                configuration.php splited to two files - configuration.php and lang.php
                                  if you want translate roSPORA, translate only lang.php
                                lang.php - added default switch (is en)
                                main page - added link to WEBconfig page (bottom)
                                created WEBconfig administration page - allows to configure roSPORA from WEB
                                  configuration.php is now generated by script => original copied to example with descriptions
                                updated HowToInstall.txt
                                new images -> new buttons (EN, SK only)
                                updated style.css - design of shoutbox to page theme (idea thanks BirdMan fom MangOS Forum)
                                added JS to count message characters (idea thanks BirdMan fom MangOS Forum)
                                tags <? renamed to <?php (idea thanks WarBlade fom MangOS Forum)
                                   
   *    17.03.2008              (c) vladonix at gmail dot com
                                correct display characters ' and " in messages (need more test) (idea BirdMan)
                                information (left side of main page) added to WEB config (idea BirdMan)
                                allow set messages separator in WEB config (idea BirdMan)
                                added new label about using F5 (do not use F5!) (idea BirdMan)
                                removed leading space from messages label (if time is empty) (idea BirdMan)
                                word LogOut added to translation
                                administrator can set own nick an IP address from WEB config (* means allowed acces from all IPs) (idea BirdMan)
                                option to change auth. file storage (sha1_datas.php) in WEB config
                                added warning to change config datas - password, files, ...
                                style.css - changed border of important fields in Web config to red - displayed on WEB config page
                                updated HowToInstall.txt             
                                       
   *    18.03.2008              (c) vladonix at gmail dot com
                                added simple pool (idea Birdman)
                                added new images (b_yes, b_no, pool)
                                changed information font-style
                                removed some <font> tags
                                removed server time if server is down (idea BirdMan)
                                translated JavaScript's day name shortcuts (only SK)
                                updated HowToInstall.txt
                                changed HTML in administration.php - page is W3C valid now
                                
   *    19.03.2008              (c) vladonix at gmail dot com
                                added logs
                                buttons on WEBconfig moved to top -> on bottom are logs displayed   
                                updated HowToInstall.txt
                                
   *    20.03.2008              (c) vladonix at gmail dot com
                                updated HTML code in index.php
                                removed animated object - added only gif with rotating logo (idea BirdMan)
                                updated style.css - design of main page
                                username in users table capitalized
                                username now stored in account table uppercase (X3eon - Mangos Changelog)
                                added race dranei to alliance (idea X3on)
                                added option to restrict not registered users to write to shoutbox (idea X3on)
                                shoutbox name - 16 chars
                                WEBconfig admin's ip address - 15 chars
                                new log descriptions
                                added configuration option to hide/display information box
                                 
   *    22.03.2008              (c) vladonix at gmail dot com
                                new vote - up to 9 questions
                                index.php - updated HTML code
                                WebConfig logs - added colors and mysql_error
                                pages passed W3C validation test (html, css)
                                          
   *    24.03.2008              (c) vladonix at gmail dot com
                                smaler gif (BirdMan)
                                options - Burning Crusade, Classic Wow (Birdman)
                                quotes and backslash error in shoutbax again :(
                                new color for success account creation in WebConfig log
                                
   *    25.03.2008              (c) vladonix at gmail dot com
                                optional email - option in WEBConfig - new label displayed on main page (idea  Revenger)    
                                updated php code in index.php
                                
   *    26.03.2008              (c) vladonix at gmail dot com
                                added ajax to online players table (idea Princ3dan) - refresh time can be set from WEBConfig 
                                some functions moved to lang.php
                                created dblayer.php with only mysql functions
                                fooret moved to lang.php and translated (SK only)    
                                updated all (php, txt, css) files 

   *    02.04.2008              (c) vladonix at gmail dot com
                                added map (online players)
                                updated error with html ahref tag in information (bad " formatting) (idea Revenger)             
                                                                  
        TODO                    cut max message proper (after last message)
                                captcha (?)
                                ak je log.php len na citanie a prazdny, nezobrazy EMPTY hlasku
                                testuj vsetky hodnoty na isset v administracii a testuj maximalne a minimalne hodnoty, prip ich strlen() 
                                
        NOTE                    tested SK and EN language on ManGOS core 5394, SD2 286, UDB 5242+patches on WXPSP2 IE6.0.2900 and Mozilla Firefox 2.0.0.6
                                MySQL 5.0.45, Apache 2.2.6, Php 5.2.5
                                actualized demo page: http://rospora.php5.sk/
        
                                 
        !!!  to translate, update lang.php (slovak and english is done)   !!!
        !!! carefully read HowToInstall.txt and configuration_example.php !!!
      
   *               

*/
define('roSSECURE',true);                   // tested in configuration file - change

define('CFG_FILE', "configuration.php");    // configuration file - change name

require_once(CFG_FILE);     // main configuration - included must be first, becouse there is defined variable $lang used in lang.php
require_once('lang.php');   // translations + contains function to write log, do not remove!
include_once('dblayer.php');// database manipulating class (methods)

$realm_up = 0;              // is realm up?

function test_realm(){
   global $server, $port;

   $s = @fsockopen("$server", $port, $ERROR_NO, $ERROR_STR,(float)0.5);
   if($s){@fclose($s);return true;} else return false;
}

function get_account_c($name = '')
{
   global $hostr, $userr, $passwordr, $dbr, $database_encoding, $text;
   
   $result = array();
   
  $realm_db = new DBLayer($hostr, $userr, $passwordr, $dbr, $text);
   $realm_db->query("SET NAMES ".$database_encoding);

  $query = $realm_db->query("SELECT * FROM `account` WHERE `username`='".$name."'");
  
  if ($query)
     $result = $realm_db->fetch_assoc($query);
    
   $realm_db->close();
   unset($realm_db);
   
   return ($result['username']);
}

function get_realm_uptime() {
   global $host, $user, $password, $db, $database_encoding, $text;
   
   $mangos_db = new DBLayer($host, $user, $password, $db, $text);
   $mangos_db->query("SET NAMES ".$database_encoding);
   $query = $mangos_db->query("SELECT * FROM `uptime` ORDER BY `starttime` DESC");
   $result = $mangos_db->fetch_assoc($query);
   $mangos_db->close();
   unset($mangos_db);
   return($result['starttime']);
}

function check_email($email = '')
{
  global $cfg_mail_need;
  
  $pattern = "^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$";
  
  if (!$cfg_mail_need)
    return 1;
  
  if (strlen($email) < 6)
    return 0;
     
  if (!eregi($pattern, $email))
    return 0;
    
  return 1;
}

if (empty($_POST['username']) and empty($_POST['passw']) and empty($_POST['email'])) 
{
   $cont='<TR>
           <TD><IMG src="'.$img_base.'pixel.gif" width=25 alt="">
           </TD>
           <TD vAlign=middle align=left>
             <div
             style="FONT-SIZE: 8pt; COLOR: white; LETTER-SPACING: 3px; FONT-VARIANT: small-caps">
               <LABEL>'.$text["name"].':</LABEL>&nbsp;
             </div>
             <INPUT class="old" id=username style="WIDTH: 175px" tabIndex=1 maxLength=16 size=18 name=username>
           </TD>
           <TD><IMG src="'.$img_base.'pixel.gif" width=1 alt="">
           </TD>
         </TR>
         <TR>
           <TD>&nbsp;</td>         
           <TD vAlign=middle align=left width=190>
             <div style="FONT-SIZE: 8pt; COLOR: white; LETTER-SPACING: 3px; FONT-VARIANT: small-caps">
               <LABEL>'.$text["password"].':</LABEL>
             </div>
             <INPUT class="old" id=passw  style="WIDTH: 175px" tabIndex=2 type=password maxLength=12 size=18 name=passw>
           </TD>
           <TD>&nbsp;</td>           
         </TR>
         <TR>
           <TD>&nbsp;</td>         
            <TD vAlign=middle align=left width=190>
              <DIV style="FONT-SIZE: 8pt; COLOR: white; LETTER-SPACING: 3px; FONT-VARIANT: small-caps">
                <LABEL>'.$text["tbc"].':</LABEL>
              </div>
              <select size="1" name="tbc">
                 <option selected value="1">Burning Crusade</option>
                 <option value="0">Classic WoW</option>
              </select>
            </TD>
           <TD>&nbsp;</td>            
         </TR>
         <TR>
           <TD>&nbsp;</td>         
           <TD vAlign=middle align=left width=190>
             <div style="FONT-SIZE: 8pt; COLOR: white; LETTER-SPACING: 3px; FONT-VARIANT: small-caps">
               <LABEL>E-mail: '.($cfg_mail_need?'':('('.$text['label_optional'].')')).'</LABEL>
             </div>
             <INPUT class="old" id=email style="WIDTH: 175px" tabIndex=4 maxLength=50 size=18 name=email>
           </TD>
           <TD>&nbsp;</td>           
         </TR>
         <TR>
           <TD>&nbsp;</td>
           <TD colspan=2 align=left>
                <INPUT class=button  
                         style="WIDTH: 168px; HEIGHT: 39px" tabIndex=5 type=image 
                         alt="Create" src="'.$img_base.$button.'" 
                         value="Create">
            </TD>
           
         </TR>';
} 
elseif  (empty($_POST['username']) or empty($_POST['passw']) or  ($cfg_mail_need  &&  empty($_POST['email'])) ) 
{

   $cont = '
         <TR>
           <TD rowSpan=6><IMG width=1 src="'.$img_base.'pixel.gif" alt="">
           </TD>
           <TD align=Center>
             <SMALL class=error>'.$text["not_all"].'<br><br><a href="" onClick="history.go(-1)">'.$text["backtext"].'</a>
             </SMALL>
          </TD>
        </TR>';
}
else
{
   $username = htmlspecialchars(trim($_POST['username']));
   $passw = trim($_POST['passw']);
   $email = htmlspecialchars(trim($_POST['email']));
  $tbc = trim($_POST['tbc']);
   $ip = $_SERVER['REMOTE_ADDR'];

  if (!check_email($email)) {  // bad format!
        $cont='<TR><TD rowSpan=6><IMG width=1 src="'.$img_base.'pixel.gif" alt=""></TD><TD align=Center><SMALL class=error>
          '.$text['bad_email'].'<br><br><a href="" onClick="history.go(-1)">'.$text["backtext"].'</a></SMALL></TD></TR>';
  }
  else if (!strcasecmp($username, $passw)) { // same strings!
        $cont='<TR><TD rowSpan=6><IMG width=1 src="'.$img_base.'pixel.gif" alt=""></TD><TD align=Center><SMALL class=error>
          '.$text['same_strings'].'<br><br><a href="" onClick="history.go(-1)">'.$text["backtext"].'</a></SMALL></TD></TR>';
  }
  else if (strlen($username) < 4  ||  strlen($passw) < 4) {  // too short!!!
        $cont='<TR><TD rowSpan=6><IMG width=1 src="'.$img_base.'pixel.gif" alt=""></TD><TD align=Center><SMALL class=error>
          '.$text['short_strings'].'<br><br><a href="" onClick="history.go(-1)">'.$text["backtext"].'</a></SMALL></TD></TR>';
  }
   else {
     $realm_db = new DBLayer($hostr, $userr, $passwordr, $dbr, $text);
     $realm_db->query("SET NAMES ".$database_encoding);

    $ip_cr=0;
    if ($lock_reg != 0){
      $query = $realm_db->query("SELECT `last_ip` FROM `account`  WHERE `last_ip`='".$ip."'");
      while($result = $realm_db->fetch_assoc($query)) $ip_cr++;
    }

    if (($ip_cr >= $lock_reg) && ($lock_reg!=0))
    {
      write_log("3", $username, "Exceed limit from IP ".$ip);
        $cont='<TR><TD rowSpan=6><IMG width=1 src="'.$img_base.'pixel.gif" alt=""></TD><TD align=Center><SMALL class=error>
            '.$text["ip_limit"][0].$ip.'<br>'.$lock_reg.$text["ip_limit"][1].'
            <br><br><a href="" onClick="history.go(-1)">'.$text["backtext"].'</a></SMALL></TD></TR>';
     } else
     {
       if (empty($email)) $email = "[email protected]";
       

        {
      write_log("3", $username, "");        
        $cont='<TR><TD rowSpan=6><IMG width=1 src="'.$img_base.'pixel.gif" alt=""></TD><TD align=Center><SMALL>
            '.$text["acc"].'<br><strong>'.$username.'</strong><br>'.$text["create"].'<br>
             <br><a href="" onClick="history.go(-1)">'.$text["backtext"].'</a>
             </SMALL></TD></TR>';
        }
        else
        {
        $sqlerr = $realm_db->error();
      write_log("4", $username, $sqlerr['error_msg']);        
        $cont='<TR><TD rowSpan=6><IMG width=1 src="'.$img_base.'pixel.gif" alt=""></TD><TD align=Center><SMALL class=error>
        '.$text["acc"].'<br><strong>'.$username.'</strong><br>'.$text["failed"].'
         <br><br><a href="" onClick="history.go(-1)">'.$text["backtext"].'</a></SMALL></TD></TR>';
        }
    }
     $realm_db->close();
     unset($realm_db);
  }
}

$pl_array = make_players_array(0);
$onlineplayers = count($pl_array);

// works nice too
//if (!($sort = &$_GET['s'])) $sort=0;
//if (!($flag = &$_GET['f'])) $flag=0;

  $sort=0;
  $flag=0;
  
  if (!empty($_GET['s'])) $sort = $_GET['s'];
  if (!empty($_GET['f'])) $flag = $_GET['f'];  


if ($flag == 0)   {   $flag = 1 ; $sort_type = '<'; } 
else   {   $flag = 0; $sort_type = '>'; }

$link="index.php?f=".$flag."&amp;s=";

if (!empty($pl_array)) {
   usort($pl_array, create_function('$a, $b', 'if ( $a['.$sort.'] == $b['.$sort.'] ) return 0; if ( $a['.$sort.'] '.$sort_type.' $b['.$sort.'] ) return -1; return 1;'));
}

$list="";
$i=0;
while ($i < $onlineplayers)
   {
   $name=$pl_array[$i][0];
   $race=$pl_array[$i][1];
   $class=$pl_array[$i][2];
   $res_race = $def['character_race'][$race];
   $res_class = $def['character_class'][$class];
   $lvl=$pl_array[$i][3];
   $loc=$pl_array[$i][5];
   $gender=$pl_array[$i][6];
   $type=$pl_array[$i][7];
   $rank=$pl_array[$i][4];

   if(strcasecmp($rank,"01") != 0 and strcasecmp($rank,"00") != 0){
      $res_rank = $def['character_rank'][$type][$rank];
   }
   else{
      $res_rank = $text['NoRank'];
   }
   
   $list.= "
            <tr class=txt>
               <td style=\"text-align:left\"><span class=\"txt\" style=\"text-transform:capitalize;\">".strtolower($name)."</span></td>
               <td align='center'><img alt=\"".$res_race."\" src='".$img_base.$race."-".$gender.".gif' height='18' width='18'></td>
               <td align='center'><img alt=\"".$res_class."\" src='".$img_base.$class.".gif' height='18' width='18'></td>
               <td align='center'>"."unknown"."</td>
               <td style=\"text-align:center\"><img alt=\"".$res_rank."\" src='".$img_base."rank".$rank.".gif' height='18' width='18'></td>               
               <td style=\"text-align:left\">".$loc."</td>
            </tr>";
   $i++;
   }

$title = get_realm_name();
$copyright = $status = $title;

if ($realm_up = test_realm())   {
   $title.= (' ('.$onlineplayers.' '.$text["playerson"].')');
   $status = "<img alt=\"Online\" src='".$img_base."online.gif' height='18' width='18'>";
} else {
   $title.= (' '.$text["off"] );
   $status = "<img alt=\"Offline\" src='".$img_base."offline.gif' height='18' width='18'>";
}
   
// Main part !!!
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
  <head>
    <title><?php print $title ?></title>
    <meta http-equiv="Cache-Control" content="no-cache,must-revalidate">
    <meta http-equiv=Content-Type content="text/html; charset=<?php print $charset ?>">
    <link href="<?php print $img_base ?>style.css" type="text/css" rel=stylesheet>
    <link rel="Shortcut Icon" href="img/wowlogoanim.gif" type="image/gif">

</head>

<body onLoad="onloadTimers();">
  <div style="position:absolute;width:200px;z-index:1;top:10px;left:10px;background-image:url('<?php print $img_base ?>back_create2.png'); border:#000000 solid 1px;" id="information">
<?php
  if ($cfg_show_info) {
    echo "
  <div style=\"text-align:center;margin:10px 0px 10px 0px\">
    <span style=\"color:#f00;font: bold 11px verdana, Arial, Sans-serif;\">".$text['info_label']."</span>
  </div>
  <div style=\"color:#cc9; font: normal 9px verdana, Arial, Sans-serif;\">".$information."</div>";
  }
  
  if ($show_map) {
    echo "
  <div style=\"text-align:center;margin:10px 0px 10px 0px\">
    <span style=\"color:#f00;font: bold 11px verdana, Arial, Sans-serif;\">".$text['map_label']."</span>
    <div style=\"margin:10px;\">
      <a href=\"mapa.php\"><img src=\"".$img_base."small_map.jpg\" border=0></a>
    </div>
  </div>";
  
  }
  
function pool_write_vote($ip = '', $vote = 0)
{
  global $cfg_pool_file;
  
  if (@is_file($cfg_pool_file)) {
    $fc = @file_get_contents($cfg_pool_file);
    
    $to_write = $fc."<? // ".time()." ".$ip." ".$vote." ?>\n";
    
    @file_put_contents($cfg_pool_file, $to_write);
  }
}

function pool_search_ip($ip = '')
{
  global $cfg_pool_file;

  if (@is_file($cfg_pool_file)) {
    $fc = @file($cfg_pool_file);
    
    for ($i = 1; $i < count($fc); $i++) {  // 0 is question
      $fe = explode(" ", $fc[$i]);
      if (count($fe) > 3  &&  !strcasecmp($fe[3], $ip))
        return true;  // found
    }
  }
  else
    return true;      // file error
  
  return false;       // not found
}
    
  $pool_n = array(1 => 0, 0, 0, 0, 0, 0, 0, 0, 0);  
  if ($cfg_pool_show == 1  &&  strlen($cfg_pool_q)  &&  @is_file($cfg_pool_file)) {
    $pool_c = @file($cfg_pool_file);
  
    if ($pool_c !== FALSE  &&  count($pool_c)) {
      // write new vote, if is set - check ip
      if (isset($_GET['pool_vote'])  &&  !pool_search_ip($_SERVER['REMOTE_ADDR']))
        pool_write_vote($_SERVER['REMOTE_ADDR'], $_GET['pool_vote']);

      $pool_c = @file($cfg_pool_file);  // read again
      
      for ($i = 1; $i < count($pool_c); $i++) {
        $fexp = explode(" ", $pool_c[$i]);
        
        if (count($fexp) > 4) {
          if ($fexp[4] > 0  &&  $fexp[4] < 10)   // max and min value
            $pool_n[$fexp[4]]++;
        }
      } 
    }
    else {  // empty file, write question
      $to_write = "<?php // ".$cfg_pool_q." ?>\n";
      @file_put_contents($cfg_pool_file, $to_write);    
    }
    
    $pall = array_sum($pool_n);
    
    // show pool
    
    echo "
  <div style=\"text-align:center;margin:30px 0px 10px 0px\">
    <span style=\"color:#f00;font: bold 11px verdana, Arial, Sans-serif;\">".$text['pool_label']."</span>
  </div>
  <div style=\"text-align:left;\">
    <span style=\"font: bold 11px verdana, Arial, Sans-serif;\">".$cfg_pool_q."</span>
  </div>
  
  <div style=\"text-align:left;margin:10px 0px 10px 0px\">
      <table>";
      
    $pp = 0;
    for ($f = 1; $f < $cfg_pool_answers + 1; $f++) {
      $pname = "cfg_pool".$f;
      if ($pall > 0)
        $pp = $pool_n[$f]/$pall;
        
      echo "
        <tr>
          <td colspan=2>
           <span style=\"color:#cc9;font: bold 11px verdana, Arial, Sans-serif;vertical-align:middle;\">
             <a href=\"index.php?f=".(!$flag)."&amp;s=".$sort."&amp;pool_vote=".$f."\">".(isset(${$pname})?${$pname}:"???")."</a>
            </span>
          </td>
        </tr>
        <tr>
          <td width=110>
            <img style=\"border: 1px solid #FFAC04\" src=\"".$img_base."pool.bmp\" height=\"11\" width=\"".($pp*100)."\" alt=\"".$f."\">
          </td>
          <td>
            <span style=\"color:#cc9;font: bold 9px verdana, Arial, Sans-serif;vertical-align:middle;\"> 
               ".$pool_n[$f]." (".intval($pp*100)."%)
            </span>
          </td>
        </tr>";
    }
    
    echo "    
      </table>
    </div>";
  
  }
  ?>
</div>

<?php
// very simple message board and its functions - allow in configuration.php -> set variable $how_board to 1 ($show_board=1;) 
function read_msgs()
{
  global $msg_file;
  
  if (@is_file($msg_file))
    return @file_get_contents($msg_file);
  else
    return "## Error to open chat file!";
}

function write_msgs($content = '')
{
  global $msg_file;
  
  if (@is_file($msg_file))
    @file_put_contents($msg_file, $content);
}

// little security
function control_content($text)
{
  global $msg_max_long_word;
  
  $badnames = array("fuck", "suck", "pussy", "dick", "blow", "chuj", "pica", "jeba", "kokot", "cums");  // add other ;-)
  $temp_text = strtolower($text);
  
  // bad names ;)
  for ($i = 0; $i < count($badnames); $i++) {
    if (strstr($temp_text, $badnames[$i])) 
      return "";
  }
  
  // ssss aaaa dddd - bad words
  if (strlen($temp_text) > 3) {
    for ($i = 0; $i < (strlen($temp_text) - 3); $i++) {
      if ($temp_text[$i] == $temp_text[$i+1]  &&  $temp_text[$i] == $temp_text[$i+2]
          &&  $temp_text[$i] == $temp_text[$i+3])
        return "";
     }
   } 
   
  // too long words > 35? characters
  $t_arr = split("[\.,!?:\';@\" ]", $temp_text);
//   print_r($t_arr);
  for ($i = 0; $i < count($t_arr); $i++) {
    if (strlen($t_arr[$i]) > $msg_max_long_word) 
      return "";
  }
  
  return $text;
} 

// test registered players
function test_registered($username = '')
{
  global $msg_reg_only;
  
  // no need
  if (!$msg_reg_only)
    return true;
    
  // bad nickname
  if (!strlen($username))
    return false;
    
  if (!strcasecmp($username, get_account_c($username)))
    return true;
   
  return false;
}

  if ($show_board  &&  is_file($msg_file)) {
    $t_minichat = $t_allmsgs = read_msgs();
    $msg_nick = "";
    
    if (!empty($_POST['nick'])) {
      $msg_nick = substr(trim(strip_tags(htmlspecialchars($_POST['nick']))), 0, 13);
      
      // user uses admins nick from bad ip address - only simple check (* - acces from all IPs)
      if (!empty($_POST['tamsg'])  &&  test_registered($msg_nick) 
           &&  (strcasecmp($msg_nick, $cfg_admin_nick)  
                || (!strcasecmp($msg_nick, $cfg_admin_nick)  &&  !strcasecmp($cfg_admin_ip, "*"))
                || (!strcasecmp($msg_nick, $cfg_admin_nick)  &&  !strcasecmp($_SERVER['REMOTE_ADDR'], $cfg_admin_ip)) ) ) {
        // remove old messages from end - depends on $msg_max_num 
        if (strlen($t_allmsgs) > $msg_max_num) {
          $t_allmsgs = substr($t_allmsgs, 0, $msg_max_num);            // cut      
        }

        // edit sended message string    
        $t_minichat = trim(strip_tags(htmlspecialchars($_POST['tamsg'], ENT_NOQUOTES)));         // strip all tags, spaces atc

        // replace \' and \" - add other strings        
        $tfind = array('\\\'', '\\"', '\\\\');
        $treplace = array('\'', '"', '\\');
        $t_minichat = str_replace($tfind, $treplace, $t_minichat);
         
        if (strlen($t_minichat) > $msg_max_length)                          // too long - maximum is $masg_max_length
          $t_minichat = substr($t_minichat, 0, $msg_max_length);            // cut
        
        // content of message control 
        $t_minichat = control_content($t_minichat);

        if (strlen($t_minichat)) {
          $separr = "";
          $leadate = "";
                
          if (strlen($msg_separator))
            $separr = $msg_separator."\n";
            
          if (strlen(strftime($msg_time_format)))
            $leadate = strftime($msg_time_format)." ";
             
          $t_minichat = $leadate.$msg_nick.": ".$t_minichat."\n".$separr.$t_allmsgs;
          write_msgs($t_minichat);
          flush();
        }
        else
          $t_minichat = $t_allmsgs;
      }
    }
    
    echo"

<div style=\"position:absolute;width:220px;z-index:2;right:10px;top:10px;text-align:center;background-image:url('./img/back_create2.png'); border:#000000 solid 1px;\" id=\"msgboard\">
  <form action=\"index.php?f=".(!$flag)."&amp;s=".$sort."\" method=post enctype=\"multipart/form-data\">
    <div style=\"text-align:center\">
      <strong>
        <font face=\"Arial\" color=\"#FFFFFF\" size=\"2\">".$text['board_label']."</font>
      </strong>
      <div style=\"font-family:sans-serif;font-size:9px;color:#FFFFFF\">".$text['msg_refresh']." ".($msg_refresh/1000)." sec.</div>
      <div style=\"font-family:sans-serif;font-size:9px;color:#FFFFFF\">".$text['msg_no_F5']."</div>";
      if ($msg_reg_only) {
        echo "<div style=\"font-family:sans-serif;font-size:9px\">".$text['msg_no_all_user']."</div>";
      }
    echo "            
    </div>
    <div>
      <textarea name=\"allmsgs\" id=\"allmsgs\" cols=\"24\" rows=\"".$msg_big_ta_length."\" readonly class=\"ta_black\">".$t_minichat."</textarea>
    </DIV>

    <div style=\"padding:10px; text-align:left\">
      <span style=\"font-family:sans-serif;font-size:11px;color:#FFFFFF\">".$text['char'][0]."</span>
      <input type=\"text\" name=\"nick\" id=\"nick\" class=\"iblack0\" value=\"".$msg_nick."\" maxlength=\"16\">
      <span style=\"font-family:sans-serif;font-size:11px;color:#FFFFFF\">".$text['obligate']."</span>      
    </div>
  
    <div>
      <div>
        <textarea name=\"tamsg\" id=\"tamsg\" rows=4 cols=\"24\" class=\"ta_black_little\"  
         onKeyDown=\"CountLeft(this.form.tamsg,this.form.leftt,".$msg_max_length.");\"  
         onKeyUp=\"CountLeft(this.form.tamsg,this.form.leftt,".$msg_max_length.")\"></textarea>
      </div>
      <div style=\"font-family:sans-serif;font-size:11px;text-align:left;padding:15px;color:#FFFFFF\">
        <input class=\"old\" readonly type=\"text\" name=\"leftt\" size=3 maxlength=3 value=\"".$msg_max_length."\"> ".$text['msg_chars']."
      </div>
      <div style=\"margin-top: 10px\">
        <INPUT class=button style=\"width:130px;height:31px\" tabIndex=10 type=image 
               alt=\"Send\" title=\"Send\" src=\"".$img_base.$send_b."\" value=\"Send\">
            <br><br>
      </div>
    </div>
  </form>  
</div>";
}
?>


<form method=post <?php echo "action=\"index.php?f=".(!$flag)."&amp;s=".$sort."\""; ?> enctype="multipart/form-data">
  <table cellSpacing=0 cellPadding=0 width="100%" border=0>
    <tbody>
    <tr>
      <td align=center>
      <table  align=center  cellSpacing=0 cellPadding=0  border=0 style="background-image:url('<?php print $img_base ?>back_create.png');background-repeat:no-repeat;">
        <tbody>
        <tr>
          <td>&nbsp;</td>
          <td vAlign=top align=center>
            <div style="height:105px;width:250px;border:0px solid;padding-top:50px;">
            <img src="<?php print $img_base ?>wowlogo011.png" alt="WoW">
            </div>
          </td>
          <td>&nbsp;</td>          
        </tr>
        <tr>
          <td><img src="<?php print $img_base ?>pixel.gif" width=180 alt=""></td>
          <td align=center>
              <table cellSpacing=2 cellPadding=0  border=0 style="height:210px">
               <tbody>
<?php  
    if($accountoption==1)
    {
      echo"$cont"; 
    }
    else
    {
    echo "
      <TR>
        <TD><div>
            <div><IMG src=\"".$img_base."exclamation.gif\" alt=\"\"><div>
            </div>
            <div  style=\"margin:5px;\">
              <span style=\"font: bold 12px Verdana,Arial,Sans-serif;color:red\">".$text['accountmessage']."</span>
            </div>
        </TD>
      </TR>";
    }
?>
            </tbody>
          </table>
        </td>
        <td><img height=1 src="<?php print $img_base ?>pixel.gif" width=217 alt="">
        </td>
      </tr>
      <tr>
        <td colSpan=3 align=left>
          <table cellSpacing=0 cellPadding=0 border=0>
            <tbody>
            <tr>
              <td colSpan=3><img height=17 src="<?php print $img_base ?>pixel.gif" width=1 alt="">
              </td>
            </tr>
            <tr>
              <td width=99><img height=1 src="<?php print $img_base ?>pixel.gif" width=99 alt="">
              </td>
              <td width=410 >
                   <div style="margin:20px 0;">
                  <center><strong class=title><small><?php print "$status";echo "&nbsp;"; print "$title";?>
                  </small></strong></center>
                </div>
                <div  style="margin:20px 0;">
                <center><small><?php print $text['timetext']?>&nbsp;:&nbsp;</small>
                  <span id="timecontainer"></span>

             <script type="text/javascript">
               new showLocalTime("timecontainer", "server-php", 0, "short")
             </script><small>
          <?php
if ($realm_up) {
  $upsince = get_realm_uptime();
  $gettime = (time() - $upsince);
  $days = floor($gettime / (24 * 3600));
  $gettime = $gettime - ($days * (24 * 3600));
  $hours = floor($gettime / (3600));
  $gettime = $gettime - ($hours * (3600));
  $minutes = floor($gettime / (60));
  $gettime = $gettime - ($minutes * 60);
  $seconds = $gettime;

  $days = ($days == 1 ? ($days.$text['lday']['sing']) : ($days.$text['lday']['plu']));
  $hours = ($hours == 1 ? ($hours.$text['lhour']['sing']) : ($hours.$text['lhour']['plu']));
  $minutes = ($minutes == 1 ? ($minutes.$text['lminute']['sing']) : ($minutes.$text['lminute']['plu']));
  $seconds = ($seconds == 1 ? ($seconds.$text['lsecond']['sing']) : ($seconds.$text['lsecond']['plu']));

  echo'<br><strong>'.$text['srvUptime'].'</strong>' . $days . ' ' . $hours . ' ' . $minutes . ' ' . $seconds;
  echo'<br><strong>'.$text['upSince']. date('l. F jS, Y. h:i a', $upsince).'</strong>';
}
?>
                </small>
                </center>
                
                </div>
<!-- ajax table!!! - must be same with ajax table in php -->                
                <div name="plrtable" id="plrtable">   

                <table cellpadding='3' cellspacing='0' align='center' border=0 style="background-image:url('<?php print $img_base ?>back_create2.png');background-repeat:repeat-y;background-position:center;">
                  <tbody>
                  <tr class=title>
                       <td align='left' nowrap='nowrap' width=60><a href="<?php print $link.'0">'.$text['char'][0]?></a></td>
                       <td align='center' nowrap='nowrap' width=40><a href="<?php print $link.'1">'.$text['char'][1]?></a></td>
                       <td align='center' nowrap='nowrap' width=40><a href="<?php print $link.'2">'.$text['char'][2]?></a></td>
                       <td align='center' nowrap='nowrap' width=40><a href="<?php print $link.'3">'.$text['char'][3]?></a></td>
                       <td align='center' nowrap='nowrap' width=100><a href="<?php print $link.'4">'.$text['char'][4]?></a></td>
                       <td align='left' nowrap='nowrap' width=100><a href="<?php print $link.'5">'.$text['char'][5] ?></a></td>         
                   </tr>
   
<?php  
    if ($onlineoption == 1) {
      echo"$list"; 
    }
    else {
      echo "<tr>
              <td colspan=6><center><strong><font face=\"Arial\" color=\"#FF0000\" size=\"2\"><br>".$text['onlinemessage']."</font></strong></center>
              </td>
            </tr>";
    }
    echo "
            <tr class=txt>
               <td colspan=6 style=\"text-align:center;padding-top:20px;\">".$text['last_refresh'].": ".strftime("%d.%m.%Y  %H:%M:%S")." (".($cfg_ptable_refresh/1000)." sec.)<br><br></td>
             </tr>";
    
?>
                  </tbody>
                </table>
                </div>

              </td>
              <td width=124><img height=1 src="<?php print $img_base ?>pixel.gif" width=124 alt="">
              </td>
            </tr>
            <tr>
              <td colSpan=3><img height=100 src="<?php print $img_base ?>pixel.gif" width=1 alt="">
              </td>
            </tr>
            </tbody>
          </table>
        </td>
      </tr>
      </tbody>
    </table>
    
    
    </td>
  </tr>
  </tbody>
</table>
</form>
<?php
//Please Dont Edit This Copyright Lines , Respect To Our Work
foorat($copyright); 
?>

</body>
</html>

Por remix90

11 de clabLevel



 

chrome

 

Cristalab BabyBlue v4 + V4 © 2011 Cristalab
Powered by ClabEngines v4, HTML5, love and ponies.