so i need a cookie set for 21 days on a browser when a user hits the site and everytime the user returns in that 21 day period i need to retrieve that value
if($_REQUEST['ref'] == "something"){
setcookie('something_value', "something" ,time()+60*60*24*21,'/','mydomain.com');
}
in the view
<?php if(isset($_COOKIE['something'])) { ?...
TFMail was a popular PERL CGI Form Mail script at one time. So far it has served our purposes. It is very easy to set up and configure.
Unfortunately, it only has basic functionality. It works well when you want users to fill in a form and have the result emailed to a specified email address.
Can someone recommend a script ( maybe...
I have defined file path like-
$docRoot = $_SERVER['DOCUMENT_ROOT'];
$webRoot = str_replace(array($docRoot, 'library/config.php'), '', $thisFile);
define('WEB_ROOT', $webRoot);
and used in my corresponding pages like-
<a href="<?php echo WEB_ROOT; ?>admin/" class="leftnav">Home</a>
<a href="<?php echo WEB_ROOT; ?>admin/category...
would like to find all the nearby places for a given place or address. Is there any google map api ? or we need to follow a sequence of steps like
Find the lat long of the place.
Do some processing and get near by lat longs.
do reverse geo coding with the obtained lat longs from step 2 and find the places for each lat long pairs.
cla...
How to protect my site from being hacked?just suggest some methods that are in common?
i am using php for scripting & mysql for database and i am using CodeIgniter(php framework).
if you know some good tutorial or ebooks then provide me some link
-Abhijeet
...
Hello everyone and as usual, thank you to anyone taking the time to read this.
I am attempting to display all of the answers relevant to a question that has been asked. I am using Kohana 3.
So far, I am able to determine which record has the highest amount of vote_points via:
$best_id = DB::query(Database::SELECT, 'SELECT id FROM ans...
I have written regular expression which converts text links into clickable link. The code works fine however when an HTML tag is passed it mess the code
Here is my code
$text = preg_replace('#(?<![">])((http|ftp)s?://[^<>\s]+)#i', '<a href="\\0">\\0</a>', $text );
It is suppose to skip following element
<a href="http://www.yahoo.co...
I am trying to implement this tutorial in my application. I have managed to make it work until the point where I had to modify the view controller and add the link to the .ajax.html file.
My code so far:
class MenuController extends Zend_Controller_Action {
public function init() {
$this->_helper->ajaxContext()->a...
I've been looking (unsuccessfully) for a way to open a PDF file and get the bookmarks out of it. I've looked at most PHP libraries for PDFs, but they seem focused on creation, not reading.
At this point, I'd be happy with a solution in any language, so it doesn't have to be PHP, but it would be nice.
Thanks!
...
So I've got a relatively long query as follows:
SELECT (
(CASE Methanethiol
WHEN -1 THEN 0
ELSE Methanethiol
END)
+
...
+
(CASE nHeptanethiol
WHEN -1 THEN 0
ELSE nHeptanethiol
END)
)
FROM condensates.mercaptans
WHERE (
(CASE Methanethiol
WHEN -1 THEN 0
ELSE...
Hi
I'm making a timetable site for a music festival. The purpose of this site is for people to choose acts they want to see and compile their own personal timetable for the event. At the moment the site has 2 tables:
The full list of acts on at the
festival
The user's personal timetable
Here is my problem. Everytime an act is added...
iam using zip uploader
and this zip passworded
ok?
when upload it and download and extract it with the password it work good
but
when upload it and use$zip->setArchiveComment(); to add comment in it
and download then trying to extract tell me the password incorrect
and that is happing in the server only
in the local host every thing is g...
There is any syntax to use something like this?:
<?php
function get_foo() {
return new Foo();
}
get_foo()->foo_method();
?>
...
I just wanted a more elegant automated solution to my form validation. On PHP.net I found a cool class script from the SQL injection page. Here it is the code (modified). It's suppose to go through my $_POST array and apply the validation function.
class secure
{
function secureSuperGlobalPOST($v)
{
$_POST[$v] = htmlspeci...
I am building a console application that gathers some data and then sends it to a php page through a POST request. This is my C# code:
HttpWebRequest Request = (HttpWebRequest)WebRequest.Create("http://localhost/log.php");
Request.Method = "POST";
Request.ContentType = "application/x-www-form-urlencoded";
string PostData = "data=" + Use...
I'm looking for function like sprintf(), except whereas with sprintf() you bind the values by order of arguments, I want something where I can bind variables by name. So, if I had the string "Hello $name! We're please to have you visit, $name!", you could pass an array or something and get the resultant string from it.
Something like th...
So this is an example:
Array (
[0] => Array ( [title] => Title_1 [checkout] => 1 [no_gateway] => 0 )
[1] => Array ( [title] => Title_2 [checkout] => 1 [no_gateway] => 1 )
[2] => Array ( [title] => Title_3 [checkout] => 0 [no_gateway] => 0 )
[3] => Array ( [title] => Title_4 [checkout] => 1 [no_gateway] => 1 )
[4] => Array ( [title] =>...
email script -
$subject = "[New Order] " . $_SESSION['orderId'];
$email = $shopConfig['email'];
$message = "You have a new order. Check the order detail here \n http://" . $_SERVER['HTTP_HOST'] . WEB_ROOT . 'admin/order/index.php?view=detail&oid=' . $_SESSION['orderId'] ;
mail($email, $subject, $message, "From: $email\r\nReturn-pa...
I'm using Facebook's PHP SDK, and it's been great so far. However, I have a weird issue on one page. On this page, I make a call to the graph API, then later a call using FQL. On the second call, however, I get an "Invalid OAuth 2.0 Access Token" exception. Why would the token become invalid while the first call worked? I also use FQL (s...
I have a variable in a php code that is in a loop and while the loop is running sometimes becomes undefined. I have an if statement that checks whether the variable is defined so the variable being undefined is not a problem, however, what is a problem are the continuous this variable is undefined messages that are generated by the serve...