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

    Default Re: Help with my php code


    Quote Originally Posted by salbahis View Post
    can be prevented if they use mysql_real_escape_string or mysql_escape_string (DEPRECEATED)

    there are lot of possible solutions but this are the straight forward one... always use this if you have form that interact with your database or else ma inject-kan ang imo db...
    mao jd sakto jd c salbahis. mysql_real_escape_string kay gamit kayo mao jd ni gamit sa mga programmers mostly.

  2. #32
    Elite Member
    Join Date
    Jun 2010
    Gender
    Male
    Posts
    1,018

    Default Re: Help with my php code

    @boang3000 and @salbahis?
    asay mas effective og gamit compared to prepared statements?
    Prepared statements ang akoang current ron...Hehehe

  3. #33

    Default Re: Help with my php code

    mysql_real_escape_string lang kay basaha ni nga link kay d ko khbw mo explain bsta related to sql mao jd na gamiton PHP: mysql_real_escape_string - Manual.

    md5 kay gamit sad na xa for encrypting what about filters?

  4. #34

    Default Re: Help with my php code

    Quote Originally Posted by Klave View Post
    @boang3000 and @salbahis?
    asay mas effective og gamit compared to prepared statements?
    Prepared statements ang akoang current ron...Hehehe
    depende sa imo need, either way the most important thing is the results if it satifies you and client then thats fair enough

    there are pros and cons sa prepared statements it has better security but it is quite slow in executing, considering that it is prepared you dont have and option to further optimize and make execute faster....

    there no such thing as a perfect code, only better!!

  5. #35

    Default Re: Help with my php code

    Simplified user login authentication

    PHP Code:
    $user_name mysql_real_escape_string($_POST['user_name']);
    $user_password mysql_real_escape_string($_POST['user_password']); 
    if you want to add more password security you can use hashing by using md5, the downside is, md5 is a one-way encryption procedure, it only ecrypt but it cant decrypt most website uses this type of encryption along side with adding salt to the parameter, in this way to retrieve the password you have to regenerate it again

    PHP Code:
    // With salt
    $user_password md5('salbahis-gwapo@'.$user_password);

    // Without salt
    $user_password md5($user_password); 
    To make this query works MORE better, you have to make sure the table structure of user name are set to UNIQUE, or atleast all data save on that field are unique

    PHP Code:
    $res mysql_query("SELECT TRUE AS is_exist FROM user_table WHERE username='".$user_name."' AND password='".$user_password."'");
    $isfound mysql_fetch_object($res);
    if(
    $isfound->is_exist){
        
    // OK
    }else{
        
    // Not OK

    or this one

    PHP Code:
    $res mysql_query("SELECT COUNT(username) AS _count FROM user_table WHERE username='".$user_name."' AND password='".$user_password."'");
    $user mysql_fetch_object($res);
    if(
    $user->_count == 1){
        
    // OK
    }elseif($user->_count 1){
        
    // Duplicate username
    }else{
        
    // Not OK

    and another one

    PHP Code:
    $res mysql_query("SELECT username FROM user_table WHERE username='".$user_name."' AND password='".$user_password."'");
    $num_rows mysql_num_rows($res)
    if(
    $num_rows == 1){
        
    // OK
    }elseif($num_rows 1){
        
    // Duplicate username
    }else{
        
    // Not OK


    dili kay simplified ang code sample ninyo so i made it simplified...
    Last edited by salbahis; 01-31-2012 at 12:27 PM.

  6. #36

    Default Re: Help with my php code

    Hello istoryans.

    kinsay naay code sa php log in log out
    pwede ku manga yu sa code maglisod kog connect sa mysql database
    daghan error.
    Design ra jud akong mahimo pero sa functionality sa program daghan jud
    error..
    pls give me the code of php log in log out..k ng ma k connect ku sa database..

    i hope naay muhatag sa code..


    tnks..& god bless..

  7. #37

    Default Re: Help with my php code

    hello kinsay naay code sa php log in log out?
    ka ng ma k connect ku sa database,
    pwede ku mangayu?

    tnks..

  8. #38

    Default Re: Help with my php code

    Quote Originally Posted by domzky View Post
    hello kinsay naay code sa php log in log out?
    ka ng ma k connect ku sa database,
    pwede ku mangayu?

    tnks..
    try ngadto sa php.net or w3school.com to tana imo kinahanglan... if not google is your friend

  9.    Advertisement

Page 4 of 4 FirstFirst ... 234

Similar Threads

 
  1. need help with my php code
    By silveroni in forum Programming
    Replies: 3
    Last Post: 10-16-2010, 08:50 AM
  2. help with my samsung phone!!!!!!!!!! samsung d820
    By v2s13 in forum Gizmos & Gadgets (Old)
    Replies: 1
    Last Post: 08-17-2006, 01:24 PM
  3. help with my dial-up connection...
    By kaede in forum Networking & Internet
    Replies: 7
    Last Post: 02-08-2006, 04:24 AM
  4. MOVED: help with my dial-up connection...
    By Visual C# in forum Software & Games (Old)
    Replies: 0
    Last Post: 02-08-2006, 02:09 AM
  5. help with my old tape collection
    By steelwater in forum Music & Radio
    Replies: 3
    Last Post: 10-22-2005, 10:39 AM

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