php

PHP MD5 implementation

I'm currently attempting to code one for part of a college project - binary/hex handling and cryptographic functions are well regarded in the mark scheme, so I thought I'd kill two birds with one stone. However, the documentation availible on the algorithm itself is thorough but confusing. Is there a prexisting PHP libary/class that I c...

Warning: Invalid argument supplied for foreach() in E:\xampp\htdocs\piecework\groupcheck.php on line 2

while ($row= mysql_fetch_array($result, MYSQL_ASSOC)) { $id=$row[id]; $html=<<<html <tr><td> <input style="float:left" type="checkbox" id="$id" name="myBoxes[$id]" value="true"> <span style="float:left">$row[content]</span> <span style="color:black;float:right">$row[submitter]</span></td></tr> html; echo $html; } $html=<<...

How can I get a host computer unique ID in PHP ?

Hi I need to come up with a way to uniquely identify computers. Something like the system id or info from CPU that can't be hacked easily be obtained in php application run time and then sent over the internet to a central database to activate or validate license keys. System Info: Web Shared Hosting or Local network Linux(can be a...

Splitting up html code tags and content

Does anyone with more knowledge than me about regular expressions know how to split up html code so that all tags and all words are seperated ie. <p>Some content <a href="www.test.com">A link</a></p> Is seperated like this: array = { [0]=>"<p>", [1]=>"Some", [2]=>"content", [3]=>"<a href='www.test.com'>,...

How to check if mysql returns null/empty

In by DB I have a table with a field called 'fk_ownerID'. By default, when I add a new table row, the 'fk_ownerID' is empty. In Toad for MySQL, this is shown as {null}. If 'fk_ownerID' is given a value, and I later remove this value, I set fk_ownerID = "". Now, I have the following code: $result = $dal->getRowByValue('tableName','id', ...

Interakt replacement module for Dreamweaver OR PHP editor

Hi, I have worked for years with Dreamweaver and Interakt extensions to build hundreds of PHP websites. Interakt was great for me because I could develop PHP websites and small back offices in a couple of hours. Integrated modules like 'file upload', image resizing, automatic table creation,... were tools I used and that I still need tod...

debugging php on mac?

Hi All, was wondering what was the best way to debug PHP on my local machine. I use MAMP on mac os 10.5 thanks, Patrick ...

How retrieve category name?

I have two tables. Categories and products.(using codeigniter) Categories CREATE TABLE IF NOT EXISTS `categories` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(255) NOT NULL, `shortdesc` varchar(255) NOT NULL, `longdesc` text NOT NULL, `status` enum('active','inactive') NOT NULL, `parentid` int(11) NOT NULL, PRIM...

open external url in div

i want to load contents of external url like (http://www.google.com) into div, i the way which will readable by search engine crawl. in any one of (jquery / ajax / php ) Thanks ...

How do I create an XML file with php and have it prompt to download?

I'm using domdocument to create an xml file: $dom = new DOMDocument('1.0', 'iso-8859-1'); echo $dom->saveXML(); When I click the link to this file, it simply displays it as an xml file. How do I prompt to download instead? Furthermore, how can I prompt to download it as 'backup_11_7_09.xml' (insert todays date and put it as xml) inste...

How do you get a Cronjob executing a PHP script to run longer than 30 seconds.

Could you rewrite this into a cron that will run every day for longer than 30 seconds. Also, do i need to edit the .htaccess or php.ini file in the cron.php directory to say something. Over the browser it runs just fine for longer than 30 seconds, over the shell, it runs just fine too. But as a cron set task, it dies after 30 seconds. Im...

can someone explain what this php code is doing or its purpose

here is the snippit $thisFile = str_replace('\\', '/', __FILE__); $docRoot = $_SERVER['DOCUMENT_ROOT']; $webRoot = str_replace(array($docRoot, 'library/config.php'), '', $thisFile); $srvRoot = str_replace('library/config.php', '', $thisFile); if i save this into test.php as a file. the section that im getting confused on is how the...

Finding a logic bug in converting Python code to PHP

The input 7|12|1|14|2|13|8|11|16|3|10|5|9|6|15|4 returns 0 by the PHP -code, while 1 by Python code: 1 means that the sums of the 4x4 magic square are the same, while 0 means the reverse. Python code is correct. The problem of the PHP code seems to be in the function divide's for -loop, since PHP gives too many sums. How does the logi...

can DOMXPath::query be limited to a certain depth?

Is there a way to limit the depth DOMXPath::query will look at? Consider the following document: <div> <span> <div> </div> </span> </div> How could I limit the query //div So it only matches the first level and not the descendants? ...

CakePHP Pagination with conditions on has_many

So I have a User table and a History table with User hasMany Histories, and I'm trying to implement pagination on the user table. My problem is that I have search, and some of the things one can search by are things in the History table. Is there a way to filter pagination results based on data in a table associated by hasMany? Containa...

Zend Form add error message

Hi I did register form in with zend form $password = new Zend_Form_Element_Password('password'); $password->setLabel($this->_translate->_("Password:")) ->setRequired(true) ->addValidator('stringLength', true, array(4, 32)); $confirmPassword = new Zend_Form_Element_Password('confirmpassword'); $confirmPassword->setLabel($this->_...

Beginner to PHP web services

What is the best way to implement web services in PHP? I have heard about libraries like NuSOAP and WSO2 web service platform, But don't know what is the best ( or a good and easy to learn) for using web service in PHP? ...

Iteration through arrays in arrays PHP

Hello How can i itarate this array array(2) { [0]=> array(1) { [0]=> array(14) { [0]=> string(17) "ratosk8@censored" [1]=> string(23) "alokkumar.censored" [2]=> string(24) "uuleticialima1@censored" [3]=> string(23) "camera.clicks@censored" [4]=> string(24) "billtha...

how can i detect hebrew characters both iso8859-8 and utf8 in a string using php

I want to be able to detect (using regular expressions) if a string contains hebrew characters both utf8 and iso8859-8 in the php programming language. thanks! ...

php include path changing based on file

I'm brand new to php and I'm trying to work with some includes in my site and can't quite figure out how to make them all work correctly. My site structure is as follows /ROOT/ Config.php Index.php /ADMINISTRATION/ Index.php mustInclude.php /USERS/ Index.php If "mustInclude.php" includes "Config.php...