Jump to content

Winstons

Members
  • Posts

    52
  • Joined

  • Last visited

    Never

Posts posted by Winstons

  1. Why empty firs body of 'if' ???

     

    if (isset($_POST['escape']) || (isset($_POST['suicide']))) {
            // Why here is nothing wrote ???
    } else {
        if(empty($_POST['agree'])){
                echo "You need to check the box";
        }else{
            mysql_query("DELETE FROM `users` WHERE `id`= ".(int)($_SESSION['user_id']);
        }
    }

  2. melloorr

    Your code is incorrect.

     

    Below, my code, it is correct

    error_reporting(E_ALL);
    if(isset($_COOKIE))
    {
        if (isset($_COOKIE['Key_my_site']) && $_COOKIE['Key_my_site'] == $cookiedbid)
            echo "Your cookie is okay.";
    
        elseif (isset($_COOKIE['Key_my_site']) && $_COOKIE['Key_my_site'] !== $cookiedbid)
        {
            header("refresh:5;url=index.php" );
            echo "You have been logged out because your cookie has been compromised";
            setcookie(Key_my_site, 0, $past);
        }
    
        else 
            echo "Your cookie is no longer there.";
    }

  3. (if there was originally no cookie, then i do not get these errors, as the variable is only defined if the cookie is present)

    For this, you must do this

    if(!isset($_COOKIE['name']))
        set_cookie('name', 'value');
    else
        // Do something with existing COOKIE

  4. Hmm...

    Try replace it

    <input type="text" name="qty<?php echo $id; ?>" value="<?php echo print_r($qty); ?>" size="3" maxlength="3" class="view_basket_qty" />

    To this

    <input type="text" name="qty<?php echo $id; ?>" value="<?php echo '<pre>' . print_r($qty, true) . '</pre>'; ?>" size="3" maxlength="3" class="view_basket_qty" />

    What you see on the screen ?

  5. www.goog isn't a complete url

    www - is correct domain name

    goog - goog, too, fits the pattern.

    therefore believes it is right RegExp.

    If you you want correct url get, you must to enumerate a list of domains

    Try it

    $str = '
    www.google.com
    http://google.com
    https://google.com
    http://www.google.com
    https://www.google.com
    google.co.uk
    www.google.co.uk
    http://google.co.uk
    https://google.co.uk
    http://www.google.co.uk
    https://www.google.co.uk
    www.goo
    go.ru
    google.lol
    ';
    preg_match_all("#(?:https?://)?(?:www\.)?[-a-z\d]{2,9}\.(?(1)[-a-z\d]{2,5}|(?:co|com|uk|us|ru|org|net))(\.[-a-z\d]{2,4})?#is", $str, $match);
    echo '<pre>'.(print_r($match, 1)).'</pre>';

×
×
  • Create New...

Important Information

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.