Jump to content

Archived

This topic is now archived and is closed to further replies.

Haxigi

[php]Wprowadzenie IF do kodu. Potrzebna pomoc

Recommended Posts

Skonstruowałem już ramkę tutorialu przy pomocy wz_dragdrop.js . Nie wiem jednak jak zrobić aby sprawdzało w tabeli users, w polu tut wartość.

Jeżeli = 0 to wyświetla drag&drop i zmienia wartość z 0 na 1 jeżeli =1 to nic nie wyświetla.

czyli na chłopskie

if tut = 0

{wyświetl tutorial

zmień 0 na 1 w tut

}

else

{

nie rób nic/nie wyświetlaj tuta

}

<?
include("connection.php");
if(!(@mysql_connect("$host","$user","$pass") && @mysql_select_db("$tablename"))) {echo"Geen verbinding gevonden";}
session_start();
$dbres                = mysql_query("SELECT *,UNIX_TIMESTAMP(`signup`) AS `signup`,UNIX_TIMESTAMP(`online`) AS `online` FROM `users` WHERE `login`='{$_SESSION['user']}'");
$data                = mysql_fetch_object($dbres);
if(isset($data->login) || isset($_SESSION['login'])){
  include("config.php");
  session_start();
if($_GET['a'] != hospital){
$hp2            = mysql_query("SELECT `health` FROM `users` WHERE `login`='$data->login'");
$hp1            = mysql_fetch_object($hp2);
if($hp1 <= 0){
header("Location: $sitelink/v3/index.php?a=hospital");
}}
if($_GET['a'] != jail){
$bajes2            = mysql_query("SELECT *,UNIX_TIMESTAMP(`baktijd`) AS `baktijd`,0 FROM `users` WHERE `login`='$data->login'");
$bajes1            = mysql_fetch_object($bajes2);
$datijd = $data->gevangenis;
$tijdverschil1        = $bajes1->baktijd-3600+$datijd-time();
if($bajes1->baktijd + $datijd > time()){
header("Location: $sitelink/v3/index.php?a=jail");
}}
if($_GET['a'] != forum){
?>
<html>
    <head>
        <title>Goldmafia.pl | Polska gangsterska gra MMO via www!</title>
        <base href="<?=$sitelink?>/v3/" />
        <meta name="description" content="Step into the Mafia world and start playing now in the best MMO mafia game! Bandias offers its players lot's of possibilities to become the biggest criminal in the world. To reach that goal you deal in drugs and booze, steal cars and perform numerous other crimes" />
        <meta name="keywords" content="maffia, mafia, criminals, gangsters, gangster, game" />
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2" />
        <link rel="stylesheet" type="text/css" href="css/style.css"/>
<script>
              window.dhx_globalImgPath="js/dhtmlxslider/imgs/";
           </script>
           <script language="javascript" src="lib/tinymce/tiny_mce.js"></script>

        <script language="JavaScript" src="js/display.js"></script>
        <script language="JavaScript" src="js/functions.js"></script>

        <script language="JavaScript" src="js/duration_progress.js"></script>
        <script language="JavaScript" src="js/prototype-1.6.0.2.js"></script>
        <script language="JavaScript" src="js/swfobject.js"></script>    
        
        <script language="JavaScript" src="js/jquery/jquery-1.3.2.min.js"></script>
        
        <script language="JavaScript" src="js/jquery/jquery-impromptu.2.5.min.js"></script>
        <link rel="stylesheet" type="text/css" href="css/jquery/jquery.impromptu.css"/>

        <script language="javascript"   src="js/dhtmlxslider/dhtmlxcommon.js"></script>
        <script language="javascript"   src="js/dhtmlxslider/dhtmlxslider.js"></script>
        <link rel="STYLESHEET" type="text/css" href="js/dhtmlxslider/dhtmlxslider.css">

        <link rel="stylesheet" type="text/css" href="css/general/tabs.css"/><script language="JavaScript" src="js/jquery/jquery.scrollTo-1.4.2-min.js"></script>        
        <!--[if IE 6]>
        <script src="js/DD_belatedPNG.js"></script>
        <script>
          DD_belatedPNG.fix('img');
        </script>
        <![endif]-->
        
        <script type="text/javascript">
        <!-- //
        var $j = jQuery.noConflict();
        function handleError() {
            return true;
        }
        
                //window.onerror = handleError;
                
        //-->
        </script>
    </head>

<body class="overwrite" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
    
    <div id="overlay" style="position:absolute;top:0;left:0;z-index:90;width:100%; display:none;"></div>
    <script language="JavaScript" src="js/wz_dragdrop/wz_dragdrop.js"></script>
            <script language="JavaScript" type="text/javascript" src="js/wz_tooltip/wz_tooltip.js"></script>
        <script language="JavaScript" type="text/javascript" src="js/wz_tooltip/tip_balloon.js"></script>

<script language="javascript">
    currenttime = 'Mar 31, 2010 23:41:04'
var serverdate = new Date(currenttime)

function padlength(what){
    var output=(what.toString().length==1)? "0"+what : what
    return output
}

function displaytime(){
    serverdate.setSeconds(serverdate.getSeconds()+1)
    var timestring=padlength(serverdate.getHours())+":"+padlength(serverdate.getMinutes())+":"+padlength(serverdate.getSeconds())
    document.getElementById("servertime").innerHTML=timestring
    
    
}


window.onload = function(){
    setInterval("displaytime()", 1000);
}
</script>
<!-- TUTORIAL MESSAGE -->

    [B][COLOR="Red"]<table id="frame" style="position:absolute; left:300; top:300; border:1px solid black;visibility:hidden" cellspacing="0" cellpadding="0">
        <tr>
            <td style="width:40px; height:100%; background:url('images/message_tut/background_message_left.jpg') repeat-y; cursor:move;">
                 
            </td>
            <td width="100%" style="width:445px;  background:#bfbfbf; text-align:center;">
                 <div style="float:left; width:445px;  background:#bfbfbf; text-align:center;">

                <font style="text-align:left; display:block; border-bottom:2px solid #5a0000; margin-top:5px; margin-bottom:1px; color:#5a0000; font-family:Times new roman; font-weight:bold; font-size: 24px; cursor:move;" id="tutorial_title">Witaj <? echo $users->login; ?></font>
                <table width="100%" id="tutorial_content">
                    <tr>
                        <td valign="top" height="100%">
                            <table height="100%" width="100%">
                                <tr>
                                    <td id="tutorial_mission" valign="top">
                                                                                <b>Witaj w mini tutorialu gry Gold Mafia !</b><br />

                                        Właśnie wkroczyłeś do gangsterskiego świata.</br> Nie martw się, za chwile nauczysz się obsługi GoldMafii !<br />
                                        <br />
                                        Jak widzisz, menu podzielone jest na 9 głównych części: Profil, Premium, Rodzina, Inne, Twoje statystyki, Przestępczość, Miasto, Kasyno i Statystyki.<br /><b>1. PROFIL</b> - Tutaj zarządzasz swoją postacią. Możesz wybrać się na wakacje, edytować dane, zarządzać znajomymi czy zapisywać notatki !</br><b>2. PREMIUM</b> - Dzięki temu menu, masz możliwość wykupienia dodatkowych kredytów, które ułątwią twoją grę . CIĄG DALSZY NASTĄPI
                                        
                                        <br />
                                        
                                                                            </td>
                                </tr>

                                <tr>
                                    <td valign="bottom" id="tutorial_links">
                                    
                                    </td>
                                </tr>
                            </table>
                        </td>
                        <td align="right" valign="top">
                            <img src="images/message_tut/gangster.jpg">
                        </td>

                    </tr>
                </table>
            </td>
            <td style="width:40px; height:100%; background:url('images/message_tut/background_message_right.jpg') repeat-y; cursor:move;" valign="top">
                <a href="#" onclick="closeWelcome(); return false" class="error_ok"><img src="images/message_tut/cross.gif" border="0px" style="margin-left: 13; margin-top:5px; cursor:pointer;"></a>
            </td>
        </tr>
    </table>

  </div>
  
<script type="text/javascript">
<!--

SET_DHTML("titlebar"+CURSOR_MOVE, "frame"+CURSOR_MOVE, "clientarea"+NO_DRAG, "resizehandle"+MAXOFFLEFT+210+MAXOFFTOP+90+CURSOR_NW_RESIZE, "resizebutton"+VERTICAL+HORIZONTAL);

// Some vars to customize window:
var frame_padding = 0;
var titlebar_h = 19;
var toolbar_h = 20;
var statusbar_h = 20;
var clientarea_margin = 4;

// preload button images to ensure un-delayed image swapping    
var button_down_outset = new Image();
var button_down_inset = new Image();
var button_up_outset = new Image();
var button_up_inset = new Image();
button_down_outset.src = '../../images/dragdrop/button_down_outset.gif';
button_down_inset.src = '../../images/dragdrop/button_down_inset.gif';
button_up_outset.src = '../../images/dragdrop/button_up_outset.gif';
button_up_inset.src = '../../images/dragdrop/button_up_inset.gif';

// to save window height when window is minimized
var last_window_h;


// initWindow() moves elements to their adequate locations
// and builds coherences between these elements by converting outer frame, client area and images for resize functionalities
// to 'childern' of the draggable titlebar
function initWindow()
{
    dd.elements.titlebar.moveTo(dd.elements.frame.x+2+frame_padding, dd.elements.frame.y+2+frame_padding);
    dd.elements.titlebar.addChild("frame");
    dd.elements.titlebar.setZ(dd.elements.frame.z+1); // ensure that titlebar is floating above frame
    dd.elements.titlebar.resizeTo(dd.elements.frame.w-4-(frame_padding<<1), titlebar_h);

    dd.elements.clientarea.moveTo(dd.elements.frame.x+2+frame_padding+clientarea_margin, dd.elements.titlebar.y+titlebar_h+toolbar_h+clientarea_margin);
    dd.elements.titlebar.addChild("clientarea");
    dd.elements.clientarea.resizeTo(dd.elements.frame.w-4-(frame_padding<<1)-(clientarea_margin<<1), dd.elements.frame.h-titlebar_h-toolbar_h-statusbar_h-4-(frame_padding<<1)-clientarea_margin);

    dd.elements.resizehandle.moveTo(dd.elements.frame.x+dd.elements.frame.w-dd.elements.resizehandle.w-2, dd.elements.frame.y+dd.elements.frame.h-dd.elements.resizehandle.h-2);
    dd.elements.resizebutton.moveTo(dd.elements.titlebar.x+dd.elements.titlebar.w-dd.elements.resizebutton.w-frame_padding-(titlebar_h>>1)+Math.round(dd.elements.resizebutton.w/2), dd.elements.titlebar.y+Math.round(titlebar_h/2)-Math.round(dd.elements.resizebutton.h/2));
    dd.elements.titlebar.addChild("resizebutton");
    dd.elements.titlebar.addChild("resizehandle");
    
    dd.elements.titlebar.show();
}
initWindow();


// my_PickFunc, my_DragFunc and my_DropFunc override their namesakes in wz_dragdrop.js
function my_PickFunc()
{
    if (dd.obj.name == "resizebutton")
    {
        dd.obj.swapImage(dd.elements.clientarea.visible? button_up_inset.src : button_down_inset.src);
    }
}


function my_DragFunc()
{
    if (dd.obj.name == "resizehandle")
    {
        dd.elements.frame.resizeTo(dd.obj.x-dd.elements.frame.x+dd.obj.w+2, dd.obj.y-dd.elements.frame.y+dd.obj.h+2);
        dd.elements.titlebar.resizeTo(dd.obj.x-dd.elements.titlebar.x+dd.obj.w-frame_padding, titlebar_h);
        dd.elements.clientarea.resizeTo(dd.elements.frame.w-4-(frame_padding<<1)-(clientarea_margin<<1), dd.elements.frame.h-titlebar_h-toolbar_h-statusbar_h-4-(frame_padding<<1)-clientarea_margin);
        dd.elements.resizebutton.moveTo(dd.elements.titlebar.x+dd.elements.titlebar.w-dd.elements.resizebutton.w-frame_padding-(titlebar_h>>1)+Math.round(dd.elements.resizebutton.w/2), dd.elements.resizebutton.y);
    }
}


function my_DropFunc()
{
    if (dd.obj.name == "resizebutton")
    {
        if (dd.elements.clientarea.visible)
        {
            dd.obj.swapImage(button_down_outset.src);
            dd.elements.clientarea.hide();
            dd.elements.resizehandle.hide();
            last_window_h = dd.elements.frame.h;
            dd.elements.frame.resizeTo(dd.elements.frame.w, titlebar_h+(frame_padding<<1)+4);
        }
        else
        {
            dd.obj.swapImage(button_up_outset.src);
            dd.elements.clientarea.show();
            dd.elements.resizehandle.show();
            dd.elements.frame.resizeTo(dd.elements.frame.w, last_window_h);
        }
    }
}


</script>
[/COLOR][/B]
<!-- TUTORIAL MESSAGE END -->


<?
}
mysql_query("UPDATE `users` SET `online`=NOW() WHERE `login`='{$data->login}'");
if($_GET['x'] == delsafemode){
mysql_query("UPDATE `users` SET `safe`='0' WHERE `login`='$data->login'");
}
if($data->vermoord > 0 && $_GET['a'] != buycredits && $_GET['a'] != message){
header("Location: $sitelink/v3/index.php?a=buycredits");
}
if($_GET['a'] == chat){
$online1 = mysql_query("SELECT * FROM `chat_online` WHERE `id`='$data->id'");
$online = mysql_fetch_object($online1);
if($online->id != $data->id){
mysql_query("INSERT INTO `chat_online`(person,id) values('$data->login','$data->id')");
}}else{mysql_query("DELETE FROM `chat_online` WHERE `id`='$data->id'");}
$contantpunt = number_format($data->contant, 0, '.' , '.');
$bankpunt = number_format($data->bank, 0, '.' , '.');
$inboxnew = mysql_num_rows(mysql_query("SELECT id FROM `messages` WHERE `read`=0 AND `inbox`=1 AND `to`='$data->login'"));
$datum = (date("M d, Y H:i:s"));
$tijd = (date("H:i:s"));
include("left_column.php");
if($_GET['a'] != ""){
include("{$_GET['a']}.php");
}else{include("news.php");}
include("right_column.php");
}else{
include("../index.php");
}?>

Dałem cały kod pliku index.php , to co od <!-- TUTORIAL MESSAGE -->, do <!-- TUTORIAL MESSAGE END -->

jest tutorialem w postaci drag&drop przy pomocy wz_dragdrop.js .

Link to comment
Share on other sites

moja sugestia - wrzuć tu tylko fragment kodu który ma nas interesować, bez treści itp...

z tego co zrozumiałem tekst to chodzi ci o coś takiego:

if($tut==0){
//wyświetlanie sobie wstaw do środka i co tam jeszcze potrzebujesz
}

wszak jeśli w "else" ma być "nic nie rób" to nie potrzebujesz tego else`a wcale

Link to comment
Share on other sites



  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...