php5

I wrote a recurring function to apply a user function on every non-array member of given unknown depth array

please tell me how I can improve this code: <?php class TEST { function awalkstr($func,$a) { $args = func_get_args(); array_shift($args);array_shift($args); foreach ($a as &$val) { if (!is_array($val)) $val = call_user_func_array($func,array_merge(array($val),$args)); else $val = call_user_func_array(__METHOD__,array_merge(ar...

Javascript and php values toggel

I have index.php page and I have this there $pv->showHidden = isset($_POST['showHidden']) ? intval($_POST['showHidden']) : 0; $pv->sendHidden = isset($_POST['showHidden']) ? 0 : 1; and then I have this <input type="image" id="btnShowHidden" src="images/hide.gif" onclick="showHiddenRecords(<?php print $pv->sendHidden; ?>);" /> I...

$_COOKIE[] will not accept string with periods?

<?php $Test = "dsdsdad.dsad"; if (isset($_COOKIE["$Test"])) { echo "I GOT A COOKIE WITH A PERIOD"; } else { setcookie("$Test", "yes", time()+60*60*24*3); } $Test = "dsdsdaddsad"; if (isset($_COOKIE["$Test"])) { echo "I GOT A COOKIE WITHOUT A PERIOD"; } else { setcookie("$Test", "yes", time()+60*60*24*...

Is there a work around for number_format() in PHP5 returning NULL for empty strings?

We are currently migrating from PHP4 to PHP5 and have discovered an issue. In PHP4, when we used the number_format() function on an empty string the output would be 0. However, in PHP5, running the same empty string through the number_format() function results in output of NULL. This has a ripple effect on a lot of our code that is no...

How can I get the current web directory from the URL?

If I have a URL that is http://www.example.com/sites/dir/index.html, I would want to extract the word "sites". I know I have to use regular expressions but for some reason my knowledge of them is not working on PHP. I am trying to use : $URL = $_SERVER["REQUEST_URI"]; preg_match("%^/(.*)/%", $URL, $matches); But I must be doing som...

What OS on a Pentium III 550 w/ 512MB RAM Apache/PHP5/MySQL5 Server?

I have spent around 4-5 hours installing and configuring Ubuntu 10.04 (Desktop) on this old computer I have and it seems real sluggish. I thought I would seek some advice here before I invested more of my time. I would like a GUI (for VNC access) but it is not required, and better webpage generation performance. Any reccomendations? ...

Retrieving date time value upto a millisecond using the DATE() function

Hello ALL, By using the function Date(ymdHis) i am able to retrieve the value of the current date and time until seconds. I wanted to find out what do we need to do so that we retrieve even until a milli second. Thanks in advance. ...

AuthSub and Blogger

I'm trying to retrieve a list of blogs of a given user. I think I've successivelly authorizated myself with all the token stuff, but when I ask for the list blog, I recieve a 302 moved temporarily. I'm using curl to send the requests. In my callback page, I upgrade the token to a session token: $header = array(); $header[] = 'GET /acco...

Can a class instance self-destruct?

Is it possible for a PHP object instance to destroy/unset itself? Say I had a class that represented a file, and then I subsequently delete that file using the class. Can I somehow unset the instance from within one of its own methods? $file = new FileClass(); $file->copy('/some/new/path/'); $file->delete(); // ... at this point $file...

codeigniter modular seperation problem php mvc

Hi, Ok so Im running 1.7.2 and I installed the codeigniter-modular-seperation library (the newest version which is maintained by Phil Sturgeon , as the wiki said to install that version if Im using 1.7 or above) -- anyways, the documentation is super light, just says put MY_Router and MY_Loader in the libraries folder which Ive done, a...

Can PHP __autoload() a class from within another __autoload() of the same class?

OK, this is a tough one... I think, and I have a feeling the answer is simply no, but in that case I would like some answers for alternatives. I have a very complex __autoload() function in a framework which can dynamically create classes. There a three classes required in order for the dynamic creation of a class called AuthActions --...

What is a good wrapper/framework/libraries for dealing with interface PHP applications to an SQL database?

I have a table $query= "CREATE TABLE screenshot ". "(screenshot_id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY, ". "source_video_id INT UNSIGNED NOT NULL, ". "screenshot_file_name VARCHAR(128), ". "x_res INT, ". "y_res INT, ". "time INT UNSIGNED);"; mysql_query($query); Then I insert things into that table. I often want to do an SQL quer...

Streaming pdf document over SOAP using php

hi i am connecting to a provider and getting a PDF file. Now this file needs to be sent to the users browser as it is. But the problem is there are two hops between the user and the provider. The communication between Hop 1 and Hop2 happens over SOAP. Is it possible to send the PDF from Hop 2 to Hop 1 as a stream not as an attachment. ...

How to tell explode to ignore line feeds?

I have written some small code to read in a flat text file and display it. My issue is that one of the fields has alot of text in it and also some line returns. My code is using the line return is a delimiter and moving onto the next record. How can I tell it to only split by the delimiter and ignore line returns? Sample code I am usin...

php code to run another php page on schedule time

I want to send sms on scheduled time. i have sms gateway api and sms can also send. what i want is sms should be send on scheduled time as per user settings. I need a php code to run another php file . Can any one help me? ...

How do I extract particular words from a paragraph using PHP??

hi for example this is a plain text paragraph:- Domain Name: COMCAST.NET Registrar: CSC CORPORATE DOMAINS, INC. Whois Server: whois.corporatedomains.com Referral URL: http://www.cscglobal.com Name Server: DNS101.COMCAST.NET Name Server: DNS102.COMCAST.NET Name Server: DNS103.COMCAST.NET Name Server: DNS104.COMCAST.NET Name Server: DNS10...

How do I show progress message while updating in PHP??

What I am looking into is:- I do have a search page say index page. and the action file is search.php. when I fire a query search.php will start processing on what I searched. structure of search.php it uses $_GET function to retrieve query from index page. first it will search in MySQL database. IF yes then display the result from ...

PHP DOM problem searching for <w:t> tags in XML

So I have an XML file (XML export of a MS Word file). What I am just trying to do is to replace these two lines: <w:t>Meno:</w:t> And: <w:t>Priezvisko:</w:t> This is a longer XML excerpt: <w:p w:rsidR="00CF175F" w:rsidRDefault="00CF175F"> − <w:r> <w:t>Meno:</w:t> </w:r> </w:p> − <w:p w:rsidR="00CF175F" w:rsidRDefault="00CF175F"> −...

Ignoring lines that begin with #

I am reading in a flat text file, normally the first few lines are comments, how can I tell me script to ignore them? The relevant section of the script is: <?php $delimiter = chr(1); $eoldelimiter = chr(2) . "\n"; $fp = fopen('app2','r'); if (!$fp) {echo 'ERROR: Unable to open file.</table></body></html>'; exit;} $loop = 0; while (!f...

Replacing all spaces inside <a> tags

Hi, I've been struggling with this for a while now so hopefully someone can help me out. I need to use regex to replace all spaces inside an anchor tag for example. Hello this is a string, check this <a href="http://www.google.com"&gt;Google is cool</a> Oh and this <a href="http://www.google.com/blah blah">Google is cool</a> That is al...