php

How to refresh all pages in a frameset

Hi everyone ,, using php I would like to force the browser to refresh all pages -frams- in the frameset , as if the user had press F5 button. when I use header("Location: frameset.php"); it reload the whole frameset int one frame which had the action any help is Appreciated :) ...

How to return array of C++ objects from a PHP extension

I need to have my PHP extension return an array of objects, but I can't seem to figure out how to do this. I have a Graph object written in C++. Graph.getNodes() returns a std::map<int, Node*>. Here's the code I have currently: struct node_object { zend_object std; Node *node; }; zend_class_entry *node_ce; then PH...

Data Access Layer, Best Practices

I'm looking for input on the best way to refactor the data access layer (DAL) in my PHP based web app. I follow an MVC pattern: PHP/HTML/CSS/etc. views on the front end, PHP controllers/services in the middle, and a PHP DAL sitting on top of a relational database in the model. Pretty standard stuff. Things are working fine, but my DAL is...

Php Mailer Sending Error

I am writing the Mail Module in my project and decide to use phpmailer to send the test email to my gmail account. However, I end up with the following error msg. SMTP server error: "Your IP: 221.253.178.1 : Your domain myserver.com is not allowed in 550 header From" My codes are as follow: <?php require_once('phpMailer/class.phpmai...

Parsing XML data with Namespaces in PHP

I'm trying to work with this XML feed that uses namespaces and i'm not able to get past the colon in the tags. Here's how the XML feed looks like: <r25:events pubdate="2010-05-19T13:58:08-04:00"> <r25:event xl:href="event.xml?event_id=328" id="BRJDMzI4" crc="00000022" status="est"> <r25:event_id>328</r25:event_id> <r25:event_name>Test...

SQL Query taking too long

I am trying to optimize the SQL query listed below. It is basically a search engine code that retrieves products based on the products name. It also checks products model number and whether or not it is enabled. This executes in about 1.6 seconds when I run it directly through the phpMyAdmin tool but takes about 3 seconds in total to lo...

MySQL comparisons between multiple rows

I have a MySQL table with the following columns: id(int), date (timestamp), starttime(varchar), endtime(varchar), ... I need to find time slots that are occupied by two or more rows. Here is an example table id| date |starttime|endtime | __|_____________________|_________|________| 1 | 2010-02-16 17:37:36 |14:35:00 |17:...

Drupal email when someone posts to forum topic.

Is there a module to email the owner of a post when someone replies to there forum post? ...

AJAX Post Not Sending Data?

I can't for the life of me figure out why this is happening. This is kind of a repost, so forgive me, but I have new data. I am running a javascript log out function called logOut() that has make a jQuery ajax call to a php script... function logOut(){ var data = new Object; data.log_out = true; $.ajax({ type: 'P...

Adding a Third Table to a Two-Table Join Query

Hello, The query below works just fine. It pulls fields from two MySQL tables, "comment" and "login". It does this for rows where "username" in the table "login" equals the variable "$profile." It also pulls fields for rows where "loginid" in the table "comment" equals the "loginid" that is also being pulled from "login." I would li...

File download in IE6 gets the wrong filename

I have a PHP script being served over https:// that is trying to push a PDF file to the user. The problem that in Internet Explorer 6 (which unfortunately I still have to support) is not obeying the filename being set in the header. FireFox and IE7 are both working properly. The file name keeps coming out as a random name with the c...

php class crash course

I'm going crazy trying to write my first php class; it is supposed to connect me to server and to a database but I'm always getting this error: Parse error: syntax error, unexpected ',', expecting T_PAAMAYIM_NEKUDOTAYIM in /Applications/XAMPP/xamppfiles/htdocs/classTest/test.php on line 9 Thanks in advance, here is the code: <?php // ...

Can I use php's fwrite with 644 file permissions?

I am trying to set up automated .htaccess updating. This clearly needs to be as secure as possible, however right now the best I can do file permission-wise is 666. What can I do to setup either my server or php code so that my script's fwrite() command will work with 644 or better? For instance is there a way to set my script(s) to ...

Read external HTML page and then find data within

I'm playing around with an idea, and I'm stuck at this one part. I want to read an external HTML page and then extract the data held within two <dd> tags. I've been using file_get_contents with good results, but I'm at a loss as to how to accomplish that last part. The two tags I want to extract the value from are always enclosed within ...

using PHP for "Fluid" design(using viewport resolution)

I need some opinions on using PHP to make completely "scalable" websites.. For instance, using viewport resolution and resizing images, applying dynamic css styles..... In my mind doing this just add's to the complexity and should not be done, it should be fixed or fluid using strictly css and no server-side languages to generate layouts...

Magento Product Details Image Size

Magento 1.4 Default Product Details image size is 265x265. All of our product images will be probably 2x taller than wide, and even if we pad them to make them square 265 will be too small to see detail in the image, so we'd like to make the image taller. I found the media.phtml file How would we go about modifying this file/Magent...

Is there a PHP function to combine the results of 2 arrays based off of keys?

Hey Everyone, If I have the following arrays arry1 = array( 101 => array( 'title1' => 'data', 'title2' => 'data', 'title3' => 'data' ), 102 => array( 'title1' => 'data', 'title2' => 'data', 'title3' => 'data' ), . . . ); arry2 = array( 101 => array( ...

google ajax api limit the result to 64

hi i am using google ajax api with my php script but it is not working above 64 results is there any hack to solve this problem Thanks ...

PHP mySQL Error

Hello, Im new to php so I decided to follow this tutorial for a simple login screen. I got the code setup but when I try login I get this error: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in (a long file path to the script) on line 27 The code I got from the tutorial is: <?php ob_start(); $hos...

How can I randomly execute code 33% of the time in PHP?

I'm not so sure how to write this: I want to generate a random number from 0 to 2, then write an if statement which executes specific code only 33% of the time. This is what I tried to do: if (rand(0, 3)=="2") { echo "Success" }; Thank you very much! ...