php

In PHP, How to Convert an Argument Name into a String

My goal is to echo the argument passed to a function. For example, how can this be done? $contact_name = 'foo'; function do_something($some_argument){ // echo 'contact_name' .... How??? } do_something($contact_name); ...

How many connections/s can I expect between PHP and MySQL on separate server?

Trying to separate out my LAMP application into two servers, one for php and one for mysql. So far the application connects locally through a file socket and works fine. I'm worried about the number connections I can establish if it is over the network. I have been testing tcp connections on unix for benchmark purposes and I know that ...

How to find a reason when mkdir fails from PHP?

PHP's mkdir function only returns true and false. Problem is when it returns false. If I'm running with error reporting enabled, I see the error message on the screen. I can also see the error message in the Apache log. But I'd like to grab the text of the message and do something else with it (ex. send to myself via IM). How do I get t...

PHP Soap Issue: Server was unable to process request. ---> Object reference not set to an instance of an object

I'm using PHP 5.2.5.5 with Moodle 1.9. When I make a simple SOAP call without parameters, it works. However, as soon as I use a call with a parameter, it fails. If I capture the SOAP request with Fiddler, I see that it's not adding the parameter to the soap request at all. Here's my sample code: $WSDL = 'http://www.nanonull.com/Time...

I want to make my txt file safe.

Current status. I have to set 606 for my foobaa.txt. I wrote a php code, that read and write foobaa.txt, and I want to make the permission of the foobaa.txt as 600. But when I tested 600, the PHP code can not read and write foobaa.txt. so I changed to 606 the foobaa.txt, then my PHP code can read and write the foobaa.txt. this is pr...

[MySQL] Adjusting for timezones and DST

On my website, users can set preferences for their current timezone. I have a bunch of datetimes in my database, but I want to show each time appropriately, given A) what timezone they are in, and B) whether or not Daylight Savings is in effect. What is the best way to go about this? ...

grabbing image from folder based on size

ok so i have a folder that was created after this answer was used so now i have a folder with with many folders in it each one having images and a .txt file the images are almost all .jpg so now i want to display a image from each folder, using php i want to display the first image from each folder, and if there is no images i want t...

How to use PHP inside JS files (with Symfony)?

I found this: http://www.symfony-zone.com/wordpress/2008/12/13/use-routing-to-server-localized-and-dynamic-javascript/ But I saw that it has already been built into Symfony with the use_dynamic_javascript() AssetHelper. I can't find any documentation for using this helper though. Any examples, links, or anything to help? Thanks. ...

Keep uploaded files across multiple pages.

I have a page that needs to accept .csv files with no predefined layout. That is, the user will choose what kind of data is in each column. Right now, the upload file form sends me to a .php script which can access the uploaded file. It reads it, and lets the user assign categories to each of the columns. My next step is to copy the da...

PHP Soap non-WSDL call: how do you pass parameters?

I'm trying to make a non-WSDL call in PHP (5.2.5) like this. I'm sure I'm missing something simple. This call has one parameter, a string, called "timezone": $URL = 'http://www.nanonull.com/TimeService/TimeService.asmx'; $client = new SoapClient(null, array( 'location' => $URL, 'uri' => "http://www.Nanonu...

display contents of .txt file using php

using this code <?php foreach (glob("*.txt") as $filename) { $file = $filename; $contents = file($file); $string = implode($contents); echo $string; echo "<br></br>"; } ?> i can display the contants of any txt file in the folder the problem is all the formating and so on from the txt file is skipped the txt f...

sorting and displaying image based on size

<?php foreach (glob("*.jpg") as $filename) { echo "$filename size " . filesize($filename) . "<br>"; echo '<img src="'.$filename.'" height=150px><br>'; } ?> using that code, i am able to display all the images in the folder i want to display only one that meets a size parameter, and if there are more ignore them basically want ...

How to work with Session and Include statement in PHP?

I am having many files with multple includes one into another like below, File1 is included in File2 and then File2 is under File3 Now I want to declare a session variable site_user_conutry from File1 and then I am checking on File2 that if there is any no value in the session variable then Only I am including File1.php I have added ...

how to combined these words in array with " " in PHP?

I want to combine the [word] part of each array with " ",the array structure as follows: Array ( [0] => Array ( [word] => Hello [off] => 0 [len] => 5 [idf] => 4.0235948562622 [attr] => en ) [1] => Array ( [word] => , [off] => 5 [len] => 1 [idf] => 0 [attr] => un ) [2] => Array ( [word] => long [off] => 6 [len] => 4 [idf] => 3.4657359123...

Script to add user to MediaWiki

I'm trying to write a script that will create a user in MediaWiki, so that I can run a batch job to import a series of users. I'm using mediawiki-1.12.0. I got this code from a forum, but it doesn't look like it works with 1.12 (it's for 1.13) $name = 'Username'; #Username (MUST start with a capital letter) $pass = 'password'; #Passwo...

How to mix php and C++ for user authenication?

Hello i'm making a program to get the names of users on my website and use that log for my programs so only registered people can login. How would I go about doing this? ...

Can I use Code Igniter with Concrete5?

I am building a site that will (obvisouly) have a front end public portion that I want to drive with Concrete5, but then it will also have a members section that I would like to build with Code Igniter. Does anyone have any idea how I could do that? I guess I could just throw the Code Igniter code into a sub directory, but would I run ...

how do I edit a file on command line ?

Hi, I am trying to create a php file that adds a user and create public_html directory in linux using exec() function(php). I can add following code to the php file exec("useradd -d /home/username -m username"); exec("mkdir /home/username/public_html"); now..I have to add public_html to smb.conf to work public_html on windows. is it...

how to save a local copy of xml being output by certain website

Hi there! I want to save a local copy of xml being ouput by a certain website, and everytime I changed the URL of a website to get another copy of xml it will overwrite the file that saved from previous website, how can I do this in php? ...

When I upload/copy an image it fails, when I hit refresh/resend it works

Alight so, I am working on a small section of a project and I am uploading an image and then copying it to resize afterwards. What is happening is that when I click submit to upload, it fails, but if I hit refresh/resend the info it succeeds... $uploadFile = $uploadDir . $imageName; $imageName2 = $front[0]."_large\.".$front[1];...