Jump to content

Ayaka

Inactive Member
  • Posts

    288
  • Joined

  • Last visited

  • Days Won

    10
  • Feedback

    0%

Posts posted by Ayaka

  1. Hi,

    I'm started to continue programming on my CMS and i was asking myself: is there a significant difference in sql tables and columns between new and older revisions? This may sounds like a noob question but i have no clue about this because i never created a metin2 server myself. It is important for me that people can install the cms for all revisions. If i am using select querys for a column which doesnt exist anymore or new columns added i have to know that.

    Maybe a hint which was changed or added would be nice. (~ ̄▽ ̄)~

    Thanks

  2. 27 minutes ago, ReFresh said:

    @Ayaka It can't work because the action="/debug_postavy/ can't get the ID of the char so that's the problem.

    yes, because in your other script you get the id with the GET Parameter "postava". Normaly a link should look like this:  /debug_postavy.php?postava='.$ziskatPostavy->id.'

    postava (in my example) is declared in the select (name="postava") and the value is the ID. 

    If you do .htaccess changes and normal links like above are working you can try it like i did with one change in action:

    <?PHP
    
    if(isset($_SESSION['user_admin']) && checkInt($_SESSION['user_admin']) && $_SESSION['user_admin']>=0) {
    
        echo'<h2>'.DEBUG01.'</h2>';
    
        echo'<p>'.DEBUG02.'<br>'.DEBUG03.'<br/><br/><b>'.DEBUG04.'</b></p>';
    
        $databazePostavy = "SELECT player.id,player.name FROM ".SQL_HP_PLAYER.".player WHERE player.account_id='".$_SESSION['user_id']."'";
        $queryPostavy = mysql_query($databazePostavy,$sqlServ);
    
        echo '<form method="post" action="/debug_postavy.php">';
        echo'<select name="postava">';
        while($ziskatPostavy = mysql_fetch_object($queryPostavy)) {
            echo'<option value="'.$ziskatPostavy->id.'">'.$ziskatPostavy->name.'</option>';
        }
        echo '</select>';
        echo '<input type="submit" value="[Debug]"/>';
        echo '</form>';
    }
    else {
        echo'<table class="tabulka"><th><h3 class="tabulkaLostpwFont">Abys měl přístup do této sekce, musíš být přihlášen!</h3></th></table>';
    }
    ?>
    <?PHP
    echo'<p><a href="/nastaveni">'.BACK.'</a></p>';
    ?>

     

    EDIT:// Ah and IMPORTANT: 

    Change all (Line 7, 11, 24):

    $_GET['postava']

    to

    $_POST['postava']

    in this file: http://pastebin.com/SAQwh9PV

    because its a post, not a get when submit via <form>!

  3. This worked?? I dont get where $_GET['postava'] came from if its not given in the url but ok. Check this out:

    
    <?PHP
    
    if(isset($_SESSION['user_admin']) && checkInt($_SESSION['user_admin']) && $_SESSION['user_admin']>=0) {
    
        echo'<h2>'.DEBUG01.'</h2>';
    
        echo'<p>'.DEBUG02.'<br>'.DEBUG03.'<br/><br/><b>'.DEBUG04.'</b></p>';
    
        $databazePostavy = "SELECT player.id,player.name FROM ".SQL_HP_PLAYER.".player WHERE player.account_id='".$_SESSION['user_id']."'";
        $queryPostavy = mysql_query($databazePostavy,$sqlServ);
    
        echo '<form method="post" action="/debug_postavy/">';
        echo'<select name="postava">';
        while($ziskatPostavy = mysql_fetch_object($queryPostavy)) {
            echo'<option value="'.$ziskatPostavy->id.'">'.$ziskatPostavy->name.'</option>';
        }
        echo '</select>';
        echo '<input type="submit" value="[Debug]"/>';
        echo '</form>';
    }
    else {
        echo'<table class="tabulka"><th><h3 class="tabulkaLostpwFont">Abys měl přístup do této sekce, musíš být přihlášen!</h3></th></table>';
    }
    ?>
    <?PHP
    echo'<p><a href="/nastaveni">'.BACK.'</a></p>';
    ?>

    If this doesn't work i cant help you because i dont get how this POST is working in your script

  4. OK at first we have to fix the functionality.

    Use this code: http://pastebin.com/nWP5Vtgy
    and replace on line 31:

    <td class="'.$design.'">'.$ziskatPostavy->name.'<a href="/debug_postavy/'.$ziskatPostavy->id.'">[Debug]</a></td>

    with:

    <td class="'.$design.'">'.$ziskatPostavy->name.'<a href="/debug_postavy.php?postava='.$ziskatPostavy->id.'">[Debug]</a></td>

    Does it work then? After that we do the select thing but it should work at first.

  5. What do you define in that DEBUG constants? O.o

    I dont know what you mean with debug but for the rest you can check my changes out (I didnt test it):
     

    <?PHP
    if(isset($_SESSION['user_admin']) && checkInt($_SESSION['user_admin']) && $_SESSION['user_admin']>=0) {
        echo'<h2>'.DEBUG01.'</h2>';
        echo'<p>'.DEBUG02.'<br>'.DEBUG03.'<br/><br/><b>'.DEBUG04.'</b></p>';
    
        // when a charakter is selected and submitted
        $charId = isset($_POST['charakter']) ? $_POST['charakter'] : false;
        if ($charId && is_numeric($_POST['charakter'])) {
            $theId = htmlentities($_POST['charakter']);
            /*
             * ########################################
             * DEBUG HERE!!!
             * ########################################
             */
            echo 'Selected charakter with ID: '.$theId; // just to check that it works, you can delete this line
        }
    
        // show chars
        $sql = "SELECT player.id,player.name FROM ".SQL_HP_PLAYER.".player WHERE player.account_id='".$_SESSION['user_id']."'";
        $result = mysql_query($sql,$sqlServ);
    
        echo '<form method="post" action="'.basename($_SERVER["SCRIPT_FILENAME"]).'">';
        echo'<select name="charakter">';
        while($player = mysql_fetch_object($result)) {
            echo'<option value="'.$player->id.'">'.$player->name.'</option>';
        }
        echo '</select>';
        echo '<input type="submit" value="Debug selected Charakter"/>';
        echo '</form>';
    }
    else {
        echo'<table class="tabulka"><th><h3 class="tabulkaLostpwFont">Abys měl přístup do této sekce, musíš být přihlášen!</h3></th></table>';
    }
    ?>
    <?PHP
    echo'<p><a href="/nastaveni">'.BACK.'</a></p>';
    ?>

     

  6. 58 minutes ago, eyormaz said:

    Try :

    
    $Query = mysql_query("SELECT create_time FROM ".SQL_HP_DB.".account WHERE id = '$_SESSION[user_id]'");
    $Fetch = mysql_fetch_array($Query);
    $create_time = $Fetch[create_time];

     

    What is the decisive technical difference to my example? And why mysql_fetch_array? You don't need numeric and string keys here - you are using the column name, so its recommanded to use MYSQL_ASSOC.

    ps: lower_case ftw ;)

  7. On 16.1.2017 at 8:14 PM, ReFresh said:

    I have this now and it's work but not as I want:

    $qcreatetime = mysql_query("SELECT create_time FROM ".SQL_HP_DB.".account WHERE id='".$_SESSION['user_id']."'");

    while ($rowcreatetime = mysql_fetch_array($qcreatetime))

    {$createtime = $rowcreatetime["create_time"];

    echo $createtime;}

    I'm still getting this error:IMG_20170116_201330_811.JPG

    You dont need while if you want to get only one record.

    I dont understand your "error". 2016-08-30 18:55:21 is the right output, or?. Im wondering why the "Query was empty" message was generated because there is a response.

    Try: 

    $result = mysql_query("SELECT create_time FROM ".SQL_HP_DB.".account WHERE id='".$_SESSION['user_id']."' LIMIT 1") or die(mysql_error());
    $row = mysql_fetch_assoc($result);
    echo date('F d, Y h:mA', strtotime($row["create_time"]));
    // uncommand the following line if you want to debug the return value
    // var_dump($row);

    If "Query was empty" appears, look in your database if the "create_time" is really set for the given user_id.

  8. ah understand. You try to get a EHLO for only logging this respond infromations. Its not important but you can fix it if you give $localdomain a value: Search your whole php files for:

    private $localdomain

    If you found the right file you have to enter the link from your site like this:

    private $localdomain = 'http://www.yourmt2server.com';

    ---

    if you dont really need this loginformation you can comment it:

    // Hi, server!
    // $this->sendCommand("EHLO $this->localdomain()");
    // $this->logArray['EHLO'] = $this->readResponse();

     

    • Love 1
  9. Notice: Undefined variable: smtpResponse in /home/metindi3/public_html/site/asg_functions/mail_class.php on line 179
    this is line 179:

    This is no error, this is a notice. Its not that bad as it looks. This Notice said just that the variable $smtpResponse is undefined. You can declare your Variable by using an if condition right before line 179:

    $smtpResponse = isset($smtpResponse) ? $smtpResponse : 'No SMTP Response given.';

    This should do the magic. Im sure that this message is just for your logs so its ok like this.

    -------------------------------------------

    Notice: Undefined property: Mail::$localdomain in /home/metindi3/public_html/site/asg_functions/mail_class.php on line 187

    This is a notice, too. Try it with brackets (this is required when calling a function)

    $this->sendCommand("EHLO $this->localdomain()");

    If this is not working, show me your public function localdomain() { /* .... */ } in your mail_class.php file (hope the function naming is right). Maybe there is a getLocaldomain() function?

     

    btw. if this is a production server you should disable notice messages for security reasons (after fixing the problem) globally with 

    error_reporting(E_ERROR | E_WARNING | E_PARSE);

     

    • Love 1
  10. Its a good practice to call exit() right after  header() so that code below does not get executed. In mind of that, the problem is an output before the header function. You will need to verify that this code gets run before any other output as well.

    You should not echo (or direkt html output) anything right before the header() function, as doing so will more than likely throw a warning. Debug your code an find out what code generates an output. No one can tell you where exactly this happens without looking in your code.

     

    if you realy dont know how to solve your problem because of bad programming knowledge, you can use the following code instead of  header() . Be warned: this is a realy bad codestyle and not recommended (discouraged by the W3C):

     $url='http://www.your.url';
     echo '<META HTTP-EQUIV=REFRESH CONTENT="0; '.$url.'">';

    this will output an html meta tag which redirect the user.

     

    • Love 1
  11. On 5.12.2016 at 8:40 PM, emanuel said:

    I get this warning when i want to loggin and when i want to loggout:

    
    Warning: Cannot modify header information - headers already sent by (output started at /home/metindi3/public_html/market/include/functions.php:1) in /home/metindi3/public_html/market/include/functions.php on line 81

    But if i refresh the page everything it's ok,warning just gone,how can i fix it ?

     You are trying to send headers information after outputing content. Thats wrong. I guess you will redirect to another page after login process with something like that?: 

    header("Location: http://www.example.com/");

    When refreshing the page it certainly works because the header() function is firing during the login process. After refreshing you are logged in already - thats the reason why this warning only appears ones after clicking login

    This answer will help you to understand the problem: http://stackoverflow.com/a/8028987

    I dont know your code so i can give you a tip which could work. Add 

    exit;

    right after the header(); function.

    • Metin2 Dev 1
    • Love 4
×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.