php

Difference between isset and array_key_exists

How do the follwing two function calls compare: isset($a['key']) array_key_exists('key', $a) ...

File uploads not working.

Hi, I've made a contact form with an option to upload image. It's in WordPress(my form is a part of a custom plugin I'm making). Everytime I upload a file, I find $_FILE to be empty. Here's code of my form. <table> <tr> <td valign="top"> <form action="" method="post" enctype="multipart/form-data"> <tab...

mysql query for show all friendnames in home page?

when a user will log in his profile then he will c all of his friends in his home page,I have 2 tables,no1:-table name fsb_profile containing profile_id,profile_name,etc table no2:- fsb_friendlist containing friendlist_memberid,friendlist_friendid.now i want to show the friend details in home page, my code is:- $id=$_SESSION["_ID"]; $q...

How do i get emacs syntax highlighting to recognize double quoted strings?

Emacs in html and php modes don't seem to recognize double quoted strings, or at least don't color them correctly. How can i get them to be visible? ...

Where can I find a simple tutorial on setting up twitter/google and open id user login forms for my PHP web app?

I have tried official Google, Twitter and Open ID tutorials and cannot get a universal login system to work for my web app. Help please ...

How to Get File Size of Files on FTP Server?

I need a list of all the files (and associated file sizes) on an FTP server. I can get a list of files using CodeIgniter’s FTP class, but no idea how to get the file size. How do I get the file sizes? Thanks. ...

How to use own php variables in wordpress template?

Hi, I am using a wordpress template in php like this: <?php include('wp-blog-header.php'); get_header(); ?> ...Hello World... <?php get_footer(); ?> ok, it works good... but the contents of title and other meta tags are empty. How can I change the header contents or use my own $variables inside the get_header() section? it doesnt w...

How can I get the base domain name from a URL, using PHP? eg google.com from images.google.com

Hi, I need to get the domain name from a URL. Examples: google.com images.google.com new.images.google.com www.google.com should all return google.com Also google.co.uk images.google.co.uk new.images.google.co.uk http://www.google.co.uk should all return google.co.uk I'm hesitant to use Regular Expressions, because something lik...

Char Encoding: Changing file from MacRoman to UTF-8 breaks string

I am working on a CakePHP site saved in MacRoman char encoding. I want to change all the files to UTF-8 for internationalisation. For all the other files in the site this works fine. However, in the core.php file there is a security salt, which is a string with special characters ("!:* etc.). When I save this file as UTF-8 the salt g...

What is the use of open_basedir in PHP and how does it work ?

I've gone through all the questions here related to open_basedir and could not find the answer to this question: What is the use of open_basedir and how to make use of it ? ...

(PHP - Session) How can user restrict to access direcly to controller.php , only allow access from view.php?

Hi, I am a beginner in PHP. How can I restrict user access to controller.php and allow access to it only via view.php? My proposal: I don't know if this is proper, or how to avoid robots accessing it directly. view.php: <?php session_start(); $_SESSION['isFromView'] = true; ?> <html> <body> <form action="...

Oracle Stored Procedure call by PhP

Here the code: <?php include_once 'config.php'; // Connect to database $conn = oci_connect($dbuser, $dbpasswd, $dbhost."/".$dbname); if (!$conn) { exit ("Connection failed."); } $id = isset($_GET['id']) ? (int)$_GET['id'] : false; $type = isset($_GET['type']) ? strtoupper($_GET['type']) : "BLOG"; $stmt = oci_parse($conn, "beg...

Xpath path help

I have the following XML: <products> <product> <name>Flat Panel Monitor</name> <code>LS123</code> <attributes> <attribute> <group>Color</group> <values> <value>Red</value> <value>Blue</value> <value>...

Clean html input in Codeigniter

HI guys, I building an app using CodeIgniter and I came to a problem. I have a form with a textarea in which the user puts his text using a simple editor powered by jwysiwyg.jquery. The problem is that is need to clean this input of garbage code (link the one that comes with pasting directly from Word). The form is validated with the ...

Elegantly check if a given date is yesterday

Hi, Assuming you have a Unix timestamp, what would be an easy and/or elegant way to check if that timestamp was some time yesterday? I am mostly looking for solutions in Javascript, PHP or C#, but pseudo code and language agnostic solutions (if any) are welcome as well. ...

php curl - sending form data to external website

Hello. I have a login form set up on my domain (eg: www.example.com/login). When the user enters their login information, I need those details to be passed through a login form on an external website and the user directed to the application that they are logging into. So to add the user steps to this: 1. User enters login information ...

Exception when uploading photo with Facebook Graph API

I would like to upload a photo to facebook for a user in the default album for an application. This is described under publishing here: http://developers.facebook.com/docs/reference/api/photo The method has been answered here: http://stackoverflow.com/questions/2964410/how-can-i-upload-photos-to-album-using-facebook-graph-api. I am usin...

How can I force a Save-As dialog box without leaving the page in php?

I have an anchor tag: <a href="file.pdf">Download Me</a> I would like for the user to click on it and then have a Save-As dialog box appear with a new filename I determine. I found this(http://www.w3schools.com/php/func_http_header.asp): header("Content-type:application/pdf"); // It will be called downloaded.pdf header("Content-Dis...

Need to compress CSS and JavaScript via PHP but need to know performance implications and how to implement?

I'm currently using PHP to include multiple css (or js) files into a single file (as well as compress the content using GZIP). E.g. the HTML page calls resources like this... <link rel="stylesheet" href="Concat.php?filetype=css&files=stylesheet1,stylesheet2,stylesheet3"></link> <script src="Concat.php?filetype=js&files=script1,script2,...

Joomla crash after installation.

http://localhost/joomla/administrator/ The web browser returns an error that the page does not exist after I complete the installation and deleted the folder. I have to use apache2. I am also using the latest version of apache, mysql. Im using php 5.2.13 VC6 x86 Thread Safe. I used a combo of two tutorials: Tutorial 1 Tutorial 2 When...