Hi,
I'm currently working on an oophp application. I have a site class which will contain all of the configuration settings for the app. Originally, I was going to use the singleton pattern to allow each object to reference a single instance of the site object, however mainly due to testing issues involved in this pattern, I've decided t...
How do I remember a url in php to serve it to a user after authentication. The idea is the user will request the url but while unauthenticated. In this case, I forward him to the login page, but what's the best practice to save that url so I can serve it to him once authenticated. I thought about saving it in session variables, but not s...
I read somewhere that browsers can only send a few concurrent request to resources on a domain. So if we split the resources across subdomains or may be domains .. will it speed up things?
Did you experiment something like this? What were the results or issues if any?
...
So I've decided to break up my CSS into an ie6-and-ie7-only file. I will have CSS rules in this file which target ie6 and ie7 only, such as:
div {
*color: red; /* target ie7 and below */
_color: green; /* target ie6 and below */
}
If possible, I prefer to use PHP with $_SERVER['HTTP_USER_AGENT'] to detect the browser, rather t...
I keep getting the following error listed below and I was wondering how do I correct this error.
Warning: mysqli_close() expects exactly 1 parameter, 0 given in
Here is the code listed below.
<?php
require_once ('./mysqli_connect.php'); // Connect to the db.
function make_list ($parent) {
global $tasks;
echo '<ol>';
foreach ($...
I have a file with .php extention www.example.com/thefile.php?name=123 that I want to direct the user to if the user visits any of the following aliases:
www.example.com/alias?name=123
www.example.com/unreal?name=123
www.example.com/fake?name=123
Is there a way I can get this done without using a framework that already uses this stru...
I'm building an Authentification library that's going to have around 45+ methods for dealing with user related stuff. However I've been wondering if it's actually recommendable to keep everything on a single file.
Is there a benefit on splitting my class into several subclasses and load them when needed?
I can always for example split ...
I'm looking to create a php function that can trim each line in a long string.
eg:
<?php
$txt = <<< HD
This is text.
This is text.
This is text.
HD;
echo trimHereDoc($txt);
output:
This is text.
This is text.
This is text.
Yes, I know about the trim() function. Just not sure how to use it on a long strings such a...
First let me describe my situation so that you might be able to help me better. There are two parts.
1:
I have a program that runs and analyzes a bunch of files. It generates a "report" that will later be fed into a website for DB storage and viewing. This report can contain pretty much any type of data, as the users can query pretty...
How can I convert the php function in the code below to a non-function.
<?php
require_once ('./mysqli_connect.php'); // Connect to the db.
function make_list ($parent)
{
global $tasks;
echo '<ol>';
foreach ($parent as $task_id => $todo)
{
echo "<li>$todo";
if (isset($tasks[$task_id]))
{
...
I am looking for a message broker (like Apache ActiveMQ for Java) that works with PHP, preferably open-source. Any ideas?
...
class Controller {
protected $_controller;
protected $_action;
protected $_template;
public $doNotRenderHeader;
public $render;
function __construct($controller, $action) {
$this->_controller = ucfirst($controller);
$this->_action = $action;
$model = ucfirst($controller);/* Conecting th...
What does this mean in PHP and when is the time to use it?
=>
Another example.
foreach ($parent as $task_id => $todo)
...
I'm using the app "Fiddler" to debug a GET attempt to a website via PHP cURL. In order to see the cURL traffic I had to specify that the cURL connection use the Fiddler proxy (see code below).
$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 1);
curl_setopt($ch, CURLOPT_PROXY, '127.0.0.1:8888');
curl_setopt($ch, CURLOPT_...
hi all
I want to use on my site a script that shows the user's country code. I know about maxmind.com's GeoIP PHP API, but I can't install the mod_geoip (not my own server)
:(
...
I have a problem with a table header containing input boxes. I have similar div's in the rest of the table and they work fine. the div is hidden by default, and is absolutely positioned The table inside the div usually just contains a few columns with a single form element in each column. This would be typical:
<a>show editrow</a>
<...
Hi,
I am creating an Image Search Engine. Currently, my script does bold the matching words on the keyword. But, some keywords are too long just like the followings.
When I search for shah rukh khan, there is an image with the following keyword.
25216d1235653089 shahrukh khan s
wallpaper shah rukh actor
As you see, the above k...
<?
class Launcher {
function launch() {
new Controller();
}
}
class Controller {
function __construct () {
if(!is_object($this->Model)) $this->Model = new Model();
if(!is_object($this->View)) $this->View = new View();
}
}
class Model {
function __construct () {
if(!is_object($this->Controlle...
In developing a web application that will handle credit cards, purchases, digital downloads, is there any real world benefit to using Java over PHP?
This will be a store that sells digital downloads.
...
What is the following Python code in PHP?
import sys
li = range(1,777);
def countFigure(li, n):
m = str(n);
return str(li).count(m);
# counting figures
for substr in range(1,10):
print substr, " ", countFigure(li, substr);
Wanted output for 777
1 258
2 258
3 258
4 258
5 258
6 258
7 231
8 147...