vBulletin,gender to avatar

来源:互联网 发布:2015淘宝客源码程序 编辑:程序博客网 时间:2024/06/13 23:16

<?php
 
require_once('./chat/flashchatconf/config.php');
require_once('./global.php');
require_once(DIR . '/includes/functions_bigthree.php');
require_once(DIR . '/includes/functions_forumlist.php');

$username = $vbulletin->userinfo[username];
$password = $vbulletin->userinfo[password];
$running_mode = 1;
if($running_mode == 2 &&(!isset($swfname) || !isset($init_host) || !isset($init_port) || !isset($init_group)))
{
    $client_location = 'http://'.str_replace('http://','',$client_location);
    $urlinfo = getHostParameters($client_location);
    $swfname = basename($urlinfo['path']);  
    parse_str($urlinfo['query']);
}

switch($running_mode)
{
    case 3:
        chat_free();
        break;
    case 1:
       
        $init_group = $chat_group;
        $init_host = $primary_server_host;
        $init_port = $primary_server_post;
        show_chat();
        break;
    case 2:
        show_chat();
        break;
}

function chat_free()
{
    global $room_name,$username,$client_size_width,$client_size_height;
    echo pageheader();
    echo ' <div style="width:728px;height:20;margin:0">
            <table width="728"><tr>
            <td class="menu" align="right">
            <a href="" target="_blank">Remove Ads</a>&nbsp;|&nbsp;
            <a href="" target="_blank">Admin Panel</a>&nbsp;|&nbsp;
            <a href="" target="_blank">Free Flash Chat Server Software</a>
            </td>
            </tr></table>
            </div>
            <script language="javascript" src="http://test.com';
    if ($room_name == '')
        echo $_SERVER['HTTP_HOST'];
    else
        echo rawurlencode($room_name);
   
    if (!empty($username))
        $user_name = '&user='.rawurlencode($username);
       
    echo '&width='.$client_size_width.'&height='.$client_size_height.$user_name.'"></script>';
                            echo pagefooter();
}


function show_chat()
{
    global $client_location,$swfname,$init_host,$init_port,$init_group,$my,$width,$height,$username, $password, $vbulletin, $avatar_sex, $usersex;

  $avatar_sex[man][0] = "blueman";
  $avatar_sex[man][1] = "orangeman";
  $avatar_sex[woman][0] = "redwoman";
  $avatar_sex[woman][1] = "whitewoman";
 
  if ($usersex = $vbulletin->db->query_first("SELECT field5 FROM " . TABLE_PREFIX . "userfield WHERE userid in (select userid from " . TABLE_PREFIX . "user where username = '" . $vbulletin->db->escape_string(htmlspecialchars_uni($username)) . "')"))
  {
      if ($usersex[field5] = "Mann")
      {
          $usersex_id=rand(0,1);
          $avatar_sex = $avatar_sex[man][$usersex_id];   
          }
      elseif($usersex[field5] = "Frau")
      {
          $usersex_id=rand(0,1);
          $avatar_sex = $avatar_sex[woman][$usersex_id];
          }
          else
          {
              $usersex_id=rand(0,1);
            $avatar_sex = $avatar_sex[man][$usersex_id];   
              }

    }
    $swfurl = 'http://www.test.com/vb/client/avatarchat.swf';


    if(!empty($init_host)){
        $swfurl .= (strpos($swfurl,"?"))?"&init_host=".$init_host:"?init_host=".$init_host;
    }
    if(!empty($init_port)){
        $swfurl .= (strpos($swfurl,"?"))?"&init_port=".$init_port:"?init_port=".$init_port;
    }
    if(!empty($init_group)){
        $swfurl .= (strpos($swfurl,"?"))?"&init_group=".$init_group:"?init_host=".$init_group;
    }
    if(!empty($avatar_sex)){
        $swfurl .= (strpos($swfurl,"?"))?"&init_avatar=".$avatar_sex:"?init_avatar=".$avatar_sex;
    }
    if(!empty($username)){
        $swfurl .= (strpos($swfurl,"?"))?"&init_user=".rawurlencode($username):"?init_user=".rawurlencode($username);
    }
    if(!empty($password)){
        $swfurl .= (strpos($swfurl,"?"))?"&init_password=".rawurlencode($password):"?init_password=".rawurlencode($password);
    }
 
    echo pageheader();
    echo '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="100%" height="100%">';
    echo '<param name=movie value="'.$swfurl.'">';
    echo '<param name=quality value=high>' ;
    echo '<param name=menu value=false>';
    echo '<param name=scale value=noscale>';
    echo '<param name="allowScriptAccess" value="always" />';
    echo '<embed src="'.$swfurl.'" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="100%" height="100%" menu="false" scale="noscale" allowScriptAccess="always">';
    echo '</embed>';
    echo '</object>';
    echo pagefooter();
}

function getHostParameters($client_location)
{
    $content = @file_get_contents($client_location);
    if(!empty($content))
    {
        $pattern = '|var urlValue="(.*)"|U';
        preg_match($pattern, $content, $matches);
        if(!empty($matches[1]))
        {
            $url = $matches[1];
            $urlinfo = parse_url($url);
            return $urlinfo;
        }
        else
        {
            $pattern = '|PARAM NAME=movie VALUE="(.*)"|U';
            preg_match($pattern, $content, $matches);
            if(!empty($matches[1]))
            {
                $url = $matches[1];
                $urlinfo = parse_url($url);
                return $urlinfo;
            }
        }
        return false;
    }
}


function checkSlash($path)
{
        if(substr($path,-1,1) != "/" && !empty($path)){
            $path = $path."/";
        }
        return $path;
}

function pageheader()
{
        echo '<html>';
        echo '<head>';
        echo '<title>Gruftiradio Chat</title>';
        echo '</head>';
        echo '<body topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" scroll="no">';
}

function pagefooter()
{
        echo '</body>';
        echo '</html>';
}
?>

原创粉丝点击