php

How can I check the security of my website?

How can I check the security of my website? What are the best ways to avoid security holes? ...

Object's state in the Template method design pattern

Here is an implementation example of the algorigthm in the base absctract class from http://sourcemaking.com/design_patterns/template_method/php public final function showBookTitleInfo($book_in) { $title = $book_in->getTitle(); $author = $book_in->getAuthor(); $processedTitle = $this->processTitle($title); $processedAuth...

How to make Zend IDE 5.5.1 to not bother about backslashes?

I use Zend IDE and quite often use Analyze code to quickly find undeclared or unused variables. As all PHP developers I also use regular expressions. So main question is where to set a checkbox or tune config file to disable these warnings: Bad escape sequence: \s (line NN) Thanks for answers! ...

Special characters in PHP / MySQL

Hi, I have in the database words that include special character (in Spanish mostly, like tildes). In the database everything is saved and shown correctly with PHPmyAdmin, but when I get the data (using PHP) and display it in a browser, I get a weird character, like a "?" with a square... I need a general fix so I don't need to escape eac...

Sign in into a page using PHP

I have a PHP engine login page which i want to sign in using another PHP file without me physically inputting the details on that page, so i should be able to run a PHP file and sign into another login page on my server ...

How to send mail using PHP?

I'm using Windows Vista OS. PHP, MySQL as the database and Apache web server. I want to send notification to those who want to join in my site. But the problem is when I click submit. It doesn't send anything to the email address of the user. What to do you think is the best solution for this? <?php $to = "[email protected]"; $sub...

Zend Framework and SQL Server

I'm trying to use Zend Framework with SQL server 2005 express (through Pdo_Mssql with wamp installation) but seem that pdo can't connect to SQL. This is my code: require '../application/bootstrap.php'; try { $db = Zend_Db::factory('Pdo_Mssql', array( 'host' => 'localhost', 'username' => 'sa', 'password' => 'veryst...

How to get different timezones' current time in PHP?

Unfortunately I'm not using PHP 5. On the documentation of the date function it has a timezone section which lets you specify the difference from the GMT tome. How can you use that to get the current/local time in a specified timezone, and does it with with daylights savings? ...

loading XML with PHP taking too long

Hello, I'm trying to retrieve information from an online XML file and it takes too long to get that information. It even get most of the times timeout error. The strange part is that when i open the link directly on the browser is fast. $xmlobj = simplexml_load_file("http://apple.accuweather.com/adcbin/apple/Apple_Weather_Data.asp?zipc...

Elegant database design help... (MySQL/PHP)

Hi, I'm building a movies website... I need to display info about each movie, including genres, actors, and a lot of info (IMDB.com like)... I created a 'movies' table including an ID and some basic information. For the genres I created a 'genres' table including 2 columns: ID and genre. Then I use a 'genres2movies' table with two colum...

SMTP configuration

I have the Vista Home Premium operating system and I am developing an PHP web application that sends out emails. I need to configure SMTP and I have tried several options from installing PHPmailer. btu the sad thing is it did not send an email. Should I continue to try to figure out PHPmailer or is there a better way? If PHPmailer is t...

Command line instruction parsing

I've been all over google and haven't been able to find a regex that would parse (correctly) CLI arguments. Does anyone have in their code library such a thing? Ideally it would parse all styles of arguments (i.e.: -v -abc --arg=val --arg="val1 val2" --arg "val") Thanks! P.S.: This would be used in PHP context (preg) ...

PHP and ?? operator

Like some people know, C# has very useful ?? operator which evaluates and returns expression on the right if expression on the left is null. It's very useful for providing default values, for example: int spaces = readSetting("spaces") ?? 5; If readSetting couldn't find "spaces" and returns null, variable spaces would hold default val...

Which is more efficient, PHP string functions or regex in PHP?

I'm writing PHP code to parse a string. It needs to be as fast as possible, so are regular expressions the way to go? I have a hunch that PHP string functions are more expensive, but it's just a guess. What's the truth? Here's specifically what I need to do with the string: Grab the first half (based on the third location of a substrin...

Framework - what is a PHP framework?

What are the advantages/disadvantages of using a PHP framework over just writing direct PHP code? ...

How do I use snk file to sign data in PHP?

How to convert the .snk RSA keypair file used to sign the .NET assemblies to XML based files that can be used with PHP or other software? XML file sample: <BitStrength>1024</BitStrength><RSAKeyValue><Modulus>tk=</Modulus><Exponent>QB</Exponent></RSAKeyValue> ...

Web frameworks performance comparison

I'm looking for real life benchmarks comparing web frameworks based on dynamic languages (Python, Ruby, Groovy and Lua). Even better if they're compared up against classic solutions based on PHP, Java, ASP.NET maybe even Perl. I'm particularly interested in: Django Ruby on Rails Grails Zend Framework Struts2 EDIT: As for Sean's answe...

Can a PHP intranet share Windows logins?

I have created some PHP-based intranet resources that require users to log in. The users create their own logins, and I verify that they are logged in using a cookie. I've been asked if I can tie that login to their Windows login instead. My initial response was "a web page cannot access your Windows login - that would be a security ris...

regex for url and image within a text or html

i'm running out of ideas on the best regex implementation for this problem. Sample user input: bla bla bla http://foo.com bla bla bla http://tinypic.com/boo.png bla bla bla Looking for solution that will detect non-image url and turn it into a link and also turn image url into an image embed (IMG tag). so the output will be: bla bla...

Call PHP code from JSP Page

I am trying to call a piece of PHP code from my JSP Page. How do I do that? I normally use servlets but I need this PHP code for creating a particular report since it sorts the table fields dynamically which I am unable to do with my servlet. Please help! ...