php

How can I send users to PayPal after some processing on the server. {PHP}

I am setting up a paid subscription service and want to keep the signup form to one page. I use PayPal as my payment processor and the standard way of dealing with paypal is to create "Buttons" that POST to PayPal. However, I need to process the form data before I send the user to paypal. Once I have processed the data, how would I redi...

[Wordpress] Getting widget instance settings

Does anyone know if it's possible to access a widget instance settings from a different function than widget(), update() or form() ? For example, in the widget below I want to get the $args and $instance variables from within my_custom_function(). class test extends WP_Widget{ ... function test(){ ... } function my_custom_...

JSON format in PHP

{"required_items":[ { "filename":"abcd", "no":"3" }, { "filename":"abc", "no":"2" } ]} I am not getting the code of the JSON format in PHP - I want to insert the f...

WordPress 3.0 media uploader alters my image filename

I've run into a problem with WordPress 3.0 I preface my image files with an underscore character (_somefile.jpg) to allow me to flag them for specific uses vs images that don't have the underscore. However, I've just found that the media uploader in WP 3.0 strips these underscores from the file name. At first I thought it was just rena...

could not display image

When i'm trying to display the image from the database the image is not been displayed didn't know what was the problem,here is my code. show_desc.php <?php $errmsg = ""; if (! @mysql_connect("localhost","root","")) { $errmsg = "Cannot connect to database"; } @mysql_select_db("dbname"); if (isset($_GET['img_name'])) {...

How to put the logged in users username in the URL?

Hello all, I am making use of Codeigniter and I currently have this URL format setup: http://example.com/view/ I would like to put in the logged in users username in the URL and remove the view part of the URL. The view is my controller. So I can have something that looks like this in the address bar: http://example.com/johnny How...

How do I sort a multidimensional array depending on it's items array keys and values?

Hi there. I have an array of permissions: array( array( "controller" => "somewhere", "action" => "", "namespace" => "admin", "method" => "GET" ), array( "controller" => "somewhere", "action" => "index", "namespace" => "admin", "method" => "" ), array( "controller" => "somewhere", "action" => "index", "namespace" => "admin"...

[PHP] Filter an array

I have an array like this: $categories_array = array( [0] => 'category_1', [1] => 'category_2', [2] => 'category_3', [3] => 'category_4' ) I'd like to "filter" the array to get a new one. For example, I'd like to have a new array with only 'category_2' and 'category_3' like this: $new_categories_array = array( [1] => 'category_2', [2...

What are the disadvantages of using a PHP database class as singleton?

What are the disadvantages of using a PHP database class as singleton? ...

Simple Text Lossless Compression PHP/JavaScript

Is there a way for me to lossless compress text with the following characters(88 in total)? abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ123456789!@#$%&*()-_+=;:'"<,>.?/[]{} I am making a chat but I don't want it to be wasting so much bandwidth(an old chat I used a few hours wasted 800mb). The text would be compressed in java...

Query doesn't work

I get the following error message when I try this query: $query .= "($tid, {$_POST['type']['$i']}, 'Y', NOW())"; 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 (18, , 'Y', NOW())' at line 1 Everything in my code works except this line. I know ...

PHP unexpected elseif

I'm filtering some content on my website via country specific code, I'm trying to add else statements so it doesn't have to run each piece as individual code except whatever I try gives an error: <?php if (function_exists('isCountryInFilter')) { ?> <?php if(isCountryInFilter(array("us", "ca"))) { ?> <a rel="nofollow" class='preloading g...

Install Wizard, expansion from mysqli ?

Hi guys I created an install wizard but its quite basic and only runs mysqli. How do you think I could best expand this? (non-mysql), what other features are required? I plan to use it for any of my clients who wish for me to create them an app but not give away any server details. Ok so the file structure looks a little like this con...

Detect Ajax calling URL

I have an HTML document, which loads content from a PHP file using an AJAX call. The important bit of my code is below: default.html : /*more code above*/ var PHP_URL = "content.php"; var Content = document.getElementById('Content'); ajaxRequest = new XMLHttpRequest(); ajaxRequest.onreadystatechange = function() { if(ajaxRe...

How to allow users to accept or deny friends using PHP & MySQL?

I was wondering how would I allow a member to accept or deny another member as a friend? How would my PHP & MySQL code look like? Here is my PHP & MySQL code. if (isset($_GET['fid'])){ $friend_id = mysqli_real_escape_string($mysqli, htmlentities(strip_tags($_GET['fid']))); if(isset($site_id)){ $dbc = mysqli_query($mysq...

PHP class methods cascading

Hello Geeks I have seen many php scripts in which you can cascade class method to produce a specific functionality for example as in codeigniter when you load a view you would type <?php class Posts extends Controller { function index() { $this->load->view("BlaBla"); } } ?> I am not completely sure ...

Black theme for dreamweaver

Hi, Does anyone a black theme addon for dreamweaver something like this: Thanks ...

Algorithm for sorting images by relevance

I'm developing a feature on a forum site that will allow to include a link and other type of content on a post (for clarifying the question or answer). Related to the link feature implementation, I have several things to work on: Validate the URI entered (well formed, valid scheme, etc.) Validate that the remote resource exists Extrac...

Magento : Variable well displayed in javascript. How call it in php in the same file ?

I've built one variable (horaires_lundi) in this file : app/code/community/Unirgy/StoreLocator/controllers/Adminhtml/Locationcontroller.php ->setTitle($this->getRequest()->getParam('title')) ->setNotes($this->getRequest()->getParam('notes')) ->setStreetAddress($this->getRequest()->getParam('street_address')) ->setHorairesLundi($thi...

Using PHP to retrieve information from a different site

Hi everyone, I was wondering if there's a way to use PHP (or any other server-side or even client-side [if possible] language) to obtain certain pieces of information from a different website (NOT a local file like the include 'nav.php'. What I mean is that...Say I have a blog at www.blog.com and I have another website at www.mysite.co...