php

Easy Rundown, Comprehensive phpDocumentor Tutorial?

I find the one available at the website to be very overwhelming for a newbie at this. Is there a better tutorial out there, one that takes it a little slower, instead of throwing 3 long php source files at you? Edit: Is there really nothing else besides the manual??? D: ...

what's the max characters generated by a base 10 to 36 conversion of a crc32 value

what's the maximum number of characters generated by the following statement? i need to format the output properly. echo base_convert(sprintf('%u',crc32($_string)),10,36); ...

PHP Wamp is not finding a file which exists

I'm having a critical issue where my WAMP installation for PHP 5.3.0 is not finding a file which exists within my computer. Does anyone know anything about this? Possibly a PHP Bug? Any help would be much appreciated. Here is the variable which creates the file: $baseNewsUrl = "C:/reviews/reviews/$platform/$fullname"; And here is th...

JSON data response from PHP server is empty

I'm having a hard time figuring this one out. Seems like no matter what I try, PHP always ends up returning an empty array. Here's the code of my main file(index.php): <script language="javascript" type="text/javascript"> $(document).ready(function(){ $(".ajaxlink").click(function() { callServer(); return false; //Stop link ...

What situations demand the use of eval() because there are no alternatives?

I know eval should be avoided in JavaScript for speed and security reasons. But in the case of PHP, rarely is security ever mentioned. More often, it's your program running slower than it should because of a haphazard use of eval. In what specific situations should you use eval because there is no other way around it? For clarity: We'...

PHPUnit - testing file inclusion methods (include, require, require_once)

I'm writing and testing a ClassLoader component, which can be instantiated many times, with various mappings between class names and their relevant paths. Each ClassLoader should work as a loader for a specific package. Is there an easy, unobtrusive way to test or mock inclusion of files handled by the ClassLoader? Let me clarify with ...

how to get last x facebook message + answer with php??

Hi, Is there a way to get my latest facebook message +comments to show on my own website? ...

PHP /MySQL - *-to-Many Relationships

Howdy! So, I understand how the relationships work in mysql but I'm having a hard time figuring out how its implemented in my code. For example, say I have the 3 tables. Table 1: users - user id, username, user city Table 2: categories - category id, category name Table 3: user_categories - user id, category id If I were to query...

Make this query safe?

Possible Duplicate: Best way to stop SQL Injection in PHP I have seen some of examples that use something called a PDO to make a query safe from sql-infection, or others that use real_escape, but they all seem to be incomplete or assume some knowledge. So I ask, take this simple update query and make it safe from sql-injection...

CakePHP 1.2.6 / PHP5.2.12 Error in Array Loop in Assignment by Reference

I'm working on retrieving a stack of data and for some reason some of the data gets corrupted. For instance, I've got some Post models that each are related to Comment models (hasMany), and each of the Comment models belongsTo a User. When retrieving the data, here's what I get from the database for the comments: [Post] => Array ( ) [...

Login without HTTPS, how to secure?

For a webapplication, when HTTPS is not available as a security measure, is it possible to still make the login somewhat secure? E.g.: Tokenize logins, to make repeat attacks difficult? Somehow encrypt the sent password from a HTML password field? In particular I'm using CakePHP and an AJAX POST call to trigger authentication (includ...

Return dates of current calendar week as array in PHP5

How would I put together a PHP5 function that would find the current calendar week and return the dates of each day in the week as an array, starting on Monday? For example, if the function were run today (Thu Feb 25 2010), the function would return an array like: [0] => Mon Feb 22 2010 [1] => Tue Feb 23 2010 [2] => Wed Feb 24 2010 [3] ...

How to remove a long word from a string

If a user types a really long string it doesn't move onto a 2nd line and will break a page on my site. How do I take that string and remove it completely if it's not a URL? ...

How can I search all of the databases on my mysql server for a single string of information

I have around 150 different databases, with dozens of tables each on one of my servers. I am looking to see which database contains a specific person's name. Right now, i'm using phpmyadmin to search each database indvidually, but I would really like to be able to search all databases and all tables at once. Is this possible? How wou...

PHP Try-Catch Failing to Catch (Not a 'Warning')

I have some PHP code that should cause and catch two exceptions: try{ @$this->connector->connect(); // Suppress the default warning (doesn't effect 'throw') } catch(BadArgumentException $e) {} // Works, no error, following code executes. try{ @$this->connector->connect(array('user' => 'Doesn\'t exist', 'pass' => 'invalid')); } ...

exec function doesn't work

Hi, I found this code from http://kevin.vanzonneveld.net/techblog/article/convert_anything_to_tree_structures_in_php/, but I couldn't get it work. I am working on WIndow environment and the path I use is /sellable where the sellable is the folder inside the working folder : if(exec("find /etc/php5", $files)){ // the $files array no...

SELECT '0' AS variable ... with Zend_Db_Select

I am trying to create a select statement that uses the following structure: $db ->select() ->from( array('i' => ...), array('provisional', 'itemID', 'orderID')) ->columns(array("'0' AS provisionalQty", "'ballast' AS productType")) ->joinLeft( array('o' => ...), 'i.orderID = o...

Am I in an IFRAME, how do I figure it out in PHP?

How do I figure out in my PHP's code if I am in an iframe or not? I'd like the page to behave slightly differently. I was going to use HTTP_REFERER but that doesn't seem very reliable. ...

Input filtering in PHP?

Is this link sufficent for example for input filtering form data? With a post for example? <?php $var=300; $int_options = array( "options"=>array ( "min_range"=>0, "max_range"=>256 ) ); if(!filter_var($var, FILTER_VALIDATE_INT, $int_options)) { echo("Integer is not valid"); } else { echo("Integer is valid"); } ?> ...

Facebook.php and facebookapi_php5 documentation

Wher can I find a good documentation on these two PHP files and a more detail & indepth use of each function? Facebook documentation is... not informatitve enough. lol ...