php

Kohana3: Absolute path to a file

Say I have a file in my kohana 3 website called assets/somefile.jpg. I can get the url to that file by doing echo Url::site('assets/somefile.jpg'); // /kohana/assets/somefile.jpg Is there a way I can get the absolute path to that file? Like if I want to fopen it or get the size of the file or something like that. In other words, I ...

regular expression for indian vehicle number in javascript and php

I need a regular expression in Javascript, as well as in PHP, for Indian vehicle NUMBER. Here is the conditions list: (x)(y)(z)(m)(a)(b)(c) 1. (x) contains only alphabets of length 2. 2. (y) may be - or single space ' '. 3. (z) contains only numbers of length 2. 4. (m) may be or , or single space ' '. 5. (a) must be one or two alph...

php to translate GET request to POST request

i have a hosted script somewhere that only accept POST request. example, some.hosted/script.php how can i setup another simple php that can accept GET request and then POST it to the hosted script. so that i can put up a link like this: other.site/post2hostedscript.php?postthis=data and then it POST postthis=data to the hosted script. ...

Zend framework Internal structure modification?

What class(FrontController , Bootstrap, Dispacher....) sets up the default structure path in ZF? ...

phppgadmin : How does it kick users out of postgres, so it can db_drop?

I've got one Posgresql database (I'm the owner) and I'd like to drop it and re-create it from a dump. Problem is, there're a couple applications (two websites, rails and perl) that access the db regularly. So I get a "database is being accessed by other users" error. I've read that one possibility is getting the pids of the processes i...

finding the number of 1's in my table in order

I have a table of customers with a 1 recorded against their customerid on different dates. I would like to find the sum of the 1's recorded in descending order. I'm using MySQL and php Thanks ...

Critiquing PHP-code / PerlCritic for PHP?

I'm looking for an equivalent of PerlCritic for PHP. PerlCritc is a static source code analyzer that qritiques code and warns about everything from unused variables, to unsafe ways to handle data to almost anything. Is there such a thing for PHP that could (preferably) be run outside of an IDE, so that source code analysis could be auto...

Need help understanding a bash command

It's actually a combination of php and bash: exec(sprintf("%s > %s 2>&1 & echo $! >> %s", $cmd, $outputfile, $pidfile)); I don't understand what 2>&1 & echo $! is there for? ...

How do I convert the below PHP code to VB.NET?

How do I convert the below PHP code to VB.NET? <?php $X_HOST ="foo.com"; $X_URL = "/index.php"; $X_PORT ="8080"; $X_USERNAME = "foo"; $X_PASSWORD = "bar"; $s_POST_DATA = "Channel=UK.VODAFONE"; // Channel $s_POST_DATA .= "&Shortcode=12345"; // Shortcode $s_POST_DATA .= "&SourceReference=3456"; // Source Re...

PHP Moving mySQL Tree Node

I am having trouble trying to move sub nodes or parent nodes up or down... not that good at math. CREATE TABLE IF NOT EXISTS `pages` ( `page-id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, page-left mediumint(8) unsigned NOT NULL, page-right smallint(8) unsigned NOT NULL, page-title text NOT NULL, page-content te...

How do I make a HTTP POST request to an url from within a c++ dll?

Hi, there's an open-source application I need to use. It allows you to use a custom dll. Unfortunately, I can't code c++; i don't like it; it don't want to learn it. I do know PHP very well however, thus you can see that I'll rather do my logic within a PHP application. Thus I'm thinking about posting the data from c++/dll to a url on m...

Bash completion symfony

How can I make symfony completion in bash? Have ubuntu 9.10. It's hard to write own alias. Anyone know where can I find it? I find http://trac.symfony-project.org/wiki/BashCompletion - but it is for symfony 1.1. Is it compatible with 1.4 ? ...

php regex word boundary matching in utf-8

Hi, I have the following php code in a utf-8 php file: var_dump(setlocale(LC_CTYPE, 'de_DE.utf8', 'German_Germany.utf-8', 'de_DE', 'german')); var_dump(mb_internal_encoding()); var_dump(mb_internal_encoding('utf-8')); var_dump(mb_internal_encoding()); var_dump(mb_regex_encoding()); var_dump(mb_regex_encoding('utf-8')); var_dump(mb_regex...

Mysql query problem

I have a problem with (for me to complicated) MySql query. Okay, here is what I need to do: First I need to check messages that some specific user received $mid=$_SESSION['user']; $stat1=mysql_query("SELECT id, fromid, toid, subject FROM messages WHERE toid = '".$mid."' AND subject != 'not readed' GROUP BY fromid ") or die(mysql_err...

DOM class injection in PHP

idea Via jQuery, I was able to mark all :first-child and :last-child elements in document (well, almost all :)) with class first which could I later style (i.e. first li in ul#navigation would be easily adressable as ul#navigation .first). I used following code: var $f = $('*:first-child') $f.addClass('first'); var $l = $('b...

How to get PID of a background process in PHP?

php file.php & How to get PID of the background process in file.php? ...

Send files using Content-Disposition: attachment in parallel

I have a PHP page that sends a file to the browser depending on the request data it receives. getfile.php?get=something sends file A, getfile.php?get=somethingelse sends file B and so on and so forth. This is done like so: header('Content-Disposition: attachment; filename='. urlencode($filename)); readfile($fileURL); It works except i...

Zend Framework url redirect

<?php class PI_Controller_Plugin_AssetGrabber extends Zend_Controller_Plugin_Abstract { public function dispatchLoopStartup(Zend_Controller_Request_Abstract $request) { /* The module name */ $moduleName = $request->getModuleName(); /* This modules requires the user to be loggedin in order to see the web p...

Is it possible to urlencode a url that contains a url encoded url?

I have a website that uses the facebook, twitter, delicious share links. They contain a a url encoded url of the website that you wish to share. The problem is I then want to send the facebook/twitter/delicious url through a php redirect page. Will it work to encode a url within an encoded url? Will there be side effects? To simplify m...

what does a tool like Jasper Reports give me?

Ok, So I have to generate very complex reports from my DB. If I am to do it with SQL the query themselves will be complex, and I will have to do some more manipulation on the results later, code level. How do libraries like Jasper Reports/ Crystal Reports and friends save me time when developing such reports? What will they give me? ...