php

Seeing "on Behalf of" in system generated emails

Hello, I use a PHP mailer with of my online programs and recently when I look in outlook I see '[email protected] on behalf of My Mailer [[email protected]]' when I receive emails from any of my domains. Previously the [email protected] was [email protected]: Return-path: <[email protected]> Received: fro...

MySQL Select JOIN 3 Tables

Hi All, I've got sort of a 'tricky' one here-- well, maybe not. I have three basic tables: tblUsers: usrID usrFirst usrLast 1 John Smith 2 Bill Jones 3 Jane Johnson pm_data: id date_sent title sender_id thread_id content 2 ...

what's the difference between model->alias and model->name in CakePHP?

'alias' and 'name' are both properties in cake models. They seem to be similar, but since both of them exist, there must be a difference. What is it? ...

Saving with HABTM in CakePHP

I am creating multiple associations in one go and there are a few problems when it comes to saving. I have the following code: <?php foreach($userData as $user) { $data = array('User' => array('id' => $user['id']), 'Site' => array('id' => $user['site_id'])); $this->User->save($data); } ?> I have experimented with formatting t...

Does Zend Framework turns off declaring variables as global?

I am integrating third party code into the web application I am writing in Zend Framework. The code I want to integrate declares variables as global. It works on its own, but not when I include it within Zend Framework. Initially I suspected that there is something in Zend Framework that is disabling the declaration of global variables...

Going from PHP to C/C++ & Java & beyond

I've been a LAMP developer for 5+ years. I have learned quite a bit on my own, but I feel like my "context" as a software developer is limited (ie. I can only create scripts & web applications). Ultimately I'd like to be able to create a range of applications from daemons to desktop apps. Additionally I'd like to learn more about the "in...

Can regex fix this?

The page: /index.php?page=6&test=1&test2=2 The code below strip's page=6 off of this so I can add our new page to the url and add the $url_without_page_var back to our link again: $_SERVER['argv'][0] // Displays: page=6&test=1&test2=2 And $url_without_page_var=preg_replace('/page=(\d+)/i','',$_SERVER['argv'][0]); // Displays: &te...

how to create pdf file

I want to create pdf file from my web page written by php . My document must produce from mysql and produce pdf file.I want to be to save this pdf and to read.Please give me code sample. ...

PHP preg_replace() backreferences used as arguments of another function

Hello. I am trying to extract information from a tags using a regex, then return a result based on various parts of the tag. preg_replace('/<(example )?(example2)+ \/>/', analyze(array($0, $1, $2)), $src); So I'm grabbing parts and passing it to the analyze() function. Once there, I want to do work based on the parts themselves: funct...

How do I search for a two character word using a MySQL query?

I'm using MySQL FULLTEXT search (in Natural Language mode). Example: SELECT Mem_id FROM Members WHERE MATCH (job_title) AGAINST ('".mysql_real_escape_string($keywordsWanted)."') I noticed that searching for "web developer" or "PHP coder" didn't work too well and so I added ft_min_word_len=3 to the MySQL config file (/etc/mysql/my.cnf)...

Using Ghostscript to convert PDF to JPEGs. The PDF contains some Dropshadow effects on Images. These shadows transfer as black areas onto the generated JPEG

So I'm working on a CMS module for a newspaper site. I'm enabling the editors with the option to upload a PDF of the entire newspaper, which will then be converted into a page-flipping digital online newspaper. The page-flipping trick is done with flash and is just an .swf that I use for all the editions. My problem is with the PDF 2 ...

php regular expression to check whether a number consists of 5 digits

how to write a regular expression to check whether a number is consisting only of 5 digits? ...

Ajax not working while calling php

Hi friends, Requirements : I have created a html page - to save a group of fields into a separate file Through ajax function(AjaxLoad), i have send some value into file.php and save it. I can able to reach the file.php, but its not creating the file. code is follows javascript function AjaxLoad(LstrXML){ var xmlhttp; xmlh...

Check Joomla Login From Wordpress Blog

Hi We have a Joomla 1.5 site with a blog in a subfolder /blog/ We would like to have a login status at the top of each page. For consistency of navigation we want to show the joomla login status at the top of the wordpress blog. eg Login | Register | Help or You are loged in as stephen baugh | Help The problem is that although th...

php form submission error

<?php require ("../Application.php");//session_start(); included in this file //init(); ?> <?php $_SESSION['message']=''; echo $_SESSION['key'].":".isset($_POST['submit']).":".$_POST['key']; if(isset($_POST['submit']) && ($_SESSION['key'] == $_POST['key'])){ submit(); } function submit(){ echo "submitted"; } ?> <?php includ...

Read multiple records given array of record IDs from the database efficiently

If you have an array of record ID's in your application code, what is the best way to read the records from the database? $idNumsIWant = {2,4,5,7,9,23,56}; Obviously looping over each ID is bad because you do n queries: foreach ($idNumsIWant as $memID) { $DBinfo = mysql_fetch_assoc(mysql_query("SELECT * FROM members WHERE mem_id ...

How to create [youtube]-Tag for PECL bbcode extension?

I use the PECL bbcode extension for parsing BBCode-Tags. Can anybody show me a way of replacing the text between the BBCode tags instead of surrounding it with HTML tags? I want to build a [youtube] Tag: [youtube]w0ffwDYo00Q[/youtube] My configuration for this tag looks like this: $tags = array( 'youtube' => array( 'type...

How can I optimise this MySQL query?

I am using the following MySQL query in a PHP script on a database that contains over 370,000,000 (yes, three hundred and seventy million) rows. I know that it is extremely resource intensive and it takes ages to run this one query. Does anyone know how I can either optimise the query or get the information in another way that's quicker?...

Removing formatting from Zend_Form_Element_File

Hi, I am trying to remove the dt and dd decorators from around a file element. Usually I apply $element->setDecorators(array(array('ViewHelper'))); to the form element. However this is not applicable in the case of Zend_Form_Element_File as an error is output. Any advice would be appreciated, Thanks ...

PHP5: Find Root Node in DOMDocument

I have a PHP5 DOMDocument and I try to find the root node (not the root element). Example: <test> <element> <bla1>x</bla1> <bla2>x</bla2> </element> <element> <bla1>y</bla1> <bla2>y</bla2> </element> <element> <bla1>z</bla1> <bla2>z</bla2> </element> </test> I wa...