php

How can I debug PEAR auth?

I have a directory on my site that I've implemented PEAR's Auth to run my authentication. It is working great. However, I've tried to make a copy of my site (it's going to be translated to a different language), and on this new site, the Auth process doesn't seem to be working correctly. I can login properly, but every time I try to g...

Should Short tags be avoided as much as possible?

Possible Duplicate: Are PHP short tags acceptable to use? In PHP there are different short tags like <? ................... ?>, <?=$hello;?>. But I wanted to know, if they should be avoided as much as possible? and Why? ...

Preg Replace Wordpress tags

Hello, I'm displaying wordpress content on my own site. However the content has such things as: [caption id="attachment_367" align="aligncenter" width="432" caption="Version 2010!!"] I would basically like to strip anything thats inside [] and the [] themselves. Help greatly appreciated! ...

Loop through SimpleXml object in php

I have a simpleXml object and want to read the data from the object.I am new to php.The object details are as follows.I want to read name like general and name which is inside company array i.e Korey Kay & Partners.What is the syntax for it? SimpleXMLElement Object ( [@attributes] => Array ( [type] => array ) [project] => Arra...

Login to remote site with PHP cURL

I'm new to using cURL and its hard to find good resources for it. What I'm trying to do is login to a remote site, by having curl do the login form and then send back that it was successful. The code I have doesn't seem to work and only tries to show the main page of the site. $username="[email protected]"; $password="mypassword";...

Saving a jpeg with PHP sent from flash

Hi guys, I am trying to take a variable sent from flash, and save it to a spot on my web server using PHP, I have NO idea how to do this, and I can't seem to find code that works anywhere on the web, any help would be greatly appreciated, thanx! ...

Magento resource model for table with compound primary key

I am creating a custom module for a Magento ecommerce site, and the module will center around a new (ie, custom) table that has a compound/composite primary key, or rather the table has two columns that make up the primary key. Does anybody know how to create your models/resource models based on a table with a compound key? To give a f...

Kohana 3: Auth module

Hi, i'm trying to learn the Kohana's Auth module but login method always return false. Controller: <?php defined('SYSPATH') OR die('No Direct Script Access'); class Controller_Auth extends Controller { public function action_index() { if($_POST) { $this->login(); } $this->template = View::factor...

PHP Symfony + One-to-Many Relationship + Result Caching

I am getting unexpected behavior (to me!) when defining a one-to-many relationship with Symfony 1.4. Here is a simple example which demonstrates the behavior, having an Employer table and an Employee table: one Employer can have many Employees. The YML schema file is as follows: Employee: columns: id: { type: integer, primary: tru...

Function to sanitize input values PHP

I use this: function safeClean($n) { $n = trim($n); if(get_magic_quotes_gpc()) { $n = stripslashes($n); } $n = mysql_escape_string($n); $n = htmlentities($n); return $n; } To prevent any type of MySQL injection or anything like that. Whenever I use it to wrap around $_POST like this: $username ...

mysql_query() returns returns true, but mysql_num_rows() and mysql_fetch_array() give "not a valid resource errors

Here is the code in question: From index.php: require_once('includes/DbConnector.php'); // Create an object (instance) of the DbConnector $connector = new DbConnector(); // Execute the query to retrieve articles $query1 = "SELECT id, title FROM articles ORDER BY id DESC LIMIT 0,5"; $result = $connector->query($query1); echo "vardump...

php Mail function; Is this way of using it safe?

I have a classifieds website, and inside each classified, there is a small form. This form is for users to be able to tip their "friends": <form action="/bincgi/tip.php" method="post" name="tipForm" id="tipForm"> Tip: <input name="email2" id="email2" type="text" size="30 /> <input type="submit" value="Skicka Tips"/> <input type="hidden...

how to ensure comparison is case sensitive?

Hi there, im trying to do a comparison in MYSQL but wish for it to be case sensitive ex: $userID="test" $q = db_query("select * from users where user_id = '" . $userID . "'"); In DB: userid = "TEST" Ho do i go about making sure the mysql query does not return TRUE for this query as the userid varialbe doesnt match the case of th...

why does if(function_name()) not work?

Hey guys really quick question, I have a simple test that I was doing to prove a point and it does not work like I expected but I am not sure why it does not work. function test(){ echo 'test'; } if (test()){ echo 'ok'; } That was my test. 'ok' is not echoed and I am not sure why. I was testing this because my real code is ca...

Generating a zend form with dynamic data?

I need to access my session and based on the session property I need to grab stuff from the database to use as options in my dropdown. $_SESSION is: [sess_name] => Array( [properties] => Array( 1=> Hotel A, 2=> Hotel B ), [selected] => 1 ) I need to grab Hotel A from selected, and then access all accounts under H...

post on facebook page wall as facebook admin through facebook php api

Hi, I would like to post feed to facebook page wall as page admin. I can publish post to facebook wall with publish_stream from fb php api, but it is just as a normal facebook user. May I know how can I do likewise as a page admin (meaning that the post publish from facebook page and not from other fb user on the page wall)? Thank you....

using the selected value of a drop down before form submission

Hi, i am using a dropdown in php which asks for user_category before creating the user. Upon selection of the category further text boxes are to be created dynamically depending upon the selection. I know how to get the selected value from $_POST but here i need it befor form submission.Pls help ...

How to create a HTML5 + SVG document using the PHP XSLTProcessor

For a little project about XML I try to use HTML5 as it has SVG and WAI-ARIA Support. I also want to use a XSL stylesheet for my document. But I can't get a valid HTML5 document with a nested SVG. Here are some version I tested so far: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999...

"Remember Me" Feature with CodeIgniter's FreakAuth Library

Has anybody been able to implement a "remember me" feature with CodeIgniter's FreakAuth Library? ...

php mysql timestamp

I need to track the date and time a user was created in my mysql database. I have column called 'created' and the data type as TIMESTAMP. The problem is that when a user changes their password or other information the TIMESTAMP value changes. How can I set this to not change???? ...