php

Is there any simple way of interfacing with Twitter/OAuth using PHP?

I am losing my mind here. Im looking at a beginners OAuth php package that has a 700 line file. Im used to using 10-12 lines of CURL or just a couple lines with simpleXML to get the same data. Is there a very meat and potatoes way to convey the concepts of interfacing with twitter via oauth without totally alienating someone? Im u...

Can I autoload function files without classes in PHP?

My site is pretty large and I do not use PHP Classes, I do not understand OO good enough yet to re-write my site to use them however I would really like to use the __autoload($class_name) feature that classes use. I rely a lot on functions, I have different function files, forums.inc.php blogs.inc.php user.inc.php photos.inc.php general...

Pagenav. By clicking next get next lets say "20" records (php/mysql)

Hey there.. i would like to ask the experts.. i've already created a query to mysql that will give 20 results from mysql table etc. "cat" heres the calling: if(isset($_GET['cat'])) { $query = "SELECT game_title,game_desc,.... FROM games WHERE cat_id='".validate_input($_GET['cat'])."' LIMIT 20"; } ... by this i manage to ge...

Best way to encode passwords in PHP

I currently use, base64_encode() to encode a user's password, this works well because it allows me to simply use base64decode() to decode the password to a word and send to there email if they lose there password. I have been reading up on password though and a lot of people seem to say that you should use sha1() to encode a password....

Convert string to unique numeric value in php

I needed a unique internal int to use that would represent several random content types that I couldn't hard code as class constants or config options. Yet I didn't want to refer to "2" when I could use the easier to follow term "post". So though up the a way to get a INT value from a string which seems to work fairly collision free for ...

Shopping Cart Structure Problem, Size selection etc.

Hello, I'm working on a shopping cart and my problem is, how should I design database for size selection for products? Tshirts can be "XL, L, M, S" etc. and shoes can be "36,37,38,39...blabla" Should I do just one size table or many tables for several types (tshirt, shoes etc.)? Thanks in advance... ...

How do I insert NULL values using PDO?

I'm using this code and I'm beyond frustration: try { $dbh = new PDO('mysql:dbname=' . DB . ';host=' . HOST, USER, PASS); $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $dbh->setAttribute(PDO::MYSQL_ATTR_INIT_COMMAND, "SET NAMES 'utf8'"); } catch(PDOException $e) ...

How do I include a php.ini file in another php.ini file?

How do I include a php.ini file in another php.ini file? ...

how do i retain the value of dynamically added textboxes

i am using this code: <html> <head> <title>Dynamic Form</title> <script type="text/javascript"> var i = 6; function CreateTextbox(){ createTextbox.innerHTML = createTextbox.innerHTML +'<input type=text name="flow'+i+'"/>' i++; } </script> </head> <body> <form name="form" action="po...

php in jquery code possible?

I have the below jquery function $(function(){ $("select#rooms").change(function(){ $.getJSON("/admin/select.php",{id: $(this).val(), ajax: 'true'}, function(j){ var options = ''; for (var i = 0; i < j.length; i++) { options += '<option value="' + j[i].optionValue + '">' + j[i].optionDisplay + '</...

Download then upload a file in PHP

I need to download a file using PHP and then after that upload the downloaded file to the user. e.g. Download file from test.com/test.zip Either cache the file to disk or stream Immediately to the user. If possible how can i do this using curl or how can i do this using normal PHP (no extra libs) ...

What is the best library for generating visual object graphs in PHP (or JavaScript) (e.g. for depicting a social network)

I have a requirement to graphically depict relationships between a set of objects as well as their types in a PHP application. The relatinships would be previously generated. I am only looking for a tool, preferably free, that will display the nodes and their relations. I am open to PHP or JavaScript or any thing that will work as long...

PHP Strip_tags for div with a specific ID?

Does anybody know if a modified strip_tags function exsists where you can specify the ID of the tags to be stripped, and possbile also specify to remove ALL THE DATA IN THE TAGS. Take for example: <div id="one"> <div id="two"> bla bla bla </div> </div> Running: new_strip_tags($data, 'two', true); Must return: <div id="one"...

zend_Form:display validation and error messages

I have a common ‘Contact Form’ in my project which is called in most of pages like index, about us etc. this page accept user inputs and sent an email to admin, then return back to the page, from which it is called Code for contact form is class Form_Contactus extends Zend_Form { public function init() { $this->setMethod('post...

how to get JSON object depending on it's value

Is there a way to get a JSON object out of a JSON object array depending on its value? What I've got: $users = [{"id":1, "name":"Some Name"}, {"id":2, "name":"Another Name"}, {"id":3, "name":"Third Name"}]; And what I want is to pull out the user depending on the id. So I might have an AJAX call that sends in user...

Restricting access to a site using IP address

I would like to know whether there is a way of restricting the users of a site such that they can only access the inner pages of a site if they are within a certain range of IP addresses or a certain network? The current PHP scripts I am getting cant differentiate the real IPs from the Proxies? Thanks ...

PHP : Json decoding question

How do i decode whole feed arround 10k item without memory limit of php? i found a code which break the feed to part: http://pastebin.com/m43c3384f how do modify the code to work with the feed below : GAF_update_projects_vertical_callback({"projects":{"count":2,"items":[{"id":502817,"name":"SEO","url":"http:\/\/www.getafreelancer.com\...

If jquery POST to a PHP file will cookies work?

I use jquery for a login, it has the gmail type ajax login affect so the user never actually see the login page they are posting to, on this login backen script I set a cookie to remember a users email address, I am curious if cookies are able to be set if the browser never actually goes to the page, it just post to it? ...

validating YYYY-MM-DD formatted strings with Zend_Validate_Date in en_US locale

I'm validating user entered date string in YYYY-MM-DD format using Zend_Validate::is($value,'Date'). this call causes this hierarchy: Zend_Validate::is() Zend_Validate_Date->isValid() Zend_Date::isDate() Zend_Locale_Format::getDate() Zend_Locale_Format::_parseDate() and then fials with this exception: Zend_Locale_Exception: Unable t...

Upload file from remote server... (PHP)

I am working with the FaceBook API to upload photos, and the API requires a local file path. As far as I can tell they are handing the request off to CURL like such: upload=@localfilename But my files don't reside locally, so I am trying to figure out if there is a way to make it work with a remote file.... I tried pointing it to a l...