php

How to add url shortener API to wordpress posts links?

I was wondering if it was possible to add a api to wordpress to make all the links in a post a shortened url (in this case for linkbee - http://linkbee.com/api%5Fdoc.php) if so how would i do this? ...

Getting json data from jQuery AJAX Call on php page

I would like to send data using jQuery ajax API var myData = {"param1" : $('#txtParam1').val(), "param2" : $('#txtParam2').val()}; $.ajax({ url: 'DataService.php?action=SomeAction', type: 'POST', data: myData, dataType: 'json', contentType: "application/json; charset=utf-8", success: ...

How Can a Plugin Hijack a URL in WordPress?

Of course I can always edit WordPress' .htaccess file, but that would kind of make my WP plugin a little non-standard. Instead, what is the way to hijack a URL via a custom plugin in WordPress? For instance, let's say I want to build an elaborate product catalog that could be installed in WordPress as a plugin. Once activated, you could...

PHP: Returning a user to their original page after login

Are there any 'best practices' concerning how one should return a user to their original page after logging in to your website, specifically in PHP? e.g. if I'm viewing a StackOverflow question while not logged in, how would you ensure that I return to this question if I logged in? From my research, it seems a lot of advice centers arou...

Illustrator opening as PDF

I am coding a file sharing application for my office. One strange problem I am going through is the Illustrator files being opened in PDF when you hit the download button. This problem is triggered because the mime type of illustrator files is application/pdf. So the browser when it reads the file, triggers Acrobat to open the file. Is ...

PCRE to filter files on extension

Hi, I need a PCRE(Perl Compatible Regular Expression) that will match all non-images(jpg,png,tiff) from a list of files. So I need something go in place of XXX # Perl while(<>){ chomp; if(/XXX/){ // non-image } } // PHP foreach($files as $file){ if(preg_match('/XXX/',$file){ // non-image } } I know it can be done using negation ...

Unknown date shown for mails received from Mantis in Webmail

Hello, Im using Mantis bug tracker v1.1.8, and the Horde Webmail System for my company emails. When emails sent by Mantis arrive in my company inbox, i get Unknown Date in the Date field of the inbox view. When i open the message, i see the Date like Thu, 31 Dec 2009 14:32:15 +0580. The other mails, whose date i can see in the Inbox vie...

Database not selected sometimes

I have a strange problem. 5% of its time; i get the error "No Database selected". Only on a page where i use iframes; called from out tab script. Here is the "sometimes problem" page: http://www.thediscopalace.com/programtest.php Every tab calls for a page and loads it into the iframe. The requested page get its content from the d...

How to write codes for email message in php.

I have the following form. <h1>Please Confirm Your Order</h1> <p class="padnmgn">Please confirm your order before clicking the Email Your Order Now button below. If you have changes, <?php echo anchor("myshop/cart", "go back to your shopping cart");?>.</p><br /> <form method="POST" action="myshop/emailorder" accept-c...

Running PHP under ASP.NET

ASP.NET web server can allows to deploy PHP code, even full applications like phpBB. is it possible? please guide me by googling i found this check this link http://www.communitymx.com/content/article.cfm?cid=F8079 and in the time of running the PersonalWebSite projet getting error Index was out of range. Must be non-negative and ...

Mysql return specific row numbers

I want to query a database and return specific row numbers eg 1, 10 and 25. Is this possible or will I need to do 3 queries (or 1 query and loop through the rows then only output the ones I need) using php. ...

create instance of two classes together

Hello! Im trying to display two list: one for categories and brand but only the categories are being displayed. And when I remove the code for categories, the brands are being displayed. Is it because it is not possible to create instances of two classes in the same php page? In index.php: <?php $obj = new CategoryList(); if (metho...

Why does not $grandtotal show correctly?

Let's say $_SESSION['totalprice'] is 1200. However echo $totalprice; outputs 1200 and echo $grandtotal; outputs 66. Grandtotal should be 1265. What am I doing wrong here? $totalprice = $_SESSION['totalprice']; $shipping= 65; if (count($_SESSION['cart'])){ $count = 1; foreach ($_SESSION['cart'] as $PID => $row){ echo "<p class='...

How to determine a web visitor's country of origin?

How to determine a web visitor's country of origin? ...

JScrollPane doesn't come up on first page load

I'm using a JScrollPane on a login page, basically after successfull login, it'll go to the second page where I should see the ScrollBar but the scrollbar dosn't show on first load, I have to refresh the page one more time, does anyone know why this happens? Has anyone used JScrollPane before? Thanks for your help. $(function() { ...

After subclassing, how can I override the parent's constructor while still using it?

Example: I have a class called ParentClass. ParentClass has a constructor like this: function __construct($tpl) { // do something with the $tpl } When creating a new instance of ParentClass, I must provide that $tpl parameter like this: $p = new ParentClass('index'); Then there's a ChildClass extends ParentClass. I want that th...

How to change 1,300.00 to 1300,00

In my PHP outputs, number shows 1,234.56 How can I change this to 1234,56 or 1.234,56? What is the American way and European way? Does php work with American way? ...

How can I avoid mysql query every page load on RPG game? Any ideas?

Hi, I've been doing RPG game recently and every page load I have to use mysql_query (and this query quite big, takes a few tables with inner join) to take information about player. How can I avoid this query sometimes? Of course I can use cache and make query for example every 30 secs, but it won't renew new information instantly. So, an...

When I make a Multiselect Form Input Field, should I create a View Controller for this, or is a View just fine?

I'm struggling since a few hours with this design question. In Cocoa for example, a complicated Date Picker is just a View. But it HAS a lot of complicated logic and algorithms to enable picking dates. In this case, I want to create a form element component for multi-selection of objects (i.e. when defining a relationship Users 1:n Pho...

One long class or many shorter classes?

In PHP, is there any performance impact on using one long class with a lot of functions in it? Or is it advisable to use many small classes and call them separately when needed? I am a newbie in OOPS and please ignore any silliness in the question. Thanks. ...