I'm in the final stages of implementing a codeigniter site which requires a really simple login system: one user and one password, to protect the admin area.
I think I will be using one of the many CI authentication libraries, which should allow me to ensure that people can't read from the database without being logged in as admin(I hop...
What is better...make classes specially for rendering html, sth. like this:
class IndexHTML {
public $doctype = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">";
public $title = "<title>MICE</title>"; //title of document
public $contentType = "<meta http-e...
I am trying to access a static variable within a class by using a variable class name. I'm aware that in order to access a function within the class, you use call_user_func():
class foo {
function bar() { echo 'hi'; }
}
$class = "foo";
all_user_func(array($class, 'bar')); // prints hi
However, this does not work when trying to ...
Is there a way in PHP to get a list of all sessions (and the variables within each) on the server?
Basically, we have a maintenance function which needs to know which users are currently logged into the site. We already store data for each user in a session variable, but I am hoping that I can loop through each of these sessions and pl...
I'm posting this question on it's own as I found post one which lacks full explanation or the best way to do it.
Should I use a language file to name items like:
$first_name= 'name';
$last_name = 'last_name';
and then include this file depending on selection?
I have an app which I need to have in two languages.
Will like something i...
Hi
I am having our company websites (x8 total 500,000per month) on a 1/3 share of a virtual server upgraded to 1 live server and 1 hot backup server. These two will be all our own, and run Debian, A2,M5,P5.2. The live one is more meaty than the spare.
What would be the best way to setup and use these servers?
We do not have a local de...
Hi All,
I'm working on an iPhone app that will upload images to a web server. I was wondering if anyone had any tips on how to generate unique names for each image file that gets uploaded.
I'm sure there are a million ways to do this, but if anyone has any suggestions I'd really appreciate it! Thanks.
...
If I define an array in PHP such as (I don't define its size):
$cart = array();
Do I simply add elements to it using?:
cartData[] = 13;
cartData[] = "foo";
cartData[] = obj;
Don't arrays in PHP have a add method, i.e. cart.add(13)?
...
Hi,
I have to dates of the form
Start Date: 2007-03-24 End Date: 2009-06-26
Now I need to find the difference between these two in the below form:
2 years, 3 months and 2 days
Can someone please help me with this
...
If I had a user logged onto my site, having his id stored in $_SESSION, and from his browser he clicked a 'Save' button which would make an AJAX request to the server. Will his $_SESSION and cookies be retained in this request, and can I safely rely on the id being present in the $_SESSION?
...
Hi, I am currently receiving a Strict Standards error when trying to make an alfresco web service call. I am using the Zend Framework. The tutorial works fine when not using the Zend Framework.
If i use the Zend_Soap_Client i get a segmentation error, when i use the PHP Soap_Client i get the following error message:
Strict Stand...
Using PHP, given a URL, how can I determine whether it is an image?
There is no context for the URL - it is just in the middle of a plain text file, or maybe just a string on its own.
I don't want high overhead (e.g. reading the content of the URL) as this could be called for many URLs on a page. Given this restriction, it isn't esse...
A certain site I know recently upgraded their bandwith from 2,5 TB monthly to 3,5 TB.
Reason is they went over the 2,5 limit recently. They're complaining they don't know how to get down the bandwidth usage.
One thing I haven't seen them consider is the fact that JPEG and other images that are displayed on the site(and it is an image-h...
Bear with me I am a bit new to all this,
I have this query running in my PHP script:
$insertQuery = "INSERT INTO blog_articles
VALUES '$title', $tags', '$category', '$blog', '$author', '$date'";
I then run this script:
if ($result = $connector->query($insertQuery)){
// It worked, give confirmation
echo '<center><b>Artic...
i want to open a notepad from php file and the notepad should contain the text which i declare as string in php file. essentially a notepad should open with the text I pass from php file.
...
Which scheme according to you is a better one in case of matching?
Is it eregi or stripos or any other method?
...
Code:
$arr = array( 10, 20, 30 );
$arr1 = array(
1=>30,
2=>20,
0=>10
);
var_dump( $arr == $arr1 );
$a = array( 1, 2, 3);
$b = array(
1=>2,
2=>3,
0=>1
);
var_dump($a == $b);
This outputs:
bool(false)
bool(true)
...
An SQL database is overkill if your storage needs are small. When I was young and dumb, I used a text file and flock()ed it when I needed to access it. This doesn't scale, but I still feel that non-database solutions have been completely ignored in Web 2.0.
Does anyone not use an SQL database for storage? What are the alternatives?
...
How can one detect the search engine bots using php??
...
Hello,
I'm using PHP to extract data from a MySQL database. I am able to build an XML file using DOM functions. Then using echo $dom->saveXML(); , I am able to return the XML from an AJAX call. Instead of using AJAX to get the XML, how would I save the XML file to a spot on the server? Thanks
...