php5

Uploading a file through exec, hanging script

Basically in a nutshell is I am using exec() to run WinSCP, which is causing the script to hold until the file is uploaded. Is there anyway to make it so that the script continues, and the upload runs in the background? Running PHP 5.3.1 on Win7. ...

proc_open() path problem

Hi, i'm using linux and php 5.2.12 i have problem with executing proc_open if i use proc_open('php script.php', $descriptorspec, $pipes); it will show me error sh: /php: No such file or directory if i use proc_open('/usr/bin/php script.php', $descriptorspec, $pipes); or proc_open('php script.php', $descriptorspec, $pipes, ...

How to test more than one var if is empty in PHP?

How can i test a var if its empty or not? i have this array array($myname,$myhouse,$mywife); how can i check each of them if it empty or not without using a loop? ...

What is the Difference between PHP and ASP?

ASP is a Compiled Language or isnt it? sure it is. PHP is a Interpreted Language. I also developed once an asp app with the VS 2008 IDE. But there is a Big difference between ASP and PHP. What are the Differences? ...

Best charts for reporting with flash for php code

Any libraries for a basic chart reporting with flash and php code based on parameters we pass, I know there is open flash chart, seems to be a slightly difficult to get that going. Do you have any other alternative flash charts to suggest for a php code ...

How to make CLI timers in Windows Server 2003+IIS6+FastCGI+PHP5.3.1 environment?

For the PHP-CLI timer mentioned in the title, I mean the Travian/Ikariam-like background timers that schedule players' actions. I would like to know how to make such timers in mentioned platform (PHP5.3.1, FastCGI, Windows Server 2003, IIS6). Also, on the other hand, if I deploy the program to a Linux server, will it be easier? ...

Calling Variable Class / Method Programmatically

Hi, I have a method in a variable named class that I need to call dynamically, how can I call this: $foo = "object" where object is a specific class How do I call this in PHP? Thanks $foo::method() Thanks ...

Getting data in a certain order using mySql

I'm busy writing a PHP app that gets data from a database, but I need to get the data in a certain order. My Query looks as follows $sql = "select id,title,type from campaigns where id=$cid order by type"; Now my problem is these are the different types 'GC','MJ','MU','MS','MW','MX','GS' and I want MX to always be select last, thus s...

How to access PHP methods inside a Javascript?

I have made a method which will delete a file. first i echo the url to this file. like this echo "<a href='$fulr'>$filename</a>"; now basicaly i want to call the function deletefile($file); how can i do it like this echo "<a onclick='$this->deletefile($filename)' href='$fulr'>$filename</a>"; is that even posible? Or how can i i...

Split a sentence into separate words

Hi, guys! I need to split a Chinese sentence into separate words. The problem with Chinese is that there are no spaces. For example, the sentence may look like: 主楼怎么走 (with spaces it would be: 主楼 怎么 走). At the moment I can think of one solution. I have a dictionary with Chinese words (in a database). The script will: 1) try to find th...

PHP: exec(svn commit) is not returning any errors nor working..

Currently I'm writing out files with php into a directory, I add that directory (works fine), then when i try and do an svn commit its not working nor returning any kind of error codes. Does anyone have any idea on this? $tmp = exec('cd '.$this->build_locations[$this->type].'; svn commit --username user --password pw; ls', $output); I...

How to redirect back after login in PHP

Sometime we get link from a site, when we click the invitation link, it just send us to the index page for login(as we are not logged in in that site), when the login finishes, the site just redirect us to the link on which we clicked. How this can be achieved in php? ...

php5 simple_xml_file parse error

Hello, I am trying to pass the XML code below, in the first instance using the php function simplexml_load_file. Currently the php code is incredibly simple as follows: if (file_exists('test.xml')) { $xml = simplexml_load_file('test.xml'); print_r($xml); } else { exit('Failed to open test.xml.'); } However on running th...

PHP5 for Snow Leopard is not working even with the module enabled

Hi. This is the guide I followed to make PHP work on Snow Leopard: http://maestric.com/doc/mac/apache_php_mysql_snow_leopard Apache2 is working. http://localhost works just fine. Virtualhost works too. Mysql is working. PHP5 is not even with LoadModule php5_module libexec/apache2/libphp5.so Please advice. Do I need to start o...

preg_replace not taking variables

$line = "Hello World"; $line= preg_replace("/Hello/", $replacement, $line); - Works! $find = "Hello"; $line= preg_replace("/$find/", $replacement, $line); - Wont replace anything! $string = "Hello"; $find = "/".$string."/"; $line= preg_replace($find, $replacement, $line); - Wont replace anything! How can I use a variable in to tell ...

Wordpress Help on post

I'm having a bit of a problem I have created a post and it shows on my blog but as soon as you click on the title link it says "Sorry, no posts were found." and even in the homepage where the recent post doesn't work. ...

Hiding a DIV in sidebar in Wordpress

I want to hide this specific in the blog and other page I have this code : <?php if (is_page(array ('2','4','6','8','10','12'))) : ?> <?php else : ?> <?php include('stats.php');?> <?php endif; ?> it won't show on 2,6,8,10,12 which are the pagesbut it shoes in 4 which is the blog please help. ...

Function in PHP deprecated, what should I use now?

I have this code in one of my classes public function __call($method, $args) { array_unshift($args, $method); call_user_method_array('view', $this, $args); } We've since switched servers, and they must use a newer version of PHP5, and I get the following message Function call_user_method_array() is deprecated...

PHP DirectoryIterator help

In the following code, what can be called instead of ->getFilename()? <?php foreach (new DirectoryIterator('../moodle') as $fileInfo) { if($fileInfo->isDot()) continue; echo $fileInfo->getFilename() . "<br>\n"; } ?> PS, I have seen the documentation. Please don't link to here. Thanks for the help. EDIT: After posting thi...

underscores in php function calls

I know that underscores in function names in PHP is used to "implicitly" denote that they are supposed to be private...but I just saw this code: class DatabaseConnection { public static function get() { static $db = null; if ( $db == null ) $db = new DatabaseConnection(); return $db; } private $_handle = null;...