php

Getting a random string within a string

I need to find a random string within a string. My string looks as follows {theme}pink{/theme} or {theme}red{/theme} I need to get the text between the tags, the text may differ after each refresh. My code looks as follows $str = '{theme}pink{/theme}'; preg_match('/{theme}*{\/theme}/',$str,$matches); But no luck with this. ...

Single Sign-On ASP.NET and PHP

Hello We have a site made in .NET 3.5 with a multiplexed membership/role provider, and a connected PHP site (on a different server) which uses the same users (or partly atleast) and we are looking into the posibility of using a single sign-on and i'm wondering if others have done something like this that works. When the PHP site's auth...

Array with 500 numbers to make quick toplist template

I need to make an array in php that will output an html table so I can grab the source. ##id:1## ##site:1## ##id:2## ##site:2## etc. 500 times over. ...

Gzip and Cache PHP Code

Hello, Here is my PHP Code $phpver = phpversion(); $useragent = (isset($_SERVER["HTTP_USER_AGENT"]) ) ? $_SERVER["HTTP_USER_AGENT"] : $HTTP_USER_AGENT; $do_gzip_compress = FALSE; if ($phpver >= '4.0.4pl1' && (strstr($useragent,'compatible') || strstr($useragent,'Gecko'))) { if (extension_loaded('zlib')) { ob_start('ob_gzhand...

PHP Returning References

Returning by reference is useful when you want to use a function to find to which variable a reference should be bound. Do not use return-by-reference to increase performance. The engine will automatically optimize this on its own. Only return references when you have a valid technical reason to do so. whats does the...

Using php information in jQuery

I am trying to get a variable from the php code and put it in jquery i have tryed this and it does not work can anyone help me? < script type="text/javascript" src="js/jquery.query-2.1.6.js"></script> <? $next_exp = 123; ?> $(document).ready(function() { var next_exp = $.query.get('next_exp'); $("#pb5").progressBar({ max: next_exp...

Forum script for PHP + MSSQL

I have website in PHP+MSSQL on IIS and I need some forum script for that site. Any ideas? As far as I know the Phorum script is optimized strictly for MySQL. Maybe the PhpBB, I've seen a few tutorials for that, but they are a little complicated. Is there some PHP forum script dedicated to MSSQL? ...

Correct PHP Session and variable syntax

The following syntax is incorrect: $_session['page'$numberpages]=$CurrentPage; What is the correct syntax? ...

Wildflower CMS is NOT a CakePHP plugin...Baked Simple CMS IS a CakePHP plugin...what's the difference?

Hello, I just started playing with CakePHP and I found Wildflower CMS . I like the idea and am going to start tinkering with it. I have a question, though. In the README, I found the following: "Wildflower is not and won't be a CakePHP plugin". What's the difference between Wildflower and something like 'Baked Simple', which claims to...

how to handle email messages like posterous.com does in PHP ?

Hi, Lets say I have a web application on web.com and I want to scan email address [email protected]. Based on sender email address I want to put email content on user account in web.com. Web.com is PHP application. Is there any simple way to hook up to mail server to be notified when new mail arrives ? ...

Site wide Zend_Form

How can I add a form to my layout.phtml? I would like to be able to have a search form and a login form that persists through every form on my site. ...

PHP way to find the web server's temp path?

When you handle an HTTP upload, the file is uploaded to $_FILES['field_name']['tmp_name'], I know I could extract the temp path from there. But I was expecting maybe a $_SERVER[] param that had the temp path (there's none) or other elegant way of knowing it. Is there any? ...

How to make Joomla FaceBook connect to post Wall Entries?

I'm kinda stuck: Trying to make Joomla's JFBConnect post on the user's FB wall some of the user's actions on the website (forum posts, comments, favorites etc.) Any ideas? API references? Any related Joomla/FB documentation? Thank you! ...

Zend_Search_Lucene query parsing problem

Here's the setup, I have a Lucene Index and it works well with the 2,000 documents I have indexed. I have been using Luke (Lucene Index Toolbox, v.0.9.2) to debug queries, and am using ZF 1.9. The layout for my Lucene Index is as follows: I = Indexed T = Tokenized S = Stored Fields: author - ITS category - ITS publication - ITS public...

How do i validate XML against a schema (php or perl or possible C++)

I need to take in XML and validate it against a schema file. Afterward i must call a function based on the command (example updateContactList). What is the best way to do this? I am worried about validating the XML (and report errors) and i have no idea what is the best way to put the data into a function to run -edit- NOTE: By validati...

Make cURL write data as it receives it

Hello everybody, I have the following php code which I found here: function download_xml() { $url = 'http://tv.sygko.net/tv.xml'; $ch = curl_init($url); $timeout = 5; curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout); $data...

Repair Broken Nested Set

Hi, I have to repair broken nested set chains via script or sql. The table contains a left and a right value column, but no parent id column. I am able to compute the level of each node within the nested set. There are gaps in left and right values. The structure of computed levels is valid. Does someone know a solution to close the gaps...

Php simple caching technique for small-mid size websites

Hi, I was looking for HTML/Text content caching for small-mid size site using php. I'll mostly save the dynamic navigation-menu for site, generated HTML report from DB etc. Primarily I am looking for session based caching (is it a bad idea?). It can also be file based. Any existing solution is much appreciated. For example Zend Framewo...

strstr to show string before occurance

I want to get the first bit of the string after the occurrence of the needle like this... $user = strstr('[email protected]', '@', true); But this only works with PHP Version 5.3.0, I have 5.2.9 Is there a way I can get the same results? ...

Run a php code every 1 minute.

Hi all, I need to execute my php code every minute. is there any way to do that. help me please.??? Thanks in advance. Shibin ...