php

How do you do custom flags and values in lighttpd for PHP?

Perhaps this has already been asked, but I'm brand new to lighttpd and I'd like to know how to configure it more thoroughly. In Apache, you can set PHP flags and values as a part of your configuration: php_flag error_reporting OFf php_value error_log /path/to/log/file.log Is there a way to do the same with lighttpd? For bonus points,...

emails sent with php mail don't show up correctly in outlook

I'm working on a site that was recently moved. After the move all the scripts that use the php mail() function AND have MIME-Version: and Content-type in the header fail to display correctly. They show up like this Delivered-To: [email protected] Received: by 10.114.121.18 with SMTP id t17cs128223wac; Thu, 19 Nov 2009 11:52:35 -0...

How can I have a function perform after a Datetime in my DB is met?

I'm creating an auction site where users can bid on items. I want to create a script that sends an email to the winner of an auction item once the datetime in the end_auction column has been reached. I'm not sure how to go about doing this, since PHP only runs when the page is loaded and then stops. Also, I want it to send an email to ...

ECommerce solution in php and ror

Hello, I'm a developer but I never used php nor ruby on rails. I would like to create a small e-commerce website. I found out 2 solutions that seems very good, Prestahop and Spree. Which one would you recommend if I want to be able to customize the skin, calculate different taxes for different countries, use different languages ... ...

How to get values in an array this way with PHP?

From: $arr = array(array('key1'=>'A',...),array('key1'=>'B',...)); to: array('A','B',..); ...

PHP: Understanding code via function or file tracing (without XDebug)

I have inherited a moderately large PHP codebase. In order to better understand how it works, I'd like to be able to print to logs a function or file trace whenever I hit a page, so I can correlate pages with source code. Are there any tools I can install? I have root on the server, and so have the ability to install anything as far a...

Reference assignment operator in php =&

I am having a hard time determining what the =& (equals-ampersand) assignment operator does in PHP. Can anyone explain it? Is it deprecated? Thanks! ...

PHP Ban Visitor & Insert into mySQL DB.

I have the below code that i am wanting to into certain files so that when someone visits this "certain" file they get banned if they are not allready. but for some reason it is not adding new visitors into the database, if i add a user manually it works fine and echo's Banned! but otherwise it just echo's the $sql query but does not ac...

Getting word count for all files within a folder

I need to find word count for all of the files within a folder. Here is the code I've come up with so far: $f="../mts/sites/default/files/test.doc"; // count words $numWords = str_word_count($str)/11; echo "This file have ". $numWords . " words"; This will count the words within a single file, how would I go about counting the words...

Link structure for sorting an HTML table built using PHP

I appreciate any help I can get with this problem: I have 2 search forms, one does a keyword search and the other does a search by country, state and city (with an input for each) The results are output to a table. The header row contains a link for sorting each column. Problem is I don't know how to build my GET url string for sorting...

What is the best framework/cms and shopping cart plugin/module/etc. combination?

What is the best framework/cms shopping cart for a beginner php/python developer to implement? I'm potentially going to be developing a site with an online catalog of about one hundred items. Info about the items will change every year. They might add new items. They want to admin their own items and such. I'm afraid that if I use a ...

Why is the table filled with Array[0], Array[1],Array[2],Array[3] after the following SQL statement is executed?

Why is the table filled with Array[0], Array[1], Array[2], Array[3] after the following SQL statement is executed? mysql_query("INSERT INTO choicetable (announcementid, question, option1, option2, option3, option4) VALUES ('$announcementid', '$choicequestion[$j]', '$option[$j][0]', '$option[$j][1]', '$option[$j][2]', '$option[$j][3...

Non-browser emulation of JavaScript - is it possible?

I have a new project I am working on that involves fetching a webpage, (using PHP and cURL) parsing the HTML and javascript out of it and then handling the data in the results. Basically I hit a brick wall when the site uses javascript to fetch its data by AJAX. In this case, the initial data will not appear in the fetched page unless ...

Effective Interpreted Programming Language for File/Image manipulation

I need to make a script to read images from a directory, rename them, resize them to a MAX_HEIGHT, MAX_WIDTH, put a watermark logo and save them in JPG. I was thinking on doing this with an interpreted language, like Ruby, PHP, Perl, Python, or any with the image manipulation capabilities. Which language would you recommend for this? ...

Importance of PHP in web oriented platforms

Why is PHP the most used programming language for a web based platform? ...

How to connect 2 databases in php and mysql?

I have 2 databases. Users database and purchases database. Each database has different user and password. If i want to execute a query to call both databases. How do I connect the databases? $db = mysql_select_db(??????); ...

How to write into a file in PHP?

Hello everybody!!! I have this script on one free PHP-suppoting server: <html> <body> <?php $file = fopen("lidn.txt","a"); fclose($file); ?> </body> </html> it does create the lidn.txt file, but it's empty. I want to create a file and to write something into it, for example this line "Cats chase mice", how can I do it? ...

PHP Populating an Array from a MySql Query

I am looking to create an array of data to be pass to another function that is populated from a database query and am not sure how to do this. $dataArray[0][1]; $qry = mysql_query("SELECT Id, name FROM users"); while($res = mysql_fetch_array($qry)) { $dataArray[$res['Id']][$res['name']] } Thanks in advance. ...

How to avoid temporary variables in PHP when using an array returned from a function.

The use of $tmp below is pretty ugly. Is there a way to avoid it? function test() { return array('a'=>1, 'b'=>2); } $tmp = test(); echo "This should be 2: ", $tmp['b'], "\n"; Is there some reason the natural test()['b'] doesn't work? ...

Fron Array (var_dump) to my array?

I Make a echo '<pre>'; echo var_dump($arrayX); echo '</pre>' I got the result: array(6) { [0]=> string(9) "AAA" [1]=> string(13) "BBB" [2]=> string(8) "CCC" [3]=> string(8) "DDD" [4]=> string(8) "EEE" [5]=> string(13) "FFF" } How Can I make It to A New array What I want is to get arrayX in this format : ...