php

Ensuring all exceptions are considered when using PHP

I've used exceptions in Java and like the way it won't let you call a method unless you catch or throw the exceptions that it might throw. I'm looking for something similar in PHP. I realise PHP is more dynamic than Java, and doesn't even let you define the exceptions that it throws, but what is the closest I can get? We document our m...

different web files created for different browsers

It just occurs to me that for the past decade, all books on HTML/CSS always talk about browser incompatiblities and how to get around that issue by adding more "hacks" to CSS, JS, or HTML. Why is that they never advised that the other way to deal with that (and I believe the best way) is to add code (php, c, whatever) in the first line o...

How can I select the tag-name and attributes AND values of those attributes with ONE regular expression?

Hi, I have the following Regular Expression from this post (Regular expression for extracting tag attributes). (\S+)=["\']?((?:.(?!["\']?\s+(?:\S+)=|[>"\']))+.)["\']? I've created the following PHP code and it works nicely. I get [id='gridview1' and 'id' and 'gridview1'] from the preg_match_all() function. $regexp = '/(\S+)=["\']?...

Is it possible with PHP mail to send an email to a specific IP address?

We have a client that can't receive emails from a dedicated server using PHP mail because when their SPAM server does an MX record lookup for the IP it can't find one (so it bounces the email). This is because the mail exchange is on a different server completely. The client said that they have an IP address that bypasses the SPAM bloc...

How to send on a specific day in php?

Hi, I want to a e-cards or something like that. The user can choose the e-cards, after chosen, he must enter the some fields like name(to and from), email(to and from), message and I want to let user to choose which date to send the e-cards. How to send the e-cards on specific day? I need to write a script that run every new day? How to...

Why are the html tags showing up in my string in PHP?

I'm using a mail function which is sending back a message that is contained within the variable $body. I want to send the message to myself with certain words in bold and a number of break tags. Here is my code(HEREDOC SYNTAX): $body = <<<CTS <h1><b>Order for $name on datevariable</b></h1><br /><br /> <b><u>Administrative Details</u>...

How to Represent Classes in an Abstract Syntax Tree Based Interpreter

I have read the related questions, but none of them appears to address the question directly. I am working on writing a PHP script interpreter. I have the AST generating proper nodes for everything except classes. Handling classes is a bit different than handling functions, so I am looking for how to handle classes that are standalone...

How can I have the date from today show up with PHP?

I'm sending a mail function to myself. My first line reads 'Order for $name on $date' The $name variable comes from a form the user fills out. I would like the $date variable to be today's date, whatever that is on that day. How can I make the $date variable show today's date? ...

universal php mvc?

anyone know of a good universal mvc written in php? i'm looking for an mvc that i can instantiate into any type of application that fits in what project i will be building and will contain a huge amount of libraries at hand being very easy to instantiate a library into the application when needed. thanks ...

What are some methods to disable or correct for backward browsing in web apps?

Some web apps 'by design' don't function well when user's hit the back button in the middle of a procedure. What are some ways to disable or correct for users hitting the back button in vulnerable app sections? ...

Undefined offset: 1

I'm getting this error related to my PHP error-handling function. Undefined offset: 1 Here's the error handling code: function customError($errno, $errstr) { error_log("Error: [$errno] $errstr",1,"[email protected]","From: [email protected]"); die(); } //set error handler set_error_handler("customError"); Can anyone help point ou...

Complicated MySQL query for newsletter queue

Hey everyone, I'm back and looking forward to more of your brilliance. I have two tables: newsletters — each row contains a 'id', 'subject', 'body' & 'from' headers for an email newsletter_queue — each row contains an 'id', 'email' address, 'date' added to queue and the 'newsletterid' My goal is to develop a MySQL query that can pull...

Split a html code in two equal content parts, in PHP or JS

I want to take the content of a website article and create two or more columns of text. The difficult part is that i must keep the html tags and also close them if the cutting is done inside a <p></p> for example. Example: <p><span>One two three <strong>four</strong></span> five six</p> Result: <p><span>One two three<span><p> <p><s...

Can i use telephone api in PHP ??

hi all i need to know how can i connect telephone using php languages ...

How can i avoid warning message in php

Recently i worked in project. there i need to a rename a picture. the problem is when i rename the picture it renamed but show a warning message like bellow Warning: rename(seeker/SeekerPhoto/katr.jpg,seeker/SeekerPhoto/ussl.jpg) [function.rename]: No such file or directory in /subdomains/www/html/ussl/job/insphoto.php on line 100 ho...

Anybody's knows about Digg Api ??

hi all any body's knows about Digg Api n how to implement in php or java ...

How to see why a Smarty template fails silently?

I'm using Smarty templates which call object methods. I've put the code on a new server, but it silently doesn't work correctly. The template is being output, but is cut off at a certain point, probably because of an error. error_reporting is set to E_ALL. Even with $smarty->error_reporting = E_ALL and $smarty->debugging = TRUE, no erro...

Is there difference in the graphic library?

To a library displaying a graph, there are libraries (HTML5.JP) for library (JpGrapth) and javascript for PHP. When I build Web application, the too big difference thinks that there is not it in a user even if I use whichever, but will there be a fact, a merit by the difference of these languages, the demerit?  Which does own use? ...

What's the best way to issue a 301 redirect in this situation?

Hi all, I have a PHP5/Zend Framework 1.8.1 web site which is located at: http://www.example.com/foo The older version of this site, which infuriatingly, is still maintained by google's index was located at: http://www.example.com/foo/DEFAULT.ASP So a lot of people are requesting the above link and hitting a dead end. I figure, th...

PHP - MySQL Query not working

<mx:RemoteObject id="zendAMF" destination="zend" showBusyCursor="true" source="test_class" > <mx:method name="doLogin" result="onSayHelloResult(event)"> <mx:arguments> <username> {username.text} </username> <password> {password.text} </password> </mx:arguments> </mx:method> </mx:RemoteObject> This is my Flex co...