php

mail using attachment

i am making a mail script with attachment. following ar my php script. $filename=$_FILES["file1"]["name"]; $filetype=$_FILES["file1"]["type"]; $filesize=$_FILES["file1"]["size"]; $filetemp=$_FILES["file1"]["tmp_name"]; if($filetype=="application/octet-stream" or $filetype=="text/plain" or $filetype=="application...

PHP Multidimensional Array Sum/Erase Problem

Hi, I have an array that looks like the following: The format: [Person#] => Array ( [Bank#] => Balance . . [Bank#] => Balance ) The Array: [1] => Array ( [0] => 707 //Person #1 has 707 balance in Bank #0 [1] => 472 //Person #1 has 472 balance in Bank #1 ) [2] => Arra...

Google Chrome rendering XML as text for RSS feed

Hi all. I have this script to generate an XML file for an RSS feed. Works great in every browser except Chrome. Chrome just renders the XML as text. Something to do with header("Content-Type: application/rss+xml; charset=ISO-8859-1"); possibly? This is the code I'm using: <?php $linkUp = "http://localhost/sites/myBlog/"; header("...

Run exec function in PHP

Hi All, I am using exec function to run a bat file and change the default printer. exec file is doing fine, bat file alone is doing fine, but the printer doesn't change when I'm calling the bat file via exec function. I put "echo 1" in the bat file. Browser showed "1" but my printer didn't change. I really need a miracle to solve this !!...

PHP not able to set cookies through Nginx

I've got a PHP-fpm setup on nginx setup according to this article: http://interfacelab.com/nginx-php-fpm-apc-awesome/ PHP is not able to set cookies in any browser visiting the server. It seems nginx is not passing on the Cookie header to the browser. I Googled around a bit, and found that I need to set fastcgi_pass_header Set-Cookie in...

[PHP/IIS FastCGI]: Error after installing FastCGI and PHP 5.3.0 nts on windows

I am getting following errors when I try to execute any PHP application after I installed IIS FastCGI and PHP 5.3.0 non-thread-safe on Windows XP: PHP Warning: PHP Startup: Unable to load dynamic library 'C:\Program Files\PHP\ext\php_enchant.dll' - The specified module could not be found. in Unknown on line 0 PHP Warning: PHP Startup...

How to generate a PHP soap client code?

Is there a way to generate a PHP soap client from a wsdl file? I mean something like wsdl.exe or svcutil.exe in .net, that generates code for a class that can be the client of a service, not something like: $WSDL = new SOAP_WSDL($wsdl_url); $client = $WSDL->getProxy(); My problem is that I want the php client to be able the wor...

php function for generating MM/DD/YYY and HH/MM dropdowns with current date selected

Does anyone know of a way to do this? Im sure its been done before. Need to generate html downdown lists, and fill in the month, day, year, and then the hour, and minute fields. I only need the MM/DD/YYYY to display current (where those values match current, mark that option selected). I wouldnt even know where to start. I assume loopi...

Jquery - Hide / Show - "Session" problem

Hello! I use this links and divs on my site: <p><a href="#" class="navlink" id="navlink_1">Menu1</a> | <a href="#" class="navlink" id="navlink_2">Menu2 |</a><a href="#" class="navlink" id="navlink_5"> Menu 3|</a></p> <div id="menu_1" class="mymenu"> </div> <div id="menu_2" class="mymenu"> </div> <div id="menu_3" class="mymenu"> </div>...

When not to close a php file?

I've come across a tutorial (reputable one if I may add) where the closing php tag ?> was omitted. This reminded me of a previous tutorial where the author said it's actually better not to close the tag, but didn't explain why. I'm a little surprised, I thought it was better practice to close the tag. Why is it better not to close it and...

shorter way of echoing a variable in php?

In the last two days, ive run across code that has php echo'd variables displayed like this <?=$selected?> What exactly is going on and why? What is this called? ...

Problem with getting information of currently configured network interfaces on Linux

I am encountering a problem with string formatting while trying to get only the names of currently configured network interfaces on a Linux Machine. 1. <?php 2. $temp = shell_exec("/sbin/ifconfig | cut -b 1-10"); 3. echo $temp; //Outputs: eth0 lo 4. $arr = explode(" ",$temp); 5. echo "First Location:".$arr[0]; ...

How to get the greatest difference among a list of ordered numbers in PHP?

For example, 1,3,6,8,11,45,99 The interval between numbers is: 2,3,2,3,34,54 So the greatest difference is 54. How to implement this function? function get_greatest_diff($arr_of_numbers) {} ...

How to retrieve tree nodes children (recursive function help)

I have a binary, the database table of relationships looks like this: +----+----------+---------+-----+ | id | parentID | childID | pos | +----+----------+---------+-----+ | 1 | 1 | 2 | l | | 2 | 1 | 3 | r | | 3 | 2 | 4 | l | | 4 | 3 | 5 | r | | 5 | 4 | 6 | l ...

php mysql query syntax question regarding ""'s

Forgive me, I'm a beginner. The following code returns a parse error: $query = "INSERT INTO scenario_needgames VALUES ("$id", "Battle of the Bulge")"; the query builder in phpMyAdmin gave me this slightly modified string that works: $query = "INSERT INTO scenario_needgames VALUES (\"$id\" , \"Battle of the Bulge\");"; but I'm confu...

Dropdown list where options populate a second list js/php?

I have a 2 dropdown lists side by side. When user selects from the first list, i need the second list's options to be displayed. The sub-options will be retrieved from a database. I have a page that will return the necessary html given the specific parent. I just need the first list's selection to trigger an update of list #2. Whats th...

PHP: Limit foreach() statement?

How can i limit a foreach() statement? Say i only want it to run the first 2 'eaches' or something? ...

Join user table w/posts and create an instance for each

Let's say I'm building feed of comments and need the comment data and user data of the author. Comments are represented by the Comment class. Users are represented by the User class. When pulling the comments, the $author member of Comment should be set to an instance of User (to keep all the info about the author). class Comment { v...

Running forked php apps

What are the downsides to running a forked PHP app on the web? I have read that it should not be run under Apache for any reason, but never explained why. The only reason I can think of is that if a script is terminated in the middle of execution, any forked process would never be terminated and might cause memory leaks. The question...

Boost results in Solr by certain field?

Hello, I'm pretty new to Solr but I'm trying to integrate it in to my website. I've been looking in ways to "boost" results in Solr queries, but I'm having a hard time understanding how to achieve what I'm trying to do. I'm trying to "boost" certain results in Solr searches that have the field "userId" set to 1. For example, if there we...