php

php extending classes

I'm using a salesforce class called SforceEnterpriseClient. I've referenced that class many places in my application. I want to extend that class to give it the ability to return a single array from a 1 row recordset, right now the record set is about 3 levels deep. There's a few other things I want to do with it as well. I can handl...

How can I use svn+ssh in a PHP script?

i can't figure out how i should access the repository from a CakePHP project called fredistrano (you can do CakePHP deploys with a web 2.0 interface). i have fredistrano in my web broadcasting directory on a shared unix web server. when i use tortoisesvn from my laptop, i have to use svn+ssh://[email protected]/svnpath/trunk/. i tri...

Recurrent if loop in a Switch

I would like to know if there is anyway I can do this without having to do the same If loop in each of the Switch cases since it's a bit repetitive. switch ($val) { case 1: if(!$object->doSomething1()==$goodValue) row .= $object->doSomething(); break; case 2: if(!$object->doSomething2()==$goodValue) row ...

PHP variables maintaining an URL string.

I'm not a PHP developer, but I'm currently hacking on an internal tool so my team can take advantage of its goodness. There's an index file that looks like so: require( ($loader_path = "../../loaderapi/") . "loader.php" ); Used like this, $loader_path will retain its value within the loader.php file. However, we want to access this ...

Difference between "," and "." in PHP?

I just found that something like echo $value , " contiue"; will work,but this not : return $value , " contiue"; While "." works in both occasions. ...

Emojis causing iphone to crash

Our iphone app has a chatroom where users can post comments. Recently, the chatroom has been crashing the app because users are adding emojis to their comments. I went to my server PHP script to not allow characters that aren't in the A-z0-9 range (I also allow around 30 punctuations characters) hoping that this would prevent the app/fee...

PHP file print its own content

Is it possible for PHP file to print itself, for example <?php some code; ?> that I get output in HTML as <?php some code; ?>(I know its possible in c++), if not is it possible to actually print html version of php code with nice formatting and colors such as from this url inside code container http://woork.blogspot.com/2009/07/twitter-a...

How can I count the amount of equal signs in a line in php

I need to count the number of equal signs in a line. What is the best way of doing this. The text file is also pretty large, so if possible I would first like to check to see if an equal sign is in the line at all and then count them (if this would be faster). I do not need to know how to loop through the lines (I already know this p...

How can we implement Paging using json, Need the records to be preloaded. Help

I am trying to implement paging in PHP, using Json. I need the data to be preloaded, before the user click next results. Please Give me some suggestions or some references. ...

How can I get the first non-white space character of a line using php

I have a line that typically starts with a few spaces as the lines are in columns and use a monospace font to make things line up. I want to check if the first non-white space character (or even just the first thing that isn't a space) and see if that is a number. What is the least server intensive way of doing this? ...

400 Bad Request when getting a page with PHP Curl

I keep getting a 400 bad request code from a hotfile.com page when I try to get it with curl. I can get the pages fine in the browser The first (login) (post) request in the script works The last (get) request in the for loop works I have tried setting the curl headers to the same headers sent by my browser I have tried sleeping up to ...

AMFPHP Flex Propel Mapping class ultra-weird bug

Hello, I'm working on a website using : - Flex 3.4 - AMFPHP 1.9b - Propel 1.3 - PHP/MySQL My problem is really strange and I've been spending hours trying to know where it comes from. I'll try to focus on the problem which takes place in a whole system. To sum up, I have 2 entities (MySQL) : create table AAA ( id_AAA ...

Drupal field values and longtext

Hey there. Long time mysql/php user, first time Drupal user. Actually, I'm not doing the Drupal development (I'm just using the database to pull in some data to a separate application), and I'm just trying to figure out if this is how it's supposed to work: Every one of the "value" fields in the content_type_* tables is of type LONGTEXT...

Can't get SFTP to work in PHP

I am writing a simple SFTP client in PHP because we have the need to programatically retrieve files via n remote servers. I am using the PECL SSH2 extension. I have run up against a road block, though. The documentation on php.net suggests that you can do this: $stream = fopen("ssh2.sftp://$sftp/path/to/file", 'r'); However, I have...

How to flush output in ZF

I have a controller that, among other things, sends emails. I need to echo a message to the user before the email sending starts (otherwise it looks like the screen is stuck). So, how do I echo a message which is set in the start of a controller, before I reach the end of the controller, or, should I think in another direction all toget...

Is it possible for a php script to download big files like movies to the server?

My script downloads only 2 mb. I think it is because of some sort of restriction on this server. My script resides on this server and is to download files (like pictures and movies) from the web. But movies fail; only two mb get downloaded to the server. Can I do anything about it? ...

How to redirect an entire range/block of IP addresses with PHP?

Hello all, I'm using the following snippet to redirect an array of IP addresses. I was wondering how I would go about adding an entire range/block of IP addresses to my dissallowed array... <?php // Let's redirect certain IP addresses to a "Page Not Found" $disallowed = array("76.105.99.106"); $ip = $_SERVER['REMOTE_ADDR']; if(in_arra...

How to display local time with PHP

Our server is set to GMT time so the hour does not keep jumping around in spring and autumn. However, during summer time, it is annoying that all the times are displayed an hour out. How do I get and display the time, taking into account the local timezone in PHP (especially when the server thinks the local timezone is GMT). or, How do...

What is the php.ini setting that allows response outputs?

Much like asp.net's <%=SomeVariable%> how can i enable <?php =SomeVariable ?> ? Currently my app only works if i do <?php echo(SomeVariable) ?> Iam using php 5.1.6 Thanks ...

What is the best method to hide a file on a server?

I am going to make an image hosting system in PHP. I wondered how I should hide my images from users so they can only be accessed through a special url. I need to discuss all techniques that include htaccess. ...