php

How to find last index of foreach loop in smarty

How to get last index value of foreach loop in smarty,i m new for smarty I have used this code but its not working {foreach from=$cityList key=myId item=i name=foo} {$i.location_name}{if $main_smarty.foreach.foo.last}<hr>{else}-{/if} {/foreach} i want that when their is last city name after this its come horizontal line otherwise i...

Paypal IPN how to get current session

I want to get my previous $_SESSION['cart'] to the Paypal IPN Sample of IPN Code I use. Everything working fine and script got the $_POST data from Paypal. if (strcmp ($res, "VERIFIED") == 0) { $subject = time(); $to = '[email protected]'; foreach ($_POST as $key => $value) { $body .= "\n$key: $value"; ...

Remove a comma between two specific characters

I currently have the string: "Blah, blah, blah,~Part One, Part Two~,blah blah" I need to remove the comma between the ~ character so it reads. "Blah, blah, blah,~Part One Part Two~,blah blah" Can anyone help me out please? Many thanks, ...

USB device on website

Is it possible to use a USB device peripheral that I have created directly on a website. I am not sure how to start, but for example, on websites like connect.garmin.com they allow you to connect your Sat Nav and then transfer the data to the website after you have downloaded a application and restarted your browser. What do I need t...

PHP input filtering : Only English alphabet

What is the best way for check the input, if it contains any character from other languages. (except english ) Thanks in advance ...

weird php behaviour with classes and static methods

I maintain an application that uses a (to me) surprising PHP quirk/bug/feature. Consider this code: <?php class Bar { // called statically public function doStuff() { print_r($this); } } class Foo { public function main() { Bar::doStuff(); } } $foo = new Foo(); $foo->main(); Running on PHP 5.2.x, ...

How do I append an LI to an UL using jQuery forms.js

I have multiple forms on a page and i'm trying to use jQuery form.js to save each comment that is posted and then append the comment to the UL afterwards. The save part of it is working fine. However, I am having trouble getting the comment to update the UL correctly. See code below: //My Form <form method="post" action="includes/an...

Offline Access. Verifying Access Token?

I have offline access to post on a users wall, but before I post, is it possible to check if I actually have permission i.e. by verifying the access token or by using another solution? Sometimes I am getting "Error processing Access Token" which makes me think the user has removed the application or denied access to post on their wall. ...

Usinng Amazon API to mark orders as shipped?

I'm trying to use the Amazon Merchant API (I think that's the name of it, I can't find docs anywhere...) to mark orders as shipped. We process orders in an internal system, and I need a way to find the corresponding amazon order, and confirm shipment -- basically the same thing you do manually from the orders tab of your seller account. ...

mysql select query problem

Task 1 First i have a specific user, I want to see with which user it is connected to. lets say alex in following table. I want to check if alex is connected to another user? In following table it is connected with John and christina, so i select john and christina. Task 2 Now I have another user. Lets say martin, I want to see which ...

PHP: Require path does not work for cron job?

I have a cron job that needs to include this file: require '../includes/common.php'; however, when it is run via the cron job (and not my local testing), the relative path does not work. the cron job runs the following file (on the live server): /home/username123/public_html/cron/mycronjob.php and here's the error: Fatal error: re...

How to get latest ID number in a table?

How can I get the latest ID in a table? ...

PHP Object has values but when I try to use it in FOREACH() I am getting NULL value

I am writing a php app that interfaces with a companies SOAP API. I am making a call against one of the APIs functions and receiving an object back. However when I try to use a foreach on one of the objects variables I am receiving the error: Warning: Invalid argument supplied for foreach() in ... My code: // Make Call and get res...

`No such file` error after uploading large files with php

There is a service for uploading large files (more than 500MB) with php/apache. The progress of upload is tracked by the uploadprogress pecl extension. This scheme works fine only for small file uploads. However, there is a problem when uploading large files. Once the upload is finished, there is a standard information in the $_FILES ar...

Displaying another controller's view inside a view

I'm using cakephp and I want the login view for the controller 'users' to be displayed on the default.ctp for the layout controller. I can I do this? For example: <div id="leftNav"> <div id="login-block" class="block"> <?php //render users/login here ?> <ul> <li><a href="/users/login...

How can you get mod_rewrite compatible redirects to work with IIS/PHP?

I'd like to be able to get some websites currently hosted in linux moved across to Windows-based hosting where we already have a reasonable number of sites hosted (not looking to switch to Apache since majority of sites are relying upon IIS), and have tried a few different mod_rewrite variants for IIS but not had any success getting any ...

What options could affect php SOAP/WSDL output

I am getting two different responses from different Magento installations. They considered to be the same and both should work but second response can’t be parsed by my Axis Java client app. And I don’t know if certain newer version of Axis can parse both. Both installations use the same Magento version 1.3.2.4. Second installation is r...

Looping over a valid JSON and save each value in variable

I'm using jQuery. This is my second post to make my old question more clear. I have made an Ajax request using the jQuery $.ajax function to a PHP script and that PHP script returned this JSON object and when i tested with link text it says it's valid. and i'm treating this JSON response with the success fonction The php script is $...

Linking an image to a PHP file

Here's a bit of history first: Recently finished an application that allows me to upload images and store them in a directory, it also stores the information of that file in a database. Database stores the location, name and gives it an ID (auto_increment). Okay, so what I'm doing now is allowing people to insert images into posts. Thro...

how to send email from web app with mail() in php on CentOS (sendmail, postfix, ...?)

We are building a web app and will need to send emails on a frequent basis using php's mail() function. We are using it to send mails when e.g. a user signs up for the app, when a client has a new product order, and so on. What do we install best on our CentOS server to make this happen? I've read a lot about sendmail vs. postfix vs. ot...