Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 24
  1. #11

    Quote Originally Posted by cardwell164 View Post
    yes sir ahehe. kang alex garret ni nga tutorial gikan. thnks kaau sa inyo mga reply. gamit man diay ni istorya.net ui kay kusog mo tabang mga tao diri. dili pa man ko master aning php mao nang ngita kog tabang if d na jud nako kaya hehe
    +1 nindot gyud ang tutorials ni alex

  2. #12
    Quote Originally Posted by luisxcore View Post
    sir noob question lang , unsa ang mas OK using $_SERVER['REQUEST_METHOD'] or simple $_POST ra? unsay difference nila?
    is just an extra layer of security... it can be done also with isset($_POST), kanang REQUEST_METHOD is variable where the server sets if the passed user variables are either $_GET or $_POST, either way its an old practice or should i say habit that i always used...

    id prefer to use isset() over empty() i have bad experienced on empty specially if the variable is not set... i only use to check if certain variable has string value or not for array i use is_array() but i use it with isset unless im sure the variable is already defined...

  3. #13
    Quote Originally Posted by salbahis View Post
    is just an extra layer of security... it can be done also with isset($_POST), kanang REQUEST_METHOD is variable where the server sets if the passed user variables are either $_GET or $_POST, either way its an old practice or should i say habit that i always used...

    id prefer to use isset() over empty() i have bad experienced on empty specially if the variable is not set... i only use to check if certain variable has string value or not for array i use is_array() but i use it with isset unless im sure the variable is already defined...
    sa akong pag sabot sa empty() mu return siya ug false if dli cya empty or dli zero ang value, for isset() kay mu return sya ug true even if ang value niya 0 or empty string otherwise if null mu return cya ug false. sakto ba?

    good to hear some ideas from an expert
    thank you sir!

  4. #14
    Quote Originally Posted by luisxcore View Post
    sa akong pag sabot sa empty() mu return siya ug false if dli cya empty or dli zero ang value, for isset() kay mu return sya ug true even if ang value niya 0 or empty string otherwise if null mu return cya ug false. sakto ba?

    good to hear some ideas from an expert
    thank you sir!
    Just for clarification...
    "empty" is used to determine whether it is empty or not.

    Code:
    $variable_arr = array();
    if(empty($variable_arr)){
        // returns true because we have an empty
    }
    "isset" on the other hand determines whether the variable is declared or not.

    Code:
    $variable = "";
    
    if(isset($variable)){
        // returns true because we have the variable declared before the if statement
    }

  5. #15
    Quote Originally Posted by scrupulous View Post
    Just for clarification...
    "empty" is used to determine whether an array is empty or not.

    Code:
    $variable_arr = array();
    if(empty($variable_arr)){
        // returns true because we have an empty array
    }
    "isset" on the other hand determines whether the variable is declared or not.

    Code:
    $variable = "";
    
    if(isset($variable)){
        // returns true because we have the variable declared before the if statement
    }
    ang empty pwede nmo magamit not just in array, u can also evaluate 1 or 0..
    if u know the restrictions, better mogamit ug empty kaysa isset..ang problema sa isset kung imong gi evaluate way sulod (na declare but y sulod)...thats y better ang empty IF you know the restrictions.

  6. #16
    Quote Originally Posted by ondoy View Post
    ang empty pwede nmo magamit not just in array, u can also evaluate 1 or 0..
    if u know the restrictions, better mogamit ug empty kaysa isset..ang problema sa isset kung imong gi evaluate way sulod (na declare but y sulod)...thats y better ang empty IF you know the restrictions.
    Yep, not just an array and I "sit" corrected. Lol

    P.S. Not restrictions but considerations.

  7. #17
    aw, considerations diay hehehe

  8. #18
    mga sir thank you gyud kaayo sa mga help. however naa nsad another problem ni arise huhu. i hope mo tabang gihapon mo hehe.

    mao ni ang situation, gusto nako ipa display si $data para maka hibaw ko if ni work ba or ma pasa ba jud ang query. kaso sa pag display pa lang d na man mo gawas. i dont know if asa dapita ang error if sa syntax ba sa sql or something wrong jud sa php code nako. anyway mga bros here it goes

    mao ni ako init.php

    Code:
    <?php
    session_start();
    
    require 'database/connect.php';
    require 'functions/general.php';
    require 'functions/users.php';
    
    if (logged_in() == true)
    {
    	$session_user_id = $_SESSION['userid'];
    	$user_data = user_data($session_user_id, 'userid', 'username', 'password', 'firstname', 'lastname', 'email');
    }
    
    $errors = array();
    ?>
    and mao ni akong users.php. ang ako lang gi include diri is ang kato rang function nga feel nako naa ang error mahitabo

    Code:
    function user_data($userid)
    {
    	$data = array();
    	$userid = (int)$userid;
    
    	$func_num_args = func_num_args();
    	$func_get_args = func_get_args();
    
    	if($func_num_args > 0)
    	{
    		unset($func_get_args[0]);
    		$fields = '`' . implode('', $func_get_args) . '`';
    		$data = mysql_fetch_assoc(mysql_query("SELECT '$fields' FROM users WHERE userid = '$userid'"));
    
    		print_r($data);
    
    		return $data;
    	}
    }
    hinaot maka tabang gihapon mo nako

  9. #19
    Bro, if u hav problem relating to DBs query etc...check ur query first, best way is imo e print imong query (kanang select nmo) din e ipa run dritsu saimo DB pra ka assur ka wlay prob imong query statement ayha ka mg test saimong mga variables.

  10. #20
    i noticed something that is problem waiting to happen... i noticed that you typecast $userid, why not check it if its string or integer before doing the main code.... it can be solved simple ethier by $userid > 0 or !is_int($userid) or is_numeric($userid)...

    salbahis 3 rule in anti-code injection

    #1 Always know where the variable came from
    #2 Always check its content and escape if necessary
    #3 Never use globals

  11.    Advertisement

Page 2 of 3 FirstFirst 123 LastLast

Similar Threads

 
  1. unsay 1st forum ang imong e view inig log in nimo sa istorya.net?
    By chill_angel25 in forum General Discussions
    Replies: 201
    Last Post: 09-09-2015, 05:12 AM
  2. Replies: 23
    Last Post: 11-28-2012, 08:33 AM
  3. Replies: 17
    Last Post: 06-28-2012, 03:54 PM
  4. Replies: 0
    Last Post: 02-18-2010, 12:20 PM
  5. ned help abt sa program on log in and out sa cafe......
    By blossom1021 in forum Programming
    Replies: 3
    Last Post: 10-18-2006, 07:17 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