php

How to create HTTP server push (also known as HTTP streaming) with PHP?

How to create HTTP server push (also known as HTTP streaming) with PHP (better streaming video)? Tuts Libs are vary welcome ...

mysql query if statement

To keep this simple, let's say I'm making a basic pageview counter in php that stores the counts for each page in a mysql table. The table had 2 colums: PAGE_ID and COUNT. I added the following code to every page: $query = "INSERT INTO table VALUES ('$page_id', '1') ON duplicate KEY UPDATE COUNT=COUNT+1"; $result = mysqli_que...

A tool to find and fix incomplete source code documentation

I have several finished, older PHP projects with a lot of includes that I would like to document in javadoc/phpDocumentor style. While working through each file manually and being forced to do a code review alongside the documenting would be the best thing, I am, simply out of time constraints, interested in tools to help me automate t...

Bit Manipulation and MySQL Retrieval in PHP

I am trying to optimize my mysql table a little bit in order to have a slightly more manageable table. I would like to store user permissions in a bit field. For example, a users permissions could be 0110 (I have a growing number of user permissions, so the length of this could be a bit longer) The example might correspond to the follo...

PHP: RegEx vs. ctype_*

Dear all, several months ago, you provided a perfect solution for my IsAlpha & co issues. But once again, I ran into issues after upgrading PHP (to version 5.2.9), although the ctype_* functions seem to do their job now: ctype_alpha( $value ) /* VS */ preg_match("/^[\p{L} _.\-]+$/u", $value) ctype_alnum( $value ) /* VS */ preg_matc...

compare scrambled words with an unscrambled wordlist php

Hi, i search a method to compare scrambled words with a wordlist full of unscrambled words for example: the scrambled word is "lonbayb" and somewhere in the wordlist is the word "babylon". the script should show me the unscrambled word any idea how to solve this problem? ...

Authentication using Orbited, STOMP, and MorbidQ

I'm using Orbited to build a Comet chat system on a PHP-based website. However, currently any user can subscribe or post to any channel. What I'm looking to do is have the browser listen for updates directly from the Orbited server, and have all other actions (subscribe, send) handled by a PHP authentication layer, which communicates wi...

PHP Password Protection

Hey guys, I'm making a site and it needs to have user authentication. Currently, I'm using HTTP/Basic Auth for proof of concept/development, but this is not good in production for obvious reasons(ugly, insecure, can't read from mysql db, sucky). So, I know how to do some basic auth stuff, like getting in the username and password, salti...

Compare XML in PHP without hashing

I am reading an XML feed and would like to compare to an old version to check for updates. My problems at the moment are that I can't seem to make a copy of a SimpleXML object and the other problem is I'm not sure I can directly compare them. This is my code as it stands, feel free to shoot me down if it's rubbish. I'm obviously just tes...

Resize image size according to size of text

The PHP code below generates text as a dynamically created image, how would I be able to get the image to only be as large as the text? Thanks. <?php header('Content-Type: image/jpeg'); $text='Test'; $img = imageCreate(200,200); imagecolorallocate($img, 255, 255, 255); $textColor = imagecolorallocate($img, 0, 0, ...

mod_rewrite causes loss of stylesheet

Hi there! I'm using mod_rewrite to clean up some of my URL's (duh) and I got it working. Sorta. It redirects to the correct page, but the stylesheet doesn't show up. Here's my code in .htaccess: RewriteEngine on RewriteRule ^blog/([^/\.]+)/?$ post.php?page=$1 [L] So what's going on? This is my first time working with mod_rewrite, by t...

Do I really need the Java Development Kit (JDK) when I want to develop PHP with NetBeans on the Mac?

The NetBeans people say that I need a Java Development Kit (JDK) 5 or 6 when I want to develop PHP with NetBeans on the Mac... see: "To complete this tutorial, you need the following software and resources." Now that sounds very strange to me. Must I really get that and spend some hours installing it? Why? What does Java have to do wit...

php file not outputting results

Hello, I have developed a script but whenever i open admin panel it shows just a blank page, however the same script works fine on my another server. I tried changing chmod of files and folders 644, 755, 775 and 777 but still it outputs a blank page. The main script works fine but its only admin panel thats not working. I check .htacce...

Where can I download Xdebug for PHP and Mac OS X?

I went to the xdebug site, but I can't find a mac download. http://www.xdebug.org/download.php Did I miss something? NetBeans tells me to get xdebug for setting up an PHP development environment on the mac. ...

how to call a php function from javascript or if that can't be done, some direction on what I should do

Hi, I've created a jquery dialog modal box for logging into my website: $('#login').dialog({ modal: true, position: 'center', autoOpen: false, title: 'Login', height: '750px', width: '300px', zIndex: 9999, closeOnEscape: false, buttons: { 'Login': function() { $(this).dialog('close'); $('#mask').hide();...

Group By/Threaded Messaging MySQL Prob

I'm building a private messaging system for a dating site..having troubles with a group by query. Here is the structure of the table: `id` bigint (20) NOT NULL AUTO_INCREMENT , `fromme` integer (11) NOT NULL, `tome` integer (11) NOT NULL, `subject` varchar (255) NOT NULL, `message` longtext NOT NULL, `mydate` datetime NOT NULL, `t...

Is there an output difference between php 4 and 5?

I noticed the other day that a new script I wrote for php 5 began outputting html that was viewable before the php script had actually finished. Did this happen with 4? For instance, I have a long loop that echos something out with each iteration. The output was small in terms of kb, so I dont think it was lag due to the download speed....

Problem with URL encoded parameters in URL view helper

So my problem is kinda weird, it only occurs when I test the application offline (on my PC with WampServer), the same code works 100% correctly online. Here is how I use the helper (just example): <a href="<?php echo $this->url(array('module' => 'admin', 'controller' => 'index', 'action' => ...

PHP SimpleXML get innerXML

I need to get the HTML contents of answer in this bit of XML: <qa> <question>Who are you?</question> <answer>Who who, <strong>who who</strong>, <em>me</em></answer> </qa> So I want to get the string "Who who, <strong>who who</strong>, <em>me</em>". If I have the answer as a SimpleXMLElement, I can call asXML() to get "<answer>Who w...

Creating a multidimensional array from row

How would I take an array such as this: Array ( [key1] => item1 [key2] => item2 [key3] => item3 [key4] => item4 [key5] => item5 [key6] => item6 ) php: $array = array('key1' => 'item1','key2' => 'item2', 'key3' => 'item3','key4' => 'item4', 'key5' => 'item5','key6' => 'item6'); and create a multidimensional array with every 3 val...