php

search site and web in joomla

We have created a web using Joomla CMS. In this site we want to implement a feature by which a use can search for text in our website as well as on the whole web using some search engine like google or yahoo. Is there any extension available which will allow one to search web site it is hosted on as well the whole web in a Joomla based ...

PHP script stops running arbitrarily with no errors.

I was working on a fairly long script that seemed to stop running after about 20 minutes. After days of trying to figure out why, I decided to make a very simple script to see how long it would run without any complex code to confuse me. I found that the same thing was happening with this simple infinite loop. At some point between 15 an...

oAuth with PHP (for google api)

How to use oAuth with PHP ? I can't install oauth class with pecl because I'm using share hosting. I found http://code.google.com/p/oauth-php/ but there is no example for client. I want to use oauth for Google API. ...

GWT with -noserver

I'm making a GWT project that uses PHP to connect to a DB2 database. When I compile the project and deploy it to the server (copy the contents of the WAR directory over), it works fine, obviously in hosted mode I run into the SOP issue since GWT is on port 8888 while the php script is running on port 80. I'm trying to get the -noserver ...

Logging dynamically served files in APACHE

I'm serving up Zip and PDF files on the fly via PHP using an output such as: header('Content-Disposition: attachment; filename="'.$project->name .'.zip"'); echo($zipfile->zl_pack()); I can't find any reference to these downloads in my APACHE logs though. Is it not logged due to being dynamic? Do I need to actually write the file to t...

How to reduce this code?

Is there any way to shorten this code: $resultCategoryName = mysql_query("SELECT ecname FROM electioncategorymaster WHERE ecid=".$Category); $rowCategoryName = mysql_fetch_row($resultCategoryName); $CategoryName = $rowCategoryName[0]; ...

help with glob regexp

would be nice if someone could give me a regexp pattern for glob for getting below filenames: 1.jpg // this file 1_thumb.jpg 2.png // this file 2_thumb.png etc... just returning the files without "_thumb". cause i got this regexp: $numericalFiles = glob("$this->path/*_thumb.*"); and that give me all with "_thumb." thanks ...

Architecture for a farmville/yoville/cafe world type game?

I'm thinking of building a game along the lines of Farmville - items, events, time management system etc. Options I am thinking of: 1) Flash UI frontend that uses AMFPHP to get all data for the view from a PHP powered backend. 2) Actionscript to power the whole game Any input is appreciated. My concern with Actionscript is scaling, my ...

How to update sql like this?

Hey,i've got a problem, i want to execute this sql update, but it doesn't work. Could anyone help me? Thanks! The code: $temp = $_GET['ul']; foreach ($temp as $key=> $value) { $str=array(); $arr=explode(',',$value); $str =array($key=>$arr); for($i=0;$i<count($str[$key]);$i++) { $tripID='2'; ...

php single quote search

hi, i want to search mc'd in my database,but i use mysql_real_escape_string but nothing found bcos it will output mc\\'d any idea, ...

Getting the last second of the Day

In PHP 5.2, how to get the last second in a day? time() + 86400 gets the next Day only? ...

PHP: Foreach scoring help

I have this php that scores a test based on hourly answers: $score_a = 0; foreach(array(4,5,10) as $a){ if ($a >= 2 && $a <= 4) { $score_a += 1; } else if ($a > 4 && $a <= 8) { $score_a += 3; } else if ($a > 8) { $score_a += 0; } }; I need the final "else...

Looking for a BASIC interpreter implemented in PHP

Does anyone know of a PHP program that will interpret BASIC code? I have seen a LOLCODE implementation that looks like it's a good place to start, but if anyone has already developed something like that, i'd be grateful. ...

How to create a Joomla template?

I am working on my first joomla template but there are certain things that are confusing me. I want the template to work as having three column layout in the home page and then there are two column layout pages in the website. Another page also has three column layout. So i was wondering how would I implement this runtime layout switchin...

trying to track where my visitor comes from using php

$referal = mysql_real_escape_string($_SERVER['HTTP_REFERER']); I would like to store this the first time the visitor comes to my site through a referer. so when this page is accessed again, the variable will not change. ...

Exploding and replacing one array field

So, I have an array that, for unrelated reasons, has one imploded field in itself. Now, I'm interested in exploding the string in that field, and replacing that field with the results of the blast. I kinda-sorta have a working solution here, but it looks clunky, and I'm interested in something more efficient. Or at least aesthetically pl...

sortable is not sorting?

hey guys, i've been trying to sort a table using ajax for sometime now but the table doesn't sort at all. what could be the problem? im using sorttable.js (http://www.kryogenix.org/code/browser/sorttable/) this is the code im using any help offered will be appreciated <script src="resources/sorttable.js" type="text/javascript"></scr...

Alternative for deprecated PHP function: eregi_replace

Do anyone know a good alternative for the deprecated eregi_replace function? I need it for this sniplet: $pattern = "([a-z0-9][_a-z0-9.-]+@([0-9a-z][_0-9a-z-]+\.)+[a-z]{2,6})"; $replace = "<a href=\"mailto:\\1\">\\1</a>"; $text = eregi_replace($pattern, $replace, $text); Thanks! ...

File creation time

How do I sort a directory by file creation, latest first in PHP 5.2? I am on Windows 2000. ...

getting image src in php

how to get image source from an img tag using php function. ...