php

debugging slow php omnicomplete in vim

I'm using vim with php omnicompletion on in a large project. I have a ctags file and using: au FileType python set omnifunc=pythoncomplete#Complete au FileType php set omnifunc=phpcomplete#CompletePHP au FileType javascript set omnifunc=javascriptcomplete#CompleteJS au FileType html set omnifunc=htmlcomplete#CompleteTags au FileType css...

Which is the proper XML exclusive canonicalization?

I'm using xmlseclibs to try and sign a SOAP document, but it does not seem to canonicalize things in the same way depending on whether I'm signing or validating. I'll give you an example. This is the XML I am trying to sign: <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"&gt; <soapenv:Header/> <soapenv:Body>...

how to mysql_real_escape_string SQL Query?

theres single quotes using in $bio = "$user->description"; inserting DB like this; <? $sql = "insert into yyy (id, twitterid, twitterkullanici, tweetsayisi, takipettigi, takipeden, nerden, bio, profilresmi, ismi) values ('', '$id', '$twk', '$tws', '$tkpettigi', '$tkpeden', '$nerden', '$bio', '$img', '$isim')"; $ak = mysql_query("sel...

Dynamically create PHP object based on string

I would like to create an object in PHP based on a type defined by a string in a MySQL database. The database table has columns and sample data of: id || type || propertyVal  1 || foo    || lorum  2 || bar    || ipsum ...with PHP data types class ParentClass {...} class Foo extends ParentClass {private $id, $propertyVal; ...} class Ba...

PHP array keys - how to display?

I'm doing some work with a Google Analytics class. I get output as below: Array ( [20090401] => Array ( [ga:pageviews] => 5000 [ga:visits] => 2500 ) [20090402] => Array ( [ga:pageviews] => 5000 [ga:visits] => 2500 ) etc. How do I get the data to d...

PHP read from uploaded text file?

Hi, If I upload a text file via a form, is it possible to output its contents directly from the $_FILES variable rather than saving it onto the server first? I know this is a security risk, but it will only be run on a local machine. Any advice appreciated. Thanks. ...

in php how to check a field have blank/empty/null value

i want to disply an error when some varaiable have blank value or empty or null value (whatever we say), variable is shown below: $mo=strtotime($_POST['MondayOpen']); where var_dump($_POST['MondayOpen']) return string(0) "". now i want to solve below first of all i want to know $mo is which type of variable (string or integer or...

Getting values from XML elements which has the same names using PHP

I have a problem in getting the values from all the 3 IMAGE elements coz they have the same name. Below is my xml feed <FOUND> <IMAGES> <IMAGE> <SMALL>images/small.jpg</SMALL> <MED>images/med.jpg</MED> <LARGE>images/large.jpg</LARGE> <EXTRAL>images/extra.jpg</EXTRAL> </IMAGE> <IMAGE> <SM...

Problem sending mail with Pear in PHP

I have written an email contact form in php. I am using the Pear Mail package to send the email. It works nicely on my development computer, but not on the server. Here is the code: ////////////////////////////////////////////////// // EMAIL OPTIONS ////////////////////////////////////////////////// $to = "[email protected]"; ...

One to many link table causing duplicate rows returned

Everything I've seen so far is about removing duplicate entries in a database automatically. I want to stress at the beginning of this that there is no duplicate data in the database. I'll also start with the fact that I'm very much still learning about RDBMS design, normalization, relationships, and, most of all, SQL! I have a table ...

View contents of file with Content-disposition: attachment using socket

Hi, I want to parse the contents of a dynamic .csv file. However, this code (obviously with duff file names, etc.): $socket = fsockopen("www.example.com", 443); fwrite($socket, "GET /dynamicCsv.csv?param=value HTTP/1.1\r\n"); fwrite($socket, "Host: www.example.com\r\n"); fwrite($socket, "Connection: close\r\n"); fwrite($socket, "\r\n")...

PHP-destroy-session-on-close-of-main-window

How to destroy the session on closing the browser When browser window is closed, session should be terminated. Right now, if I close the window and type the application url, it is allowing me to access application. ...

Detect if java is installed on the web server from php

Hi, Is it possible to detect from a php script if java is installed on the server (if I can run an exec() command with java)? Thanks, Benjamin ...

How do I stop PHP output buffering from eating error messages?

Well, now that I've gotten a bit further into it, I realize that this is a stupid question, and wrong. Turns out that the author of the legacy code I maintain was hi-jacking the error log to a different file with a php_init statement. The hi-jacking occurred at the same time as the output buffering was turned on, making it appear as thou...

ISO-8601 week numbering vs "Outlook" numbering in PHP

I recently came across a big problem, as I have a system that's paying the customers weekly. As we all know, a year has 52 weeks, and there are standards for it. I'm using PHP aka date('W') to get the week number from a date, that calculates that according to the standard ISO-8601. Here are some references: http://www.iso.org/iso/da...

How to Design a SaaS Database

I have a web app that I built for a trucking company that I would like to offer as SaaS. What is the best way to design the database? Should I create a new database for each company? Or should I use one database with tables that have a prefix of the company name? Or should I Use one database with one of each table and just add a compan...

What is the difference between .= and += in php

Hi, What are the differences between .= and += in PHP? ...

in php i need one line if condition for time compare

i have to value $mo=strtotime($input_array['MondayOpen']); $mc=strtotime($input_array['MondayClose']); now i need a if condition to display an error on below conditions if one of them($mo or $mc) are empty, null or blank. if close time($mc) is less than open time($mo) means if both are empty(null) or $mc>$mo then go further ple...

Maximum execution time of 60 seconds exceeded

Hi. Is it possible to set maximum execution time of exec($command) function? Sometimes execution of my $command lasts too long and after 1min it stop execution and i receive this error: Fatal error: Maximum execution time of 60 seconds exceeded in C:\xampp\htdocs\files.php on line 51 how to increase the exec command maximum execution ...

Implementing preg_match_all in Python

I basically want the same functionality of preg_match_all()from PHP in a Python way. If I have a regex pattern and a string, is there a way to search the string and get back a dictionary of each occurrence of a vowel, along with its position in the string? Example: s = "supercalifragilisticexpialidocious" Would return: { 'u' : 1,...