php

compress image file size on upload??

I am uploading product screenshots to my website... I want to upload the original image as it is and also create a thumbnail for it, but after uploading both the files the filesize of the thumbnail created is a bit larger than expected. Is there any way I could reduce the filesize of the thumbnail without compromising much on the qualit...

emailing url with uid

I have a 2-step form. The second step is quite lengthly and the visitor may want to complete it at a later time. What I have done is generate a uid with sha1 using a combination of details: firstname, email address, salt and I email the visitor the link eg: http://www.mysite.com/form/step2/[sha1 uid] so when they click the links they c...

PHP - Print all statements that are executed in a PHP command line script?

In python, one can trace all the statements that are executed by a command line script using the trace module. In bash you can do the same with set -x. We have a PHP script that we're running from the command line, like a normal bash / python / perl / etc script. Nothing web-y is going on. Is there anyway to get a trace of all the lines...

What advantage will Composite pattern bring me over just Array?

I'm recently working on a tree structure, multiple nodes, multiple and increasable levels, and a print() method. At first, i thought it should be a Composite, i then wrote down some possible design and codes: $struc = new Node(‘name0’, ‘id0’, ‘desc0’); $node1 = new Node(‘node1’, ‘id1’, ‘desc1’); $node2 = new Node(‘node2’, ‘id2’, ‘desc...

posting data to web pages fails in C#

i have used following code in my c# application string verification_url = @"http://site.com/posttest.php?"; string verification_data = "test=524001A"; string result = string.Empty; result = Post(verification_url, verification_data); public string Post(string url, string data) { string result = ""; try { byte[] buffe...

Preparing SQL Statements with PDO

My code looks like this: // Connect to SQLite DB DB('/path/to/sqlite.db'); DB('BEGIN TRANSACTION;'); // These loops are just examples. for ($i = 1; $i <= 10000; $i++) { for ($j = 1; $j <= 100; $j++) { DB('INSERT INTO "test" ("id", "name") VALUES (?, ?);', $i, 'Testing ' . $j); } } DB('END TRANSACTION;'); And here i...

wamp server is not working

i have downloaded some files which have .php extension.Then i installed wamp server on my pc. but couldnot be able to view those files.i have also turned off the IIS from the add/remove windows program.still i am not able to view the pages. ...

Does Zend Lucene need Java Lucene?

When implementing Zend Lucene, do we need to install Java on our server or not? ...

Call PHP code from Python

Hi, I'm trying to integrate an old PHP ad management system into a (Django) Python-based web application. The PHP and the Python code are both installed on the same hosts, PHP is executed by mod_php5 and Python through mod_wsgi, usually. Now I wonder what's the best way to call this PHP ad management code from within my Python code in ...

What is the best way to allow users to email images audio or video to our website?

Does anyone have any experience developing a way to allow users to upload photographs (and possibly video) to a website to be stored in a database from mobile devices? We will be running our system on a UNIX platform and most of the system logic is written in PHP and data is stored in a MySQL database. Members will be given an email ad...

How do I use the -e option in PHP?

php on the command line tells me that it has an option: -e Generate extended information for debugger/profiler However by running my command line script with that I see nothing... what's that option for? ...

preg_replace_callback - do twice

Yo, i'm trying to do this script working, but it doesn't work. How do i do it twice, the preg_replace_callback with two different functions. Thanks! function prepend_proxy($matches) { $url = (substr($_GET['url'], 0, 7) == 'http://') ? $_GET['url'] : "http://{$_GET['url']}"; $prepend = $matches[2] ? $matches[2] : $url; $prepe...

Best redirect methods?

In a PHP file when I need to redirect a user and headers are already sent so I can not use php's header function, in this case which is the best method to redirect a user? Fastest and most reliable method regardless of the users browser brand? echo '<script type="text/javascript">window.top.location="http://localhost/";&lt;/script&gt;'...

Compiling php with modules vs using shared modules?

Is there a difference between compiling php with the parameter: --with-[extension name] as opposed to just compiling it as a shared module and including it that way? Is there any performance benefit? If not, why would you want to do this? ...

Can I develop websites on Xampp and publish on windows based server? (PHP/IIS 6/7/Apache)

hi, I usually develop websites on the WAMP/XAMPP and host it on Linux servers. All works fine. But to meet some of the client requirements, we need to host a new project on to a Windows based server running IIS (I guess its IIS7, if not IIS6). I don't have access to a windows server on my local. So how I can develop with having an und...

Parsing Large Text Files with PHP Without Killing the Server

I'm trying to read some large text files (between 50M-200M), doing simple text replacement (Essentially the xml I have hasn't been properly escaped in a few, regular cases). Here's a simplified version of the function: <?php function cleanFile($file1, $file2) { $input_file = fopen($file1, "r"); $output_file = fopen($file2, "w");...

Can I let PHP know that a user does not have javascript enabled?

Can I let PHP know that a user does not have javascript enabled? ...

PHP include files with parse errors

I've got an dynamically-generated PHP file that is included (via include) in other PHP script. When the first one (for some obscure reason) is generated with parse-errors, causes the main script parse-error an stop the execution. Is there any way to detect parse errors when including a file so I can regenerate dinamically that file? Th...

I need an IDE for typo3 core development in php

Php in itself is difficult for IDEs because of the dynamic nature of the language. My current development environment is mostly netbeans against a local svn copy of the codebase setup in a local development webserver. The code is full text indexed by vistas search engine for almost instant searches. I do a lot of development directly a...

Finding embed site for a flash app

Heyas. I have an flash app that I'm working on that can be embedded on other websites (like YouTube videos), but we want to know what website the user is viewing the site on. Is there any way to tell what site the app is embedded on that the user is viewing on? The original app is written in flash/actionscript and php running on the s...