php

Stored procedures a no-go in the php/mysql world?

I'm quoting part of an answer which I received for another question of mine: In the PHP/MySQL world I would say stored procedures are no-go I would like to know: Is that so? Why? Why not? [edit]I mean this as a general question without a specific need in mind[/edit] ...

Allow user@example or user@localhost in email validation?

I'm working on an email validation check and we need to decided whether to allow user@localhost and user@example (notice no .anything) to be validated as a valid email address. This is for an open source project that has a number of use cases on both the web at large and intranets. RFC 2822 (Internet Message Format Standard) allows it b...

Is there any way to detect the target class in PHP 5 static methods?

Below is an example class hierarchy and code. What I'm looking for is a way to determine if 'ChildClass1' or 'ChildClass2' had the static method whoAmI() called on it without re-implementing it in each child class. <?php abstract class ParentClass { public static function whoAmI () { // NOT correct, always gives 'ParentCl...

Php $_GET issue

foreach ($_GET as $field => $label) { $datarray[]=$_GET[$field]; echo "$_GET[$field]"; echo "<br>"; } print_r($datarray); This is the output I am getting. I see the data is there in datarray but when I echo $_GET[$field] I only get "Array" But print_r($datarray) prints all the data. Any idea how I pull those values? OU...

OO PHP explanation For a braindead n00b

Hi guys, I've been writing PHP for about six years now and have got to a point where I feel I should be doing more to write better code. I know that Object Oriented code is the way to go but I can't get my head around the concept. Can anyone explain in terms that any idiot can understand, OO and how it works in PHP or point me to an id...

How can I cycle through pages?

Here's a challenge that I was tasked with recently. I still haven't figured out the best way to do it, maybe someone else has an idea. Using PHP and/or HTML, create a page that cycles through any number of other pages at a given interval. For instance, we would load this page and it would take us to google for 20 seconds, then on to y...

How To Read Active Directory Group Membership From PHP/IIS using COM?

I have the following code: $bind = new COM("LDAP://CN=GroupName,OU=Groups,OU=Division,DC=company,DC=local"); When I execute it from a command-prompt, it runs fine. When it runs under IIS/PHP/ISAPI, it barfs. Fatal error: Uncaught exception 'com_exception' with message 'Failed to create COM object `LDAP://CN=...[cut]...,DC=local': An...

How do I efficiently search an array to fill in form fields?

I am looking for an efficient way to pull the data I want out of an array called $submission_info so I can easily auto-fill my form fields. The array size is about 120. I want to find the field name and extract the content. In this case, the field name is loanOfficer and the content is John Doe. Output of Print_r($submission_info[1]): ...

PHP DOMDocument stripping HTML tags

I'm working on a small templating engine, and I'm using DOMDocument to parse the pages. My test page so far looks like this: <block name="content"> <?php echo 'this is some rendered PHP! <br />' ?> <p>Main column of <span>content</span></p> </block> And part of my class looks like this: private function parse($tag, $attr = 'n...

php $_GET sort problem

here is the input i am getting from my flash file process.php?Q2=898&Aa=Grade1&Tim=0%3A0%3A12&Q1=908&Bb=lkj&Q4=jhj&Q3=08&Cc=North%20America&Q0=1 and in php i use this code foreach ($_GET as $field => $label) { $datarray[]=$_GET[$field]; echo "$field :"; echo $_GET[$field];; echo "<br>"; i get this out put Q2 :898 Aa :Grade1 ...

Force HTTPS. How is it possible?

I've got just one page that I want to force as an HTTPS page (PHP on Apache). How do I do this without making the whole directory require HTTPS? Or, if you submit a form to an HTTPS page from an HTTP page, does it send it by HTTPS instead of HTTP? Here is my example: http://www.mysite.com/buyCrap.php needs to only be accessed through:...

Books and tutorials for beginners in Java and PHP

hi mi name is Carlos i'm from guatemala, i need help, I am a beginner in the programming and I need good books to be able to associate with the programming. you could help me, the language that strikes me is php and java for connections to DB ...

Detect browser connection closed in PHP

Does anyone know if it is possible to detect whether the browser has closed the connection during the execution of a long PHP script, when using apache and mod_php? For example, in Java, the HttpOutputStream will throw an exception if one attempts to write to it after the browser has closed it -- Or will respond negatively to checkError...

Opening Javascript based popup ads on the same page.

I own an image hosting site and would like to generate one popup per visitor per day. The easiest way for me to do this was to write a php script that called subdomains, like ads1.sitename.com ads2.sitename.com unfortunatly most of my advertisers want to give me a block of javascript code to use rather than a direct link, so I can't ju...

When would you need to use late static binding?

After reading this description of late static binding (LSB) I see pretty clearly what is going on. Now, under which sorts of circumstances might that be most useful or needed? ...

How might I pass variables through to cached content in PHP?

Essentially I have a PHP page that calls out some other HTML to be rendered through an object's method. It looks like this: MY PHP PAGE: // some content... <?php $GLOBALS["topOfThePage"] = true; $this->renderSomeHTML(); ?> // some content... <?php $GLOBALS["topOfThePage"] = false; $this->renderSomeHTML(); ?> The fi...

how to connect oracle?

how to connect oracle by php on MAC OS X? oci? ...

passing or reading .net cookie in php page

Hi I am trying to find a way to read the cookie that i generated in .net web application to read that on the php page because i want the users to login once but they should be able to view .net and php pages ,until the cookie expires user should not need to login in again , but both .net and php web applications are on different servers ...

Code reviews on the web for PHP and JavaScript code

What are the best places for freelancers or small companies to get code reviewed for PHP and JavaScript? Forums are an option, but are there any sites dedicated specifically to code reviews? Edit: Just for clarification, I'm looking more for a website to get the code critiqued by others than a tool that helps perform internal code revi...

Example/How-To create calendar appointment using Exchange 03 Webdav and PHP?

I've been trying to figure this out for about two weeks. I'm able to create email items in people's folders, read the folders, all that stuff but for the life of me I can not get anything to work with the calendars. I can provide examples of the XML I'm sending to WebDav but hoping someone out there has done this and has an example? ...