php

Defining PHP variables - PHP 101

I'm defining the following variables: $rel_path = bloginfo('template_directory'); $thumb_directory = "$rel_path/images/portfolio/"; $orig_directory = "$rel_path/images/portfolio/thumbs"; the $rel_path is a WordPress function which appears to be printing, however, it is displaying spitting an error message which indicates that $rel_pat...

PHP broken code on local machine but working on staging server

Hiya all, I'm having a strange issue here, i have this bit of code: <?php if ($node->nid == "1") { include 'front.tpl.php'; return; } else { ?> <div id="left-col" class="grid_9"> <h1><?php print $title ?></h1> <hr /> <?php global $user;if ( $is_admin ) { ?>[<a href="/node/<?php print $node->nid ?>/edit">Edi...

HTML To PDF High Resolution

I want to convert a web page to a high-resolution PDF suitable for printing. How can I do this? ...

Make query results links in PHP

I'm trying to turn some query results into click-able links through PHP. I'm a beginner and don't really know much. I'm working with Wordpress. Here's what I'm shooting for: http://www.celebrything.com/ The right side bar is display the count results. I'd like the celebrity names to link to search links for each name. so the first shou...

Zend Framework, Doctrine Help needed

i am following the tutorial from http://www.zendcasts.com/introducing-doctrine-1-2-integration/2009/11/ i have a doctrine.php that "bootstraps?" doctrine ... sry i dont really fully understand the tut yet // Define path to application directory defined('APPLICATION_PATH') || define('APPLICATION_PATH', realpath(dirname(__FILE__) . ...

PHP: Instantiate class by reference?

I'm converting some old PHP 4.x code for PHP 5.3. I've come across the following, and I'm not sure what it does. $variable =& new ClassName(); What is the difference between that, and: $variable = new ClassName(); ...

Object Design Question User and Access Role in PHP with SQL

Hi, how do you design your objects lets say you have an object user and an object access_role. The user is stored in users table in an sql database, the access_role knows the user_id and is stored in an sql database. class user() { protected $_name; protected $_id; protected $_age; protected $_password; public...

PHP 'smart' search engine to search Mysql tables advice

I am creating a search engine for my php based website. I need to search a mysql table. Thing is, the search engine must be pretty 'smart', so that users can easily find their items (it's a classifieds website). I have currently set up a FULLTEXT search with this piece of code: MATCH (headline) AGAINST ($querystring) But this is...

Installing PHP-CURL using apt-get

I installed curl using synaptic package manager on my Ubuntu machine. However it didn't installed with ssl enabled. When i do curl-config --protocols, it does not show HTTPS. I want to install curl with ssl enabled. If i do it manually by downloading curl and then compiling it with "--with-ssl" flag and then recompiling my PHP with "-w...

php redirection

My php script is working on localhost but after uploading online it's showing a blank page. php installed on localhost version 5.2.6 php installed on production environment version 5.1.4 <?php define('INCLUDE_CHECK',true); require 'connect.php'; session_start(); php require 'function.php'; ?> <html> <head> </head> <body...

MySQL - convert and compare dates on query

I'm working on a football site witch, along with many features, list result tables. The tables are separated between seasons (season name, etc) and rounds (witch are generated everytime a new season starts up, like 2008/2009, 2009/2010, etc) rounds table has a start date and a end date, and the only way I have to dinamically know wich r...

Google checkout order placing response error

Hi, I am using google checkout in my site. But i'm not geeting response from there when i place an order. Showing an error "We encountered an error trying to access your server at http://www.mysite.com/cti-dev/check-out/test.php -- the error we got is Send failed with code: 401. Response body was: Failed to Get Basic Authentication H...

How would I call a helper from a helper in Codeigniter?

I'm writing some custom helpers in Codeigniter and I want to call some functions from other helper files like date, etc, in my helper. I keep getting "call to undefined function" errors. How can I reference other helper functions from my helper? Thx D ...

Find Users based on Twitter Friends

I have an app where I pull in tweets with a certain hash tag. When I find the hash tag the app automatically creates a user if they don't exist. When the user logs in via Twitter, I want be able to present them with their friends which are also using the app. The problem is for Twitter users with a ton of friends there is a max response ...

page not redirecting

session_start(); $_SESSION['fname']=$row['fname']; $_SESSION['user']=$row['name']; $_SESSION['adpoint'] = $row['adpoint']; $_SESSION['phone']=$row['phone']; $_SESSION['id'] = $row['id']; $_SESSION['rememberMe'] = $_POST['rememberMe']; // Store some data in the session setcookie('smsapp',$_POST['remembe...

PHP: Need to Expire Sessions for my webapp, when back button is pressed

We are working on a mission critical web application, we would like to expire the application's session out when a user presses the browser back button. Please help me with my problem. Thanks in advance. ...

Google check out error

Hi I want to implement Google checkout in my PHP project (running on Apache). I put the callback URL in my merchant center account. My Checkout is in sandbox mode. When placing an order I get the following error message in my merchant center: We encountered an error trying to access your server at myurl.org -- the error we got is S...

making a php function that If mysql returns 0 rows, return false

Im trying to get the function below to return TRUE if it finds a matching row, and FALSE if it finds 0 rows. function IsOpenEvent($id) { $result = mysql_query("SELECT * FROM `events` WHERE `access` = 'public' AND `id` = '$id' LIMIT 1") ...

PHP small problem with regular expressions

Hello people, I use this for clean a string: $clean = preg_replace("/[^a-zA-Z0-9\/_.;|+ -]/", '', $str); Works good, but I need add into the regex the char '&' too, I tried to add: $clean = preg_replace("/[^a-zA-Z0-9\/_.;&|+ -]/", '', $str); or $clean = preg_replace("/[^a-zA-Z0-9\/_.;\&|+ -]/", '', $str); but this doesn't work, ...

error in media wiki php code

$wgAuth = new HttpAuthPlugin(); - After this line, control is not reachin the next line, not printin the next log. error_log("JITEN TEST :WGAUTH object created, Value of wgAuth is :" . $wgAuth . "\n", 3, $logfile); $wgHooks['UserLoadFromSession'][] = array($wgAuth,'autoAuthenticate'); error_log("JITEN TEST :Value of wgAuth is :" . $w...