php

How to redirect to (or enforce) SSL connection?

I am using Zend Framework(MVC part of it), and need to either redirect user to SSL enabled page or to force SSL from controller somehow and don't quite see how to do that? Maybe someone can share the knowledge? Thanks! ...

How can I enforce a maximum amount of forked children?

EDIT: I've tagged this C in a hope to get more response. It's more the theory I'm interested in than a specific language implementation. So if you're a C coder please treat the following PHP as pseudo-code and feel free to respond with an answer written in C. I am trying to speed up a PHP CLI script by having it execute its tasks in p...

php script for member approval by administrator

i created a register page n login page 4 members in php n mysql.and also i created a admin account and now i want to do something like if the member register he will be added only when the administrator approves it.please help ...

preg_replace is replacing $ signs

I have the following piece of code which replaces "template markers" such as %POST_TITLE% with the contents of a variable called $post_title. function replaceTags( $template, $newtext ) { $template = preg_replace( '/%MYTAG%/', $newtext, $template ); return $template; } The issue is that when $post_full has a '$' in it, the ret...

Free PHP editor for Mac?

I am new to the Mac world and I'm looking for PHP development tools, right now the most important thing is the editor. Syntax highlighting and a file tree list are mandatory, of course, and code insight would be nice (of course :). I am hoping that there are free editors out there that provide these functionality and I hope someone could...

How can I find the Largest Common Substring between two strings in PHP?

Is there a fast algorithm for finding the Largest Common Substring in two strings or is it an NPComplete problem? In PHP, I can find a needle in a haystack: <?php if (strstr("there is a needle in a haystack", "needle")) { echo "found<br>\n"; } ?> I guess I could do this in a loop over one of the strings but that would be very ex...

No image, and no popup window

Hello, I hava an ajax application that will not display an image, or make a popup window from html stored in a file. This is the code I am usiong for the popup: echo '<script> function makewindows(){ child1 = window.open ("about:blank"); child1.document.write(' . json_encode($row2["ARTICLE_DESC"]) . '); child1.document.close(); } </s...

What's the easiest way to test PHP in Windows XP Professional?

I want to test some PHP on my local machine running Windows XP Professional. I'm familiar with coding PHP for upload, but not with running a web server. What is the easiest way to set up a test environment? Step-by-step instructions would be great if you can give them. (I see WAMP recommended in this thread - thoughts?) Update - a yea...

What is the best way to ascertain the length (in characters) of the longest element in an array?

What is the best way to ascertain the length (in characters) of the longest element in an array? I need to find the longest element in an array of option values for a select box so that I can set the width dynamically. ...

How find source code for eval'd function in PHP?

I am trying to find a way to get the source code for (user defined) PHP functions in a string. For normal code this is easy, using reflection I can find the file and linenumbers where the function is defined, then I can open the file and read the function source code. This will not work if a function is defined in eval'd code. I do not...

Is there a more efficient way of creating a list of years/months?

On a page I want to dynamically list years and all the months in each year so an archive for each month can be viewed. I want to show the current year first but the current year may not be over yet so I only want to show the months that have passed, and the current month. Then I want all years and all months in the past since this year (...

Create an Array of the Last 30 Days Using PHP

I am trying to create an array starting with today and going back the last 30 days with PHP and I am having trouble. I can estimate but I don’t know a good way of doing it and taking into account the number of days in the previous month etc. Does anyone have a good solution? I can’t get close but I need to make sure it is 100% accurate...

How to wean myself from FTP in favor of Version Control

I have heard that uploading your website with FTP is now for n00bs, but it's the only way I've known how for the 8 or so years I've been building websites. Apparently all the buzz now is using a version control system, like SVN or Git, and somehow using SSH to upload only the files that have changed (if I understand correctly). I'm won...

Cookie path special characters

My application needs to set cookies for specific paths in the application. For example (in php): setcookie(*cookie_name*,*value*,*date*,"/subpath/subpath/unique_name"); setcookie(*cookie_name*,*value*,*date*,"/subpath/subpath/another unique name"); Oddly enough, the first setcookie works fine. The second doesn't generate an error and ...

Suggest a good PHP wiki engine

I am looking for a small wiki engine that is easy to embed into an existing PHP application. Or perhaps a set of libraries to handle all the typical wiki functions. Currently I am using ErfurtWiki, but it is starting to show its age. It hasn't been updated since 2005, and several of the pages on sourceforge appear to have been hacked....

PHP, MSSQL2005 and Codepages

I have a php script which accesses a MSSQL2005 database, reads some data from it and sends the results in a mail. There are special characters in both some column names (I know, it's terrible) and in the fields itself. When I access the script through my browser (webserver iis), the query is executed correctly and the contents of the...

is ther a drupal function to jump out of the page rendering process and return a page not found?

I would like to have the choice in a variable_load function (as used to load variables from menu arguments) to circumvent the remainder of the page rendering process and give the user a "page not found." I could use a drupal_goto() but I would prefer not to redirect the user and change the url in their browser. Is this possible? ...

MySQL/PHP - escaping characters that may slow my database down (or make it perform unexpectedly)

I run all my integers through a (int)Integer to make them safe to use in my query strings. I also run my strings through this function code if(!get_magic_quotes_gpc()) { $string = mysql_real_escape_string($string); } $pattern = array("\\'", "\\\"", "\\\\", "\\0"); $replace = array("", "", "", ""); if(pr...

PHP include file strategy needed

I'm in the process of setting up a php project, but am not very familiar with how to properly use php's include/require commands. My layout currently looks like this: /public --apache points into this directory /public/index.php /public/blah/page.php /utils/util1.php -- useful classes/code are stored in other directories out he...

basic php form help

I'm trying to make a calculator that will take inputs from users and estimate for them how much money they'll save if they use various different VoIP services. I've set it up like this: <form method="get" action="voip_calculator.php"> How much is your monthly phone bill? <input name="monthlybill" type="text" value="$" size="8"> ...