Help me oh this script .

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Help me oh this script .

    Good day, I have a problem with the script, that I can not create more than 99 rooms here are printed cu. php code, I hope that someone can help
    PHP Code:
    <?php
    error_reporting(0);
    require_once"./includes/functions/gzip.php";
    include('start.php');
    include("config.php");
    include("./includes/".$ver."/banned");
    
    list($msec, $sec) = explode(chr(32), microtime());
    $headtime = $sec + $msec;
    $nocache = rand(1000, 9999);
    
    switch($ver)
    {
    case 'wml':
    ///////////////////////////////////////////////////////
    //WML VERSION
    ///////////////////////////////////////////////////////
    
    header("Content-type: text/vnd.wap.wml; charset=utf-8");
    header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
    header("Cache-Control: no-cache, must-revalidate");
    
    //AUTH
    $id = intval($_SESSION['id']);
    $password = mysql_escape_string($_SESSION['password']);
    $q = mysql_query("SELECT nickname FROM `chat_users` WHERE `id` = '".$id."' AND `password` = '".md5($password)."';");
        if(mysql_num_rows($q) == 0)
        {
        echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
        echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.3//EN\" \"http://www.wapforum.org/DTD/wml13.dtd\"><wml>\n";
        echo "<card title=\"ERROR\" ontimer=\"index.php?ver=wml\"><timer value=\"15\"/><p align=\"left\">\n";
        echo "<small>Authorization Failed!<br/>\n";
        list($msec, $sec) = explode(chr(32), microtime());
        echo "<br/>[".round(($sec+$msec)-$headtime,5)."] sec<br/>\n";
        echo "</small>";
        require_once "includes/functions/gzip_foot.php";
        echo "</p></card></wml>";
        ob_end_flush();
        exit();
        }
    
    //END AUTH
    
    
    echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
    echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.3//EN\" \"http://www.wapforum.org/DTD/wml13.dtd\">\n<wml>\n";
    
    echo "<head><meta http-equiv=\"Cache-Control\" content=\"no-cache\" forua=\"true\"/></head>\n";
    echo "<card id=\"index\" title=\"opcije\"><p align=\"left\">\n";
    
    echo "<!-- Developed by martin suvalj -->\n";
    
    $chat = file("chat.dat");
    $logo = trim($chat[0]);
    $message = trim($chat[1]);
    if(!empty($logo)) echo "<img src=\"http://$logo\" alt=\"\" /><br/>\n";
    if(!empty($message)) echo "$message<br/>\n";
    
    
    ///razglas
    //razglas
    
    
    
    $q = mysql_query("SELECT id,nickname,level,shoutbox,status,posts,time,ip,ua,security,fsize FROM `chat_users` WHERE `nickname` = '".$nickname."' AND `password` = '".md5($password)."' LIMIT 1;");
    $user = mysql_fetch_array($q);
    $uid = $user['id'];
    $nickname = $user['nickname'];
    $pass = $user['password'];
    $ip = $user['ip'];
    $ua = $user['ua'];
    $kick = $user['kick'];
    $moder = $user['moder'];
    $reason = $user['reason'];
    $name = $user['name'];
    $site = $user['site'];
    $sex = $user['sex'];
    $from = $user['from'];
    $mobile = $user['mobile'];
    $email = $user['email'];
    $birthday = $user['birthday'];
    $about = $user['about'];
    $posts = $user['posts'];
    $lev = $user['level'];
    $answers = $user['answers'];
    $gbalans = $user['gbalans'];
    $status = $user['status'];
    $regdate = $user['regdate'];
    $place = $user['place'];
    $photo_type = $user['photo'];
    $time = $user['time'];
    $mood = $user['mood'];
    $shoutbox= $user['message'];
    
            
    echo "Room:<br/>\n";
    echo "Obrati paznju na ime sobe, da soba sa takvim nazivom vec ne postoji i da ne krsi uslove koristenja chata<br/>\n";
    echo "<br/>";
    
    if(!isset($_POST['action']))
    {
    echo "ime sobe:<br/>\n";
    echo "<input name=\"name$nocache\" maxlength=\"15\" title=\"name\"/><br/>\n";
    echo "Position:<br/>\n";
    echo "<input name=\"position$nocache\" format=\"*N\" size=\"2\" maxlength=\"2\" title=\"position\"/><br/>\n";
    $type = '3';
    echo "<anchor>[Kreiraj]<go href=\"create_my_room.php?nocache=$nocache&amp;ver=wml&amp;".SID."&amp;mod=addroom\" method=\"post\">\n";
    echo "<postfield name=\"name\" value=\"$(name$nocache)\"/>\n";
    echo "<postfield name=\"position\" value=\"$(position$nocache)\"/>\n";
    
    echo "<postfield name=\"action\" value=\"$(add$nocache)\"/>\n";
    echo "</go></anchor><br/>\n";
    }
    else
    {
    $type = '3';
    $mid = $id;
    $name = trim(mysql_escape_string(htmlspecialchars($_POST['name'])));
    $name = str_replace('$', '$$', $name);
    if(empty($name))
    {
    echo "Niste unijeli ime sobe!<br/>\n";
    break;
    }
    
    
    $position = intval($_POST['position']);
    if($postion < 0) $postion = 0;
    if($postion > 100) $postion = 100;
    $type = intval($_POST['type']);
    if($type < 0) $type = 0;
    if($type > 2) $type = 0;
    $q = mysql_query("SELECT `name` FROM `chat_rooms` WHERE `name` = '".$name."';");
    
    if(mysql_affected_rows() != 0)
    {
    echo "Soba sa takvim imenom vec postoji.<br/>\n";
    break;
    }
    
    $q = mysql_query("SELECT COUNT(*) FROM `chat_rooms`;");
    $result = mysql_result($q, 0);
    
    if($result > 25)
    {
    echo "Too many established rooms!<br/>\n";
    break;
    }
    
    $sql = mysql_query("INSERT INTO `chat_rooms` VALUES(0, '".$name."', '".$position."', '".$name."', '".$type."', '".$mid."');");
    $room = mysql_insert_id();
    $sql = mysql_query("CREATE TABLE `chat".$room."` 
    (
      `id` int(10) unsigned NOT NULL auto_increment,
      `aid` int(11) NOT NULL default '0',
      `nickname` tinytext NOT NULL,
      `msg` text NOT NULL,
      `to` int(11) NOT NULL default '0',
      `time` tinytext NOT NULL,
      `seconds` int(11) unsigned NOT NULL default '0',
      PRIMARY KEY  (`id`)
    ) TYPE=MyISAM ;");
    
        if($sql)
        {
        echo "Room successfully created!<br/>\n";
    
        if($type == 3) echo "<a href=\"mroom.php?".SID."&amp;ver=wml&amp;rid=$room\">The room</a><br/>\n";
        }
        else
        {
        echo "Error.<br/>\n";
        echo mysql_error();
        }
    }echo "<br />\n";
    echo "<a href=\"rooms.php?".SID."&amp;ver=wml\">Chat Sobe:</a><br/>\n";
    echo "<a href=\"menu.php?".SID."&amp;ver=wml&amp;nocache=$nocache\">Livechat meni</a><br/>\n";
    list($msec, $sec) = explode(chr(32), microtime());
    echo "<small>[".round(($sec + $msec) - $headtime, 5)."]</small><br/>\n";
    require_once "includes/functions/gzip_foot.php";
    echo "</p></card></wml>";
    ob_end_flush();
    break;
    
    case 'html':
    ///////////////////////////////////////////////////////
    //HTML VERSION
    ///////////////////////////////////////////////////////
    
    $my_title = "rom admin";
    if(!isset($_COOKIE['theme'])) $_COOKIE['theme'] = 1;
    include_once "themes/".intval($_COOKIE['theme'])."/index.php";
    //AUTH
    $id = intval($_SESSION['id']);
    $password = mysql_escape_string($_SESSION['password']);
    $q = mysql_query("SELECT nickname FROM `chat_users` WHERE `id` = '".$id."' AND `password` = '".md5($password)."';");
        if(mysql_num_rows($q) == 0)
        {
        echo "Authorization Failed!<br/>\n";
        include_once "themes/".intval($_COOKIE['theme'])."/foot.php";
        exit();
        }
    //END AUTH
    $nik = mysql_result($q, 0);
    $user = mysql_fetch_array($q);
    $mid = $user['id'];
    $nickname = $user['nickname'];
    $pass = $user['password'];
    $ip = $user['ip'];
    $ua = $user['ua'];
    $kick = $user['kick'];
    $moder = $user['moder'];
    $reason = $user['reason'];
    $name = $user['name'];
    $site = $user['site'];
    $sex = $user['sex'];
    $from = $user['from'];
    $mobile = $user['mobile'];
    $email = $user['email'];
    $birthday = $user['birthday'];
    $about = $user['about'];
    $posts = $user['posts'];
    $lev = $user['level'];
    $answers = $user['answers'];
    $gbalans = $user['gbalans'];
    $status = $user['status'];
    $regdate = $user['regdate'];
    $place = $user['place'];
    $photo_type = $user['photo'];
    $time = $user['time'];
    $mood = $user['mood'];
    $shoutbox= $user['message'];
    
    
    echo "<!-- Developed by martin suvalj -->\n";
    
    $chat = file("chat.dat");
    $logo = trim($chat[0]);
    $message = trim($chat[1]);
    if(!empty($logo)) echo "<img src=\"http://$logo\" alt=\"\" /><br/>\n";
    if(!empty($message)) echo "$message<br/>\n";
    
    if(!isset($_POST['action']))
    {
    echo "<div class=\"form\">\n";
    echo "<form method=\"post\" action=\"create_my_room.php?nocache=$nocache&amp;ver=html&amp;".SID."&amp;mod=addroom\">\n";
    
    
    echo "napravi svoju sobu , budi siguran da ime sobe vec ne postoji!<br/>\n";
    
    echo "Title:<br/>\n";
    echo "<input name=\"name\" maxlength=\"15\" title=\"name\"/><br/>\n";
    echo "pozicija:<br/>\n";
    echo "<input name=\"position\" size=\"2\" maxlength=\"2\" title=\"position\"/><br/>\n";
    $type = '3';
    $mid = $id;
    
    echo "</select><br/>\n";
    echo "<input type=\"hidden\" name=\"action\" value=\"add\"/>\n";
    echo "<input type=\"submit\" value=\"Create\"/></form></div><br/>\n";
    }
    else
    {
    
    
    $name = trim(mysql_escape_string(htmlspecialchars($_POST['name'])));
    $name = str_replace('$', '$$', $name);
    if(empty($name))
    {
    echo "Prazan naziv sobe!<br/>\n";
    break;
    }
    $type = '3';
    $mid = $id;
    $position = intval($_POST['position']);
    if($postion < 0) $postion = 0;
    if($postion > 100) $postion = 100;
    $type = intval($_POST['type']);
    if($type < 0) $type = 0;
    if($type > 12) $type = 0;
    $q = mysql_query("SELECT `name` FROM `chat_rooms` WHERE `name` = '".$name."';");
    
    if(mysql_affected_rows() != 0)
    {
    echo "Zao nam je  naziv sobe sa takvim imenom vec postoji!<br/>\n";
    break;
    }
    
    $q = mysql_query("SELECT COUNT(*) FROM `chat_rooms`;");
    $result = mysql_result($q, 0);
    
    if($result > 1000)
    {
    echo "Zao nam je  trenutno ima Previse privatnih soba!<br/>\n";
    break;
    }
    
    $sql = mysql_query("INSERT INTO `chat_rooms` VALUES('()', '".$name."', '".$position."', '".$name."', '".$type."', '".$mid."');");
    
    $room = mysql_insert_id();
    
    $sql = mysql_query("CREATE TABLE `chat".$room."` 
    (
      `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
      `aid` int(11) NOT NULL default '0',
      `nickname` tinytext NOT NULL,
      `msg` text NOT NULL,
      `to` int(11) NOT NULL default '0',
      `time` tinytext NOT NULL,
      `seconds` int(11) unsigned NOT NULL default '0',
      PRIMARY KEY  (`id`)
    ) TYPE=MyISAM ;");
    
        if($sql)
        {
        echo "Soba uspijesno kreirana!<br/>\n";
        if($type = 3) echo "<a href=\"room.php?".SID."&amp;ver=html&amp;rid=$room\">udji u sobu</a><br/>\n";
    
        }
        else
        {
        echo "Error. greska s bazama podataka (izvjestaj je dolje)<br/>\n";
        echo mysql_error();
        }
    }
    
    
    echo "<br />\n";
    echo "<img src='ikone/line.jpg' alt='--'> <br/>\n";
    echo " <img src='ikone/chat.gif' alt='chat'>  <a href=\"rooms.php?".SID."&amp;ver=html\">Chat Sobe:</a><br/>\n";
    echo "<img src='ikone/calen.gif' alt='my'><a href=\"menu.php?".SID."&amp;ver=html&amp;nocache=$nocache\">LiveChat meni</a><br/>\n";
    include_once "themes/".intval($_COOKIE['theme'])."/foot.php";
    break;
    }
    ?>
    they give me this eroos : the tabele 'chat0' alredy exzist ... so where are problem ? ...help.. and thanks
    Last edited by metulj; 20.09.11, 18:18. Reason: use [ php ] tag [ / php ] for posting code

    #2
    post full script

    Comment


      #3
      change the int(2)id on chat_rooms SQL to a higher number

      eg:
      int(10)id

      or what ever name you are using for your auto-increasement

      P.s: Please Use [ PHP] [ /PHP] bb codes .... it makes it a lot easier to read
      Last edited by something else; 19.09.11, 16:54.

      Comment


        #4
        Its because unsigned. Change like this in both versions.
        PHP Code:
        $sql = mysql_query("CREATE TABLE `chat".$room."` 
         (
         `id` int(10) NOT NULL AUTO_INCREMENT,
         `aid` int(11) NOT NULL default '0',
         `nickname` tinytext NOT NULL,
         `msg` text NOT NULL,
         `to` int(11) NOT NULL default '0',
         `time` tinytext NOT NULL,
         `seconds` int(11) unsigned NOT NULL default '0',
         PRIMARY KEY (`id`)
         ) TYPE=MyISAM ;"); 
        
        The rest is on your own bro.
        <!DOCTYPE html PUBLIC "-//WAPFORUM.RS

        Comment


          #5
          $room = mysql_insert_id();

          gets the last sql insert id which is set to the auto-increation

          so in this case its:
          $sql = mysql_query("INSERT INTO `chat_rooms` VALUES('()', '".$name."', '".$position."', '".$name."', '".$type."', '".$mid."');");

          so the chat_room sql for the auto-increation must be set to int(2) (99 being the last 2 digit number)

          Comment


            #6
            Nope, here is the table.
            PHP Code:
            CREATE TABLE `chat_rooms` ( 
             `id` int(11) NOT NULL AUTO_INCREMENT, 
             `name` text NOT NULL, 
             `position` int(6) NOT NULL DEFAULT '0', 
             `topic` text NOT NULL, 
             `type` text NOT NULL, 
             `mid` text NOT NULL, 
             `zakljucan` text NOT NULL, 
             `lv` text NOT NULL, 
             PRIMARY KEY (`id`) 
            ) ENGINE=MyISAM DEFAULT CHARSET=cp1251 AUTO_INCREMENT=1 ; 
            
            Unsigned int is considered as smallint and it is two digits.
            Last edited by arnage; 19.09.11, 18:20.
            <!DOCTYPE html PUBLIC "-//WAPFORUM.RS

            Comment


              #7
              full php file with code with comant create room

              Unsigned int jel possible to be more than 2 digits there its i think only problem

              Added after 8 minutes:

              PHP Code:
              <?php
              error_reporting(0);
              require_once"./includes/functions/gzip.php";
              include('start.php');
              include("config.php");
              include("./includes/".$ver."/banned");
              
              list($msec, $sec) = explode(chr(32), microtime());
              $headtime = $sec + $msec;
              $nocache = rand(1000, 9999);
              
              switch($ver)
              {
              case 'wml':
              ///////////////////////////////////////////////////////
              //WML VERSION
              ///////////////////////////////////////////////////////
              
              header("Content-type: text/vnd.wap.wml; charset=utf-8");
              header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
              header("Cache-Control: no-cache, must-revalidate");
              
              //AUTH
              $id = intval($_SESSION['id']);
              $password = mysql_escape_string($_SESSION['password']);
              $q = mysql_query("SELECT nickname FROM `chat_users` WHERE `id` = '".$id."' AND `password` = '".md5($password)."';");
                  if(mysql_num_rows($q) == 0)
                  {
                  echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
                  echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.3//EN\" \"http://www.wapforum.org/DTD/wml13.dtd\"><wml>\n";
                  echo "<card title=\"ERROR\" ontimer=\"index.php?ver=wml\"><timer value=\"15\"/><p align=\"left\">\n";
                  echo "<small>Authorization Failed!<br/>\n";
                  list($msec, $sec) = explode(chr(32), microtime());
                  echo "<br/>[".round(($sec+$msec)-$headtime,5)."] sec<br/>\n";
                  echo "</small>";
                  require_once "includes/functions/gzip_foot.php";
                  echo "</p></card></wml>";
                  ob_end_flush();
                  exit();
                  }
              
              //END AUTH
              
              
              echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
              echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.3//EN\" \"http://www.wapforum.org/DTD/wml13.dtd\">\n<wml>\n";
              
              echo "<head><meta http-equiv=\"Cache-Control\" content=\"no-cache\" forua=\"true\"/></head>\n";
              echo "<card id=\"index\" title=\"opcije\"><p align=\"left\">\n";
              
              echo "<!-- Developed by martin suvalj -->\n";
              
              $chat = file("chat.dat");
              $logo = trim($chat[0]);
              $message = trim($chat[1]);
              if(!empty($logo)) echo "<img src=\"http://$logo\" alt=\"\" /><br/>\n";
              if(!empty($message)) echo "$message<br/>\n";
              
              
              ///razglas
              //razglas
              
              
              
              $q = mysql_query("SELECT id,nickname,level,shoutbox,status,posts,time,ip,ua,security,fsize FROM `chat_users` WHERE `nickname` = '".$nickname."' AND `password` = '".md5($password)."' LIMIT 1;");
              $user = mysql_fetch_array($q);
              $uid = $user['id'];
              $nickname = $user['nickname'];
              $pass = $user['password'];
              $ip = $user['ip'];
              $ua = $user['ua'];
              $kick = $user['kick'];
              $moder = $user['moder'];
              $reason = $user['reason'];
              $name = $user['name'];
              $site = $user['site'];
              $sex = $user['sex'];
              $from = $user['from'];
              $mobile = $user['mobile'];
              $email = $user['email'];
              $birthday = $user['birthday'];
              $about = $user['about'];
              $posts = $user['posts'];
              $lev = $user['level'];
              $answers = $user['answers'];
              $gbalans = $user['gbalans'];
              $status = $user['status'];
              $regdate = $user['regdate'];
              $place = $user['place'];
              $photo_type = $user['photo'];
              $time = $user['time'];
              $mood = $user['mood'];
              $shoutbox= $user['message'];
              
                      
              echo "Room:<br/>\n";
              echo "Obrati paznju na ime sobe, da soba sa takvim nazivom vec ne postoji i da ne krsi uslove koristenja chata<br/>\n";
              echo "<br/>";
              
              if(!isset($_POST['action']))
              {
              echo "ime sobe:<br/>\n";
              echo "<input name=\"name$nocache\" maxlength=\"15\" title=\"name\"/><br/>\n";
              echo "Position:<br/>\n";
              echo "<input name=\"position$nocache\" format=\"*N\" size=\"2\" maxlength=\"2\" title=\"position\"/><br/>\n";
              $type = '3';
              echo "<anchor>[Kreiraj]<go href=\"create_my_room.php?nocache=$nocache&amp;ver=wml&amp;".SID."&amp;mod=addroom\" method=\"post\">\n";
              echo "<postfield name=\"name\" value=\"$(name$nocache)\"/>\n";
              echo "<postfield name=\"position\" value=\"$(position$nocache)\"/>\n";
              
              echo "<postfield name=\"action\" value=\"$(add$nocache)\"/>\n";
              echo "</go></anchor><br/>\n";
              }
              else
              {
              $type = '3';
              $mid = $id;
              $name = trim(mysql_escape_string(htmlspecialchars($_POST['name'])));
              $name = str_replace('$', '$$', $name);
              if(empty($name))
              {
              echo "Niste unijeli ime sobe!<br/>\n";
              break;
              }
              
              
              $position = intval($_POST['position']);
              if($postion < 0) $postion = 0;
              if($postion > 10000) $postion = 10000;
              $type = intval($_POST['type']);
              if($type < 0) $type = 0;
              if($type > 2) $type = 0;
              $q = mysql_query("SELECT `name` FROM `chat_rooms` WHERE `name` = '".$name."';");
              
              if(mysql_affected_rows() != 0)
              {
              echo "Soba sa takvim imenom vec postoji.<br/>\n";
              break;
              }
              
              $q = mysql_query("SELECT COUNT(*) FROM `chat_rooms`;");
              $result = mysql_result($q, 0);
              
              if($result > 25)
              {
              echo "Too many established rooms!<br/>\n";
              break;
              }
              
              $sql = mysql_query("INSERT INTO `chat_rooms` VALUES('()', '".$name."', '".$position."', '".$name."', '".$type."', '".$mid."');");
              $room = mysql_insert_id();
              $sql = mysql_query("CREATE TABLE `chat".$room."` 
              (
                `id` int(10) unsigned NOT NULL auto_increment,
                `aid` int(11) NOT NULL default '0',
                `nickname` tinytext NOT NULL,
                `msg` text NOT NULL,
                `to` int(11) NOT NULL default '0',
                `time` tinytext NOT NULL,
                `seconds` int(11) unsigned NOT NULL default '0',
                PRIMARY KEY  (`id`)
              ) TYPE=MyISAM ;");
              
                  if($sql)
                  {
                  echo "Room successfully created!<br/>\n";
              
                  if($type == 3) echo "<a href=\"mroom.php?".SID."&amp;ver=wml&amp;rid=$room\">The room</a><br/>\n";
                  }
                  else
                  {
                  echo "Error.<br/>\n";
                  echo mysql_error();
                  }
              }echo "<br />\n";
              echo "<a href=\"rooms.php?".SID."&amp;ver=wml\">Chat Sobe:</a><br/>\n";
              echo "<a href=\"menu.php?".SID."&amp;ver=wml&amp;nocache=$nocache\">Livechat meni</a><br/>\n";
              list($msec, $sec) = explode(chr(32), microtime());
              echo "<small>[".round(($sec + $msec) - $headtime, 5)."]</small><br/>\n";
              require_once "includes/functions/gzip_foot.php";
              echo "</p></card></wml>";
              ob_end_flush();
              break;
              
              case 'html':
              ///////////////////////////////////////////////////////
              //HTML VERSION
              ///////////////////////////////////////////////////////
              
              $my_title = "rom admin";
              if(!isset($_COOKIE['theme'])) $_COOKIE['theme'] = 1;
              include_once "themes/".intval($_COOKIE['theme'])."/index.php";
              //AUTH
              $id = intval($_SESSION['id']);
              $password = mysql_escape_string($_SESSION['password']);
              $q = mysql_query("SELECT nickname FROM `chat_users` WHERE `id` = '".$id."' AND `password` = '".md5($password)."';");
                  if(mysql_num_rows($q) == 0)
                  {
                  echo "Authorization Failed!<br/>\n";
                  include_once "themes/".intval($_COOKIE['theme'])."/foot.php";
                  exit();
                  }
              //END AUTH
              $nik = mysql_result($q, 0);
              $user = mysql_fetch_array($q);
              $mid = $user['id'];
              $nickname = $user['nickname'];
              $pass = $user['password'];
              $ip = $user['ip'];
              $ua = $user['ua'];
              $kick = $user['kick'];
              $moder = $user['moder'];
              $reason = $user['reason'];
              $name = $user['name'];
              $site = $user['site'];
              $sex = $user['sex'];
              $from = $user['from'];
              $mobile = $user['mobile'];
              $email = $user['email'];
              $birthday = $user['birthday'];
              $about = $user['about'];
              $posts = $user['posts'];
              $lev = $user['level'];
              $answers = $user['answers'];
              $gbalans = $user['gbalans'];
              $status = $user['status'];
              $regdate = $user['regdate'];
              $place = $user['place'];
              $photo_type = $user['photo'];
              $time = $user['time'];
              $mood = $user['mood'];
              $shoutbox= $user['message'];
              
              
              echo "<!-- Developed by martin suvalj -->\n";
              
              $chat = file("chat.dat");
              $logo = trim($chat[0]);
              $message = trim($chat[1]);
              if(!empty($logo)) echo "<img src=\"http://$logo\" alt=\"\" /><br/>\n";
              if(!empty($message)) echo "$message<br/>\n";
              
              if(!isset($_POST['action']))
              {
              echo "<div class=\"form\">\n";
              echo "<form method=\"post\" action=\"create_my_room.php?nocache=$nocache&amp;ver=html&amp;".SID."&amp;mod=addroom\">\n";
              
              
              echo "napravi svoju sobu , budi siguran da ime sobe vec ne postoji!<br/>\n";
              
              echo "Title:<br/>\n";
              echo "<input name=\"name\" maxlength=\"15\" title=\"name\"/><br/>\n";
              echo "pozicija:<br/>\n";
              echo "<input name=\"position\" size=\"2\" maxlength=\"2\" title=\"position\"/><br/>\n";
              $type = '3';
              $mid = $id;
              
              echo "</select><br/>\n";
              echo "<input type=\"hidden\" name=\"action\" value=\"add\"/>\n";
              echo "<input type=\"submit\" value=\"Create\"/></form></div><br/>\n";
              }
              else
              {
              
              
              $name = trim(mysql_escape_string(htmlspecialchars($_POST['name'])));
              $name = str_replace('$', '$$', $name);
              if(empty($name))
              {
              echo "Prazan naziv sobe!<br/>\n";
              break;
              }
              $type = '3';
              $mid = $id;
              $position = intval($_POST['position']);
              if($postion < 0) $postion = 0;
              if($postion > 100) $postion = 100;
              $type = intval($_POST['type']);
              if($type < 0) $type = 0;
              if($type > 12) $type = 0;
              $q = mysql_query("SELECT `name` FROM `chat_rooms` WHERE `name` = '".$name."';");
              
              if(mysql_affected_rows() != 0)
              {
              echo "Zao nam je  naziv sobe sa takvim imenom vec postoji!<br/>\n";
              break;
              }
              
              $q = mysql_query("SELECT COUNT(*) FROM `chat_rooms`;");
              $result = mysql_result($q, 0);
              
              if($result > 1000)
              {
              echo "Zao nam je  trenutno ima Previse privatnih soba!<br/>\n";
              break;
              }
              
              $sql = mysql_query("INSERT INTO `chat_rooms` VALUES('()', '".$name."', '".$position."', '".$name."', '".$type."', '".$mid."');");
              
              $room = mysql_insert_id();
              
              $sql = mysql_query("CREATE TABLE `chat".$room."` 
              (
                `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
                `aid` int(11) NOT NULL default '0',
                `nickname` tinytext NOT NULL,
                `msg` text NOT NULL,
                `to` int(11) NOT NULL default '0',
                `time` tinytext NOT NULL,
                `seconds` int(11) unsigned NOT NULL default '0',
                PRIMARY KEY  (`id`)
              ) TYPE=MyISAM ;");
              
              
                  if($sql)
                  {
                  echo "Soba uspijesno kreirana!<br/>\n";
                  if($type = 3) echo "<a href=\"room.php?".SID."&amp;ver=html&amp;rid=$room\">udji u sobu</a><br/>\n";
              
                  }
                  else
                  {
                  echo "Error. greska s bazama podataka (izvjestaj je dolje)<br/>\n";
                  echo mysql_error();
                  }
              }
              
              
              echo "<br />\n";
              echo "<img src='ikone/line.jpg' alt='--'> <br/>\n";
              echo " <img src='ikone/chat.gif' alt='chat'>  <a href=\"rooms.php?".SID."&amp;ver=html\">Chat Sobe:</a><br/>\n";
              echo "<img src='ikone/calen.gif' alt='my'><a href=\"menu.php?".SID."&amp;ver=html&amp;nocache=$nocache\">LiveChat meni</a><br/>\n";
              include_once "themes/".intval($_COOKIE['theme'])."/foot.php";
              break;
              }
              ?>
              i try use int(11) but dont work :(
              Last edited by martinzenica; 20.09.11, 11:19. Reason: i make an error

              Comment


                #8
                Thanks to all good people but I still I found a problem in the script. I really like the author forgot to define $ type = '3 ';
                $ mid = $ id;
                $ locked = '0 ';
                $ lv = '0 ';
                explanation of the problem here is PHP
                PHP Code:
                ///those are missing .. for chat_rooms tabele
                $type = '3';
                $mid = $id;
                $zakljucan = '0';
                $lv = '0';
                
                $sql = @mysql_query("INSERT INTO `chat_rooms` VALUES(0, '".$name."', '".$position."', '".$name."', '".$type."', '".$mid."', '".$zakljucan."', '".$lv."');"); 
                
                While I have programmed a new chat options for master (owner of room) I forgot to define and add the php code as you can see .. So for now, and thank you all once again

                Comment

                Working...
                X