Page 4 of 4 FirstFirst ... 234
Results 31 to 37 of 37
  1. #31

    <?php
    session_start();

    echo "Hello World Success!."<br>";

    if(isset($_SESSION['AllowAdmin']))
    {
    echo "Admin is set";
    }
    else {
    echo "Admin not set";
    }
    ?>

    dont also forget to add slashes to your post variables, or you might get injected with malicious data.

  2. #32
    Code:
    $username = $_POST['UName'];
    $password = $_POST['PWord'];
        
    $query = "SELECT username,pword,usertype FROM user_info WHERE username = '$username' AND pword = '$password'";
    $result = mysql_query($query);
    From a security perspective, the above code is absolutely not advisable. Crackers can easily gain access to your system using the following password:
    Code:
    ' or 1 = '1
    Worse, they can even do:
    Code:
    '; DROP DATABASE user_info; #
    The correct usage is:
    Code:
    $username = $_POST['UName'];
    $password = $_POST['PWord'];
         
    $query = "SELECT username, pword, usertype FROM user_info WHERE username = '$username' AND pword = '$password'";
    $result = mysql_query(mysql_real_escape_string($query));
    The best way to prevent SQL injection attacks, however, is to use PDO Prepared Statements.

    Regards,


    [ simon.cpu ]

  3. #33
    OT: question lang guys. Wla bay API sa PHP nga simple username and password ang imo i pass, then let the server do the authentication? Sa J2EE man gud, pwede gamit og JAAS then let the server authenticate. simple xml config and simple html. Curious lang ko. Thanks.

  4. #34
    ako sad ask sad ko bahin salog-in!

    unsaon pag eror trap sa log-in username and password?

    if ang username nya is like this>> UseRname or password is like this> PassswoRD

    unsaon pagtrap ani na case sensitive siya?

    kay ang ako gud mosolod sya or true sya kng ang case kay all caps or not or combination!

  5. #35
    mosolod sya basta sakto lang ang username/password bisag dili parehas ug case?
    naa bay built in function ani or maghimo jud ta??
    cge salamat sa n u mga master!

  6. #36
    bai, e change ang field type to binary para maka case sensitive ka.

    den...kung gusto ka more secure..try to encrypt the password, ayaw gamit sa mysql function ecryption...gamit ug code na imo settings ang encryption.. ma decode man gud ghpon ang encryption function sa mysql. himo ug function gamit ang php para mo encrypt ug data.

  7. #37
    Quote Originally Posted by simoncpu View Post
    Code:
    $username = $_POST['UName'];
    $password = $_POST['PWord'];
        
    $query = "SELECT username,pword,usertype FROM user_info WHERE username = '$username' AND pword = '$password'";
    $result = mysql_query($query);
    From a security perspective, the above code is absolutely not advisable. Crackers can easily gain access to your system using the following password:
    Code:
    ' or 1 = '1
    Worse, they can even do:
    Code:
    '; DROP DATABASE user_info; #
    The correct usage is:
    Code:
    $username = $_POST['UName'];
    $password = $_POST['PWord'];
         
    $query = "SELECT username, pword, usertype FROM user_info WHERE username = '$username' AND pword = '$password'";
    $result = mysql_query(mysql_real_escape_string($query));
    The best way to prevent SQL injection attacks, however, is to use PDO Prepared Statements.

    Regards,


    [ simon.cpu ]
    dili diay na i automatic escape sa php ang mga lines nga naay ' ug ". . ?

  8.    Advertisement

Page 4 of 4 FirstFirst ... 234

Similar Threads

 
  1. Help with PHP code problem
    By senpai91 in forum Websites & Multimedia
    Replies: 3
    Last Post: 11-13-2012, 10:38 AM
  2. Need a little help with PHP timed content
    By junmar4 in forum Programming
    Replies: 6
    Last Post: 07-19-2012, 10:11 AM
  3. need help with php
    By snowleopard in forum Websites & Multimedia
    Replies: 5
    Last Post: 12-01-2011, 08:49 AM
  4. need help with my php code
    By silveroni in forum Programming
    Replies: 3
    Last Post: 10-16-2010, 08:50 AM
  5. could anyone help me with php and javascripts
    By isaac42 in forum Programming
    Replies: 6
    Last Post: 05-07-2009, 02:24 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
about us
We are the first Cebu Online Media.

iSTORYA.NET is Cebu's Biggest, Southern Philippines' Most Active, and the Philippines' Strongest Online Community!
follow us
#top