php

PHP: Connection: keep-alive problem reading socket data

Trying to write data to a socket and read the response. $packet = "GET /get-database HTTP/1.1\r\n"; $packet .= "Host: 192.168.3.136:3689\r\n"; //$packet .= "Accept-Encoding: gzip\r\n"; $packet .= "Viewer-Only-Client: 1\r\n"; $packet .= "Connection: keep-alive\r\n\r\n"; socket_write($socket, $packet, strlen($packet)); do{ $buf = ""...

php not getting inside foreach loop

I swear this script worked fine last night but can't get it to work today. It's not getting inside of the foreach loop though and i don't know why. the $_FILES array is null even if i select a file and click submit. Basically this script has a file input tag and using jquery, if a user selects a file, it adds another file input tag. Whe...

PHP foreach over an array of objects

I'm trying to use a foreach loop for an array of objects. Inside of the BeginBattle() method I want to iterate through all of the objects and increment their played count automatically. Unfortunately, the web browser shows I have an error: Fatal error: Call to a member function BattleInitiated() on a non-object in /nfs/c05/h01/mnt/7029...

Two different actions on form submit

Hi, I have a form with a submit button. I have called a function on click of submit button. function actionPage(form1) { form1.action="action1.php"; form1.submit(); return(true); } Now i want that the form data should be submitted to two different pages. These pages are on different servers. I know that we can send the data to...

How to get variable name in PHP?

func($name1) should return name1 Is it possible? ...

How to catch the exit() event in PHP?

When exit() is executed,trigger another procedure,is there an easy way? ...

Retrieving system date in PHP

How do I get the system date and time in this format: $systime="12/january/2010 10.30 AM " ...

Connecting to exchange server

Hello I am trying to connect to my POP3 mail account on exchange server using a program written in PHP everytime i try to fsockopen and connect to mail box on port 110 i get connection time out error. The username and pass of the account is correct. Do i have to enable some connector on my exchange box to connect to third party applic...

PHP, Javascript, HTML

How to get option value in PHP? And i want to redirect to the same page, if option is changed by using onClick() function. Anybody please help me. ...

When will __destruct not be called in PHP?

class MyDestructableClass { function __construct() { print "\nIn constructor\n"; $this->name = "MyDestructableClass"; } function __destruct() { print "\nDestroying " . $this->name . "\n"; } } $obj = new MyDestructableClass(); When the above script is in a complex environment,the __destruct won't get c...

Performance impact of copying php variables

Just wondering about the performance impact of copying very large php variables. For example say $arr is an enormous array. If I do $arr2 = $arr, is this a deep copy or is $arr2 merely a pointer to $arr like it is in Java? Thanks in advance. ...

Get system time using PHP and dealing with offsets/timezones

How can I get the system time, like 10.23 PM, and how do I properly deal with time offsets and timezones? ...

MySql table names and field names within quotations.

I have a bunch of PHP code that is auto-generated and it puts all table names and field names within quotes. To wit: INSERT INTO "t_ML_u_Visitor"("c_u_ID") VALUES ... Since the code is Auto-Generated it would be much preferred if I could somehow get MySql to accept this syntax rather than subjecting the generated code to a post-proce...

How to post a Array using Jquery..

hello frieds this is how i usually post a variable using Jquery.. $.post("include/save_legatee.inc.php", { legatee_name: legatee_name_string, legatee_relationship:legatee_relationship_string, ...

how do i hide /magento/ in my site's url?

A site has an existing system (lets call it mysite) and the client asks to put in magento. My directory structure goes something like this: ROOT -index.php (this is the app's main controller) -.htaccess /blog (runs wordpress) /assets (current system's media folder) /magento (this is where all magento files go) P...

How To Set MySql SQL_MODE to ANSI from PHP.

MySQL Command: set @session sql_mode = ANSI; What is the corresponding PHP Command?? This Approach Does Not Seem To Work: $conn= new mysqli("localhost", "root", "", "DB"); $conn->options(MYSQLI_INIT_COMMAND, "SET SQL_MODE = 'ANSI'"); ...

how can i add text into a certain area ?

if i have a line like this. <option value="someval">somval</option> how can i put the position the cursor after the last quotation of value and put something like abcdef ? so the output would be <option value="somval" abcdef>somval</option> with php? i want to do this dynamically i cant figure out how to do it , im looking at str...

Wordpress - Harvard Gazette - How did they do X ?

Hi all, I just came a cross matt's post on the new Harvard Gazette wordpress based magazine. This theme is doing some very cool things I would like to know how to do too. So if any one knows of tutorials/plugins on how to do them, please share. Here are some of the things: 1) Amazing calendar. 2) A very strong multimedia section. ...

Passing PHP variables to XML in a .php file

<?php include "../music/php/logic/core.php"; include "../music/php/logic/settings.php"; include "../music/php/logic/music.php"; $top = "At world's end"; // create doctype $dom = new DOMDocument("1.0"); header("Content-Type: text/xml"); ?> <music> <?php $_xml = "<title>".$top."</title>"; echo $_xml; ?> </music> I'm using this code...

PHP error: libphp5.so: undefined symbol: _estrndup

I compile Apache-MySQL-PHP by hand to build a custom install using the configure options from below. When I start apache it fails to start and adds the below error in the error_log. * Apache 2 * Mysql 5.0 * PHP 5.1 * CentOS Linux 5.4 * GCC compiler the error in apache log httpd: Syntax error on line 54 of /opt/clamp/etc/httpd.conf: Can...