php

PHP setting a cookie not 100%

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'])) { ?...

What can I use instead of TFMail for a form-mail script?

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...

error occurred in defining server file path.

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...

how do i find near by locations to a given location using google map api

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 provide security to my web site?

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 ...

How can I select the database record with the most vote_points and ensure that it is displayed first? PHP / Kohana 3

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...

PHP regular expression skip element

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...

problem with jquery autocomplete and zend framework

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...

How can I read PDF Bookmarks with PHP?

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! ...

PHP/MySQL query character limit?

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...

Dynamically check timetable for clashes - jquery/php

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...

Adding a comment in passworded zip makes it damaged.

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...

Call an object function returned by a method within php

There is any syntax to use something like this?: <?php function get_foo() { return new Foo(); } get_foo()->foo_method(); ?> ...

array_map/array_walk keeps reporting invalid callback, not found, and/or undefined.

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...

Console application only sending first 46 characters in a POST request

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...

named binding of variables in strings?

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...

The simplest question: extract values from array

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] =>...

error occurred in email script in php

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...

Why would Facebook OAuth token suddenly become invalid?

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...

How do I make the variable is undefined message disappear? PHP

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...