I am creating a session when a user logs in like so:
$_SESSION['id'] = $id;
How can I specify a timeout on that session of X minutes and then have it perform a function or a page redirect once it has reached X minutes??
EDIT: I forgot to mention that I need the session to timeout due to inactivity.
...
Hello,
Problem is about CakePhp. If I give permission to required directories CSS does not work. Sample URL: link text
Isn't this weird?
...
I have some database information that is being shown on a page.
I am using a pagination class that uses the $_GET['page'] variable in the url. When you click on a different pagination anchor tag, it changes $_GET['page'] to a new number in the url and shows the corresponding results.
I have sort and search features which uses the $_GE...
Hi!
I am using some XML parser to get some information from API, blah blah... :)
In one place in my script, I need to convert string to int but I'm not sure how...
Here is my object:
object(parserXMLElement)#45 (4) {
["name:private"]=>
string(7) "balance"
["data:private"]=>
object(SimpleXMLElement)#46 (1) {
[0]=>
strin...
I want my users to be logged out automatically after X minutes of inactivity. I also want to have all sessions destroyed.
How can this be done? How can I check for inactivity then perform a function to log them out???
...
Hi,
I have an Android application from which I want to upload some data to a database on my web server. As the MySql java library has a size of about 5 mb, I don't want to include it with the application.
So I'll make a HTTP request for a php script and send the data with the URL as parameters. How do I make sure that only I can call th...
I want to replace word groups by links. I use a multi-dimensional array to define these (in the real world there will be thousands of them).
Here's the code:
$text = "<html><body><pre>
Here is Foo in text.
Now come Baz? and Bar-X.
Replace nothing here: Foo (followed by brackets).
</pre></body></html>";
$s = array(
array("t" => "...
I have some form fields that when a form is submitted creates an array within the $_POST, I needing to check the this array has atleast 4 keys, how can I check that? I have no idea
...
Hi all,
I'm a bit new to using emacs for webdevelopment.
I am using php-mode and i am happy with it.
There is only one issue i have which causes me a lot of problems because of our company's coding style.
When i have a function, e.g.:
$instance = new Model('foo', 'bar');
And I want to indent it like this:
$instance = new Model(
...
This has me beat. I'm trying to create an array of fields in cakePHP 1.2.5 & PHP 5.3.2
The array is zero based. On the first iteration, $count == 0. For some reason the string concatenation seems to convert this to null or unset which cake then interprets as "insert model name here", viz:
for($count=0;$count<$num;$count++)
{
echo $fo...
I've got an array coming back from a Flash app created in Flash Builder 4.
I have a service setup that queries and brings data back from the DB successfully, however the Update script is generating the Undefined Property errors.
I'm still learning both PHP and Flash Builder, and don't fully understand what the $this-> commands do.
If ...
I currently have the following code:
RewriteCond %{REQUEST_URI} !assets/
RewriteCond %{REQUEST_URI} !uploads/
RewriteRule ^([a-z|0-9_&;=-]+)/([a-z|0-9_&;=-]+) index.php?method=$1&value=$2 [NC,L]
This works perfectly to redirect 'page/home' to 'index.php?method=page&value=home. However at some points I need to add an extra variable or...
For my website I want to store the general format of the site in a single PHP file in a single location, and each of the different pages content in the local location of the page. I then want to pass the title and content address to the included file via a variable.
However I can't get the included format file to read the variables stor...
I am making some code , But it is so strange that code just get prints on screen , I am not able to find any reason of it.
Please help me out of this, rest of the code is working fine.
Thanks
...
How I can get the length of an audio file in php.
If it's too hard to do in php then any other way should work alright.
...
All,
What is the signification of the '@' symbol in PHP? For example, what does it mean in this statement:
$sd = (@$argv[1]) ? getdate(strtotime($argv[1])) : getdate();
I understand the ternary operator '?', but I have no idea what the '@' means...
The code is sample code from the (very good!) cs75.net Harvard extension course.
Th...
Morning all,
I have a php script which I have been testing, and seems to run fine when I call it from the command line.
I now want to automate it via cron, how can I get the outputs I have put into the file as checkpoints into a log file?
eg I have some simple echo commands in the script and I'd like the output to appear inside an exi...
I've got loads of coordinates for a polygon in a database. I also have coordinates for an marker in my database.
How do i detect if the marker is inside this polyon.
Note: I use a cronjob to move the marker, and in this cronjob it needs to detect this. So javascript isn't involved!
Shape of polygon is not just a circle or square. It c...
I'm working on a form where I need to dynamically add inputs whenever the user clicks a "more widgets" button. There's a hidden div inside the form, and I append the inputs to it with jQuery, like this:
$('div#newwidgetinputs').show().append(newInputs);
They show up, are properly named, etc, but when I post the form, their contents ar...
Hi all,
Visitors can contact staff by means of contact form (visitor needs to submit email as well). This will be stored in DB. Now considering that staff responds to this message, the reply from the staff would be sent to the visitors email directly. Say if the user wants to follow up on the message sent by the staff, I would like the ...