Jump to content

Cardale

Members
  • Posts

    278
  • Joined

  • Last visited

Posts posted by Cardale

  1. Here is another version that only displays the first level.... any help is appreciated.

            public function getBonusChildren($userID)
            {
    	// retrieve all children of $parent
    	$sql = 'SELECT userID FROM jos_backoffice_users WHERE parentID ="'. $userID .'";';
    	$stmt = conn::getInstance()->prepare($sql);
    	$stmt->execute();
    
            	while($row = $stmt->fetchObject())
    	{
                    	$memStatus = checkUserMemStatus($row->userID);
    
                    	if($memStatus == true)
                    	{
                        		$memberCounter++;
    			$this->getBonusChildren($row->userID);
                    	}
    	}
    	return $memberCounter;
    }

  2.         public function getBonusChildren($userID)
            {
    	if($userID != NULL)
    	{
    		$sql = 'SELECT COUNT(*) AS count, userID FROM jos_backoffice_users WHERE parentID= ' . $userID . ';';
    		$stmt = conn::getInstance()->prepare($sql);
    		$stmt->execute();
                    	$obj = $stmt->fetchAll(PDO::FETCH_ASSOC);
    		if(is_object($obj))
    		{
    			$obj->count += $this->getBonusChildren($obj->userID);
    		}
    	}
                    return $obj->count;
    }

     

    I get no error.  It just always return null.  How can I get this done?

  3. I have a news posting system I created and it works fine although I have issues with insertion errors.  I have avoided using add slashes because I often post code and I don't want it to interfere with that.  I would also like to be able to include html in my posts.  I have been using the html encode function and then decoding it on the way out, but this isn't really the way I want to do it and I often get errors on insertion still.

     

    Any suggestions?

  4. Whats the speed comparison with something like this? http://pear.php.net/manual/en/package.html.html-quickform.tutorial.php

     

    Seems kind of outrageous to me.

     

    You could use a function like this at the top of a header page instead of an MVC design pattern which is in my opinion over kill for a web application although the MVC pattern does make all the new graduates giddy with excitement because the first language they learned was Java and it is so object oriented.

     

    	function SECURITY($debug){
    	if((count($_POST)!=0) || (count($_GET)!=0)){
    		if(count($_POST)!=0){
    			foreach($_POST as $key => $val){
    				$val = addslashes($val);
    				$val = htmlspecialchars($val);
    				$val = mysql_real_escape_string($val); 
    				$_POST[$key] = $val;
    				if($debug==1){
    					echo "POST ARRAY - Field : $key Value: $val<br />";
    				}
    			}
    			return $_POST;
    		}elseif(count($_GET)!=0){
    			foreach($_GET as $key => $val){
    				$val = addslashes($val);
    				$val = htmlspecialchars($val);
    				$val = mysql_real_escape_string($val);
    				$_GET[$key] = $val;
    				if($debug==1){
    					echo "GET ARRAY - Field : $key Value: $val<br />";
    				}
    			}
    			return $_GET;
    		}else{
    			die("ERROR with the http phaser");
    		}
    	}
    }

     

    You would also want to make sure no one could access any script individually.

  5. I appreciate the post, but I am not sure what to do with that.  I am not trying to code a bunch of javascript and I also don't want to use some bloated library.  I just need ajax to add a +1 or -1 on my site for a user rating news system type of thing.  I have found tons and tons of them that use forms, but I was hoping to just use a link click then after it is clicked to show the results.

     

    Real simple no extras.  Thanks for any help.

  6. I need to compare an array, but I am not sure how.  I wanted to compare an array in an if statement with a GET variable.

     

    $array = array('test1', 'test2'
    );
    
    if($_GET['check']!=$array){
         $this = $default;
    }

  7. On my site I use a captcha to attempt and stop spam bots from registering at my site.  So far it has worked fairly well, but I am still getting bots probing and getting through every once in awhile.  I need to beef it up.  Any recommendations?

×
×
  • 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.