php

Using oauth and twitter to authenticate actions with php

Im learning about oauth and i have my application setup and im able to authenticate my account and get my token, but im curious how i use this to authenticate an API call? Where before im using http://username:[email protected]/whatever.xml What do i do now with my token to authenticate? ...

Trying to create category wise filtering in the view where i list stuff and getting an error in php?

I have a simple crud application where i am listing certain information . i need to create a filter on the basis of category but am getting an error. I get the error: Notice: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'mysql_real_escape_string()' ...

How to check if object is empty in PHP?

I'm reading JSON data with PHP and that data contains empty objects (like {}). So the problem is, I have to handle the case when object is empty in different manner but I can't find good enough way to do the check. empty(get_object_vars(object)) looks too scary and very inefficient. Is there good way to do the check? ...

php mysql query updating multiple tables

Guys I am new to php so bare with me if this question sounds weird. I have the following mysql query which I am running with php like so. Notice that the update query is updating multiple tables at the same time. $sql1 = <<<TEST1 UPDATE catalog_topics a LEFT JOIN catalog_files_join b ON a.catalogID = b.foreignKey LEFT JOIN catalog_...

Multiple Variables into 1 in a URL

I am looking to have a list of arguments passed across in an a URL. $url['key1']=1; $url['key2']=2; $url['key3']=3; $url['key4']=4; $url['key5']=5; $url['key6']=6; $url['key7']=7; Please Note I am trying to pass this in the URL in 1 GET variable. I know this would be better done by ?key1=1&key2=2&key3=3...etc but for reasons that are ...

PHP Active Directory authentication with Kerberos

Hi, I'm currently integrating a CMS (developed in PHP) authentication with Active Directory. This specific Active Directory only allows authentication through Kerberos, or ldaps:// (but this last one is not the most wanted since I'll have to use absolute paths). I've been searching the web for anything about PHP AD Kerberos Authenticat...

Strtotime with European date format

Hi, I'm trying to use strtotime to convert the following date: 07/09/2009 17:01:27 It's the Europe/London timezone format for 7th of September The function is inverting the month and the days, is there any workaround? thanks ...

Prevent imagecreatefromjpeg from stopping script

I am using imagecreatefromjpeg on a shared host, so if the image is to big then imagecreatefromjpeg will give me an "out of memmory error" and terminate the script. Is there anyway to catch the out of memmory error, and simply let imagecreatefromjpeg fail(Return false) instead of terminating the script? ...

ModRewrite Split Issue

This is a complicated one which I hope has a simple answer... RewriteRule ^category/([^.]+)/([0-9]+)/([^.]+)/([0-9]+) category.php?c_id=$2&filters=$3&_p=$4&name=$1 This rule would pick up category/kitchen/10/0-0-0-0-0-0-0-0/1 with the following get vals: category.php?c_id=10&filters=0-0-0-0-0-0-0-0&_p=1&name=kitchen The reason fil...

How to set hyperlink for a banner logo. Please help

I am trying to set hyperlink to logo which is at the left side of the banner. when i use <a href="home.php"> <div class="logo"></div></a> its not working. help me to come out of this problem ...

Merge FDF data into a PDF file using PHP

Is it possible to merge FDF data with a PDF file using PHP alone? Or is there no option but to use a 3rd party command line tool to achieve this? If that is the case can someone point me in the direction of one? I am currently outputting the FDF file to the browser in the hope that it will redirect the user to the filled in PDF but fo...

How to run "ANT" command in batch file through PHP?

My batch file includes following code, cd C:\Ant Ant How can I execute this file in PHP. I've tried everything including, system(); exec(); passthru(); but none of these functions worked for me. Please I need urgent help. Thanks in advance, -Avirat. ...

json_ encode - JSON.parse() combination, work well in Firefox but fail in other browsers

Hi I'm using the combination of json_encode (PHP) and JSON.parser (Javascript from json.org) for passing a JSON object from PHP to Javascript, the JSON object may have quotes and double quotes so I'm using addslashes() function in PHP. This combination work well in Firefox but not in other browsers like Safari, Chrome or Internet Explor...

How to integrate Zend Framework on my old PHP non centralized site?

We are developing a new site in Zend Framework while we maintain and improve our older version (plain old fashion PHP files). This in some cases is meaning waisting hours of programming that we could to some extend use for our newer versions. We do have full server control and a sophisticated 301 rewrites on Apache, so we could rewrite...

Wordpress: loop only include posts X day's old

I would like to show only the posts of the last X day's on my wordpress frontpage. Let's say, a week, so 7 day's. What's the propper way to tell wordpress to select only the posts in the last X day's in the loop? Currently, I've got it working trough a hack, but it messes up the pagination. Going to the next page does not select the ri...

Logic behind validating form info with PHP

Im trying my first form validation with PHP. I need some guidance with the logic. I have purchase.php (which has the form) and review-purchase.php(which sets SESSION variables and displays the user data inputted) If any of the fields fail validation I don't want the user to get to review-purchase.php Should I be sending the user to t...

Variable scope problem accessing outer variable

I have a function with a big hierarchy: function func(){ $a= 0; // Here the variable is 0 while(...){ echo $a; // gives me always 0 for(...){ if(...){ if(...){ $num = func3(); $a = $num; // this $a does not corrospond to $a in the beginning ...

Database various connections vs. one

We have this PHP application which selects a row from the database, works on it (calls an external API which uses a webservice), and then inserts a new register based on the work done. There's an AJAX display which informs the user of how many registers have been processed. The data is mostly text, so it's rather heavy data. The proce...

javascript php get value from a dynamically added textbox

i'm using this to generate a textbox dynamically:` <html> <head> <title>Dynamic Form</title> <script type="text/javascript" > function CreateTextbox() { var i = 6; createTextbox.innerHTML = createTextbox.innerHTML +"<input type=text name='flow'+ i/>" i++; } </script> </head> <body> <form name="form" action="post" method=""> <input type...

How could I change this mysql to mysqli?

Based on this code below I use for regular mysql, how could I convert it to use mysqli? Is it as simple as changing **mysql _query($sql); to mysqli _query($sql); ?** <?PHP //in my header file that is included on every page I have this $DB["dbName"] = "emails"; $DB["host"] = "localhost"; $DB["user"] = "root"; $DB["pass"] = ""; $link = ...