php

PHP PDO Connection to SQL Server with integrated security?

Can I connect to SQL Server 2008 using PDO and integrated security using the mssql driver? Currently doing something like this to connect normally: $db = new PDO("mssql:host=host;dbname=db", "user", "pass"); This works fine using SQL Server authentication, but it is a pain having to create SQL server logins for loads of databases, so ...

Usage of a helper within zend partialloop

hello, I am using the Zend Framework library / Framework At some point I need to give an array of texts ( with a given objectKey ) to the partialloop helper. Now in the partialLoop view I would like to use Zend Translate. Now I understand that Zend Translate isn't accessibly true the objectKey, but is there a way to use Zend Translat...

How to deduct time in php?

I wrote this <?php session_start(); if(!isset($_SESSION['now'])){ $_SESSION['now'] = time(); } if(time() > ($_SESSION['now'] + 300)){ echo "15 minutes have passed"; } else { echo "waiting"; } ?> What I want to do is, let the user wait for 15 minutes before he/she can view the page. Is the code correct? ...

XML vs. MySQL direct query performance

What, if any, is the performance overhead of using XML as the interface between a Php application (A) and a MySQL database via another Php application (B), rather than direct querying from Php application (A) to the database? How much will this change between application (A) and the database being on the same server, and being on separa...

PHP - Referer redirect script

Often, when searching for answers, I have found that certain websites will allow you to read the information they offer if the referer is, for example, google.com. Yet, if you link directly to the information, it will be unavailable. What I am looking for is the smallest PHP script that will set a referer of my choice, and a destination...

Cancel Event in WinBinder

Is it possible to cancel events in WinBinder? I.e. I want to prohibit some characters in a EditBox (textbox) I listen on the WBC_KEYDOWN-Event for my control. In other languages I'd return false or set the character-code (here in $lparam2) to null - but there seems to be no function/construct to do this in WinBinder. ...

PHP explode over every other word with a twist ??

Duplicate: http://stackoverflow.com/questions/840807/wondering-how-to-do-php-explode-over-every-other-word $string = "This is my test case for an example." If I do explode based on ' ' I get an Array('This','is','my','test','case','for','an','example.'); What I want is an explode for every other space. I'm looking for the fol...

PHP MySQL Querry "Create Table" - beginner help

I'm trying to create a simple database table using the PHP MySQL Querry "Create Table", but it's not working. What is wrong with the below code? // Make a MySQL Connection mysql_connect("localhost","the_database_name","the_database_password") or die(mysql_error()); mysql_select_db("the_database_name") or die(mysql_error()); // Create...

Unlimited diskspace/Bandwidth for hosting ASP.NET vs PHP website?

We are thinking to use Dotnetnuke(ASP.NET) as platform for creating asp.net based social networking site. Surprisingly, Its difficult to find webhost with unlimited diskspace/badnwidth to store/stream lots of photos/videos. On the other hand, PHP based webhosting companies do provide unlimited diskspace/bandwidth. Check it here So, I ...

Problem with array values...

I am having a problem where a routine (that I cannot modify) is returning me either a 3 nested array -or- a 2 nested array. The key values are never the same, however, I'd like to normalize the nesting so that I can make the 2 nested array 3 levels deep every time to avoid "Notice: Undefined index:" errors. Or if possible, have a routi...

Formatting PHP Code within Vim

I'm currently using Vim as a lightweight IDE. I have NERDTree, bufexplorer, supertab, and ctags plugins which do almost everything I want. Only big thing missing for me is auto code formatting. I'm working with some messy PHP code which has inconsistent indenting and code formatting, ideally I could highlight the code I want formatted (...

What are main advantages of RUBY and RAILS to PHP and CODEIGNITOR

We are about to start a new Web2/AJAX app and are trying to decide if its worth the time and effort learning Ruby/RubyOnRails instead of PHP, CodeIgnitor and JQuery we currently use. The key issues are clean/fast/modern AJAX UI, robust error handling, ans maintainability. I would appreciate unbiased (if thats at all possible talking la...

how to write a program in PHP, Ruby, or Python, and make it easily downloadable and installable by general users like a Win32 app?

I wonder when we write a program in PHP, Ruby, or Python, how do we make it easily downloadable and installable by general users like a Win32 app? and is it possible to make it a Mac app easily too? ...

PHP script runs over Browser but not with wget

I have a bash-sctipt running 5 php scripts via wget. Every php file is called but, on the last script, I get this warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in xyz.php, on line ABC What it is really strange is, if I run the same script via browser, the script runs fine, without any warning. T...

can PHP do something like p($i) and it prints "$i is 5" -- C and Ruby can... (that is, to print out "$i" automatically)

I was wondering if PHP can do this as there seems to be no good solution to it yet: p($i) and it will print $i is 5 and p(1 + 2) will print 1 + 2 is 3 and p($i * 2) => $i * 2 is 10 p(3 * factorial(3)) => 3 * factorial(3) is 18 C and Ruby both can do it... in C, it can be done by stringification, and in Ruby, there i...

Detect clients with Proxy Servers via PHP

I'm looking for a method, or a way to detect clients using any type of proxy server viewing my web site. I'm using PHP/Apache... what's the best way to do this? Any proxy server would need to be detected, not specifically one or the other. Edit I am more interested in the anonymous proxies... as the normal ones are easily detected by...

Is it possible to use environment variables in php.ini?

Rather than hard-wiring some paths in my php.ini configuration, I'd like to configure them using system variables that are shared in some other places such as my Apache configuration. I've done some searching and couldn't find the right mix of keywords to discover if there's a way to do this. Does anyone know if this can be done? uplo...

ZendFramework and open ID login, Is the ZF up to date?

I am trying to integrate an openID login in a ZF project (using the MVC). I get failures. When I traced the code I see the failures originate from: OpenId/Consumer.php (line ~740). Those lines try to analyze the open id protocol version from the first request done to the open id provider. The regexp in the ZF expect to receive HTML with ...

Dynamic URLs in CSS/JS

I'm splitting up one of my larger apps and introducing a 'cdn' url to house common objects like CSS, javascript, and images to avoid duplication. What I need to do, though, is have separate URLs for our dev environments, so I may have: http://cdn-dev.example.com http://cdn-qua.example.com http://cdn.example.com depending on what envir...

Run PHP Task Asynchronously

I work on a somewhat large web application, and the backend is mostly in PHP. There are several places in the code where I need to complete some task, but I don't want to make the user wait for the result. For example, when creating a new account, I need to send them a welcome email. But when they hit the 'Finish Registration' button, I ...