php

php 5.3, regex to get specific data from a string based on preceding text and <br>

hi, I have the following string example: PASSWORD = dsl3£$Roid dfdfdf fgdgfdfg fgdfgdfg dfgdfg dfgdfgdfg its stored in MySql Text field. I need to get the "password" ie dsl3£$Roid Its preceded by PASSWORD = and there is a \n line break after. I can use nl2br to make the string like this: PASSWORD = dsl3£$Roid<br> dfdfdf<br> fgdgfd...

Magento Call to a member function getGrandTotal() on a non-object

Hello, i have a mutisotre setup magento and each store has its own domain . since i upgrade to magento 1.4 i am getting error in my cart page ,suppose if you add a item to cart and try to check out ,you will see unit price and subtotal is not pulling up and i am gettign following error . i dont have any idea why is this hapning .Any hel...

cURL command to NSURLRequest

I want to convert cURL command: curl -F 'access=xxxx' \ -F 'message=Hello.' \ -F '[email protected]' \ https://example.com to a NSURLRequest. Can somebody please help me with this? ...

Organizing Div's, css box model

So I'm putting a few boxes in my footer and right off the bat when I use margins to move them around they are moving the whole footer around as well. Anyone know what I am doing wrong? The site: http://cowgirlsbaking.com/ ---php--- <?php wp_footer() ?> <div id="pinkpoint"> </div> <div id="footnav"> <div id="footernavlinks> </div> ...

How can I join 3 tables with mysql & php?

check out the page [url]http://www.mujak.com/test/test3.php[/url] It pulls the users Post,username,xbc/xlk tags etc which is perfect... BUT since I am pulling information from a MyBB bulletin board system, its quite different. When replying, people are are allowed to change the "Thread Subject" by simplying replying and changing it. I ...

How to quickly zip large files in PHP

Hi, I wrote a PHP script to dynamically pack files selected by the client into zip file and force a download. It works well except that when the number of files is huge (like over 50000), it takes a very long time for the download dialog box to appear on the client side. I thought about improving this using cache (these files are not c...

.htaccess file: Dynamic redirect

Hi! I've had a hard timing learning rewrite rules in .htaccess files, so I was hoping someone could show me how to rewrite this: test.com/home/feed/toak/nyheter/vg into this: test.com/index.php?r=home&f=feed;toak;nyheter;vg This is a dynamic URL, and can have multiple elements seperated by ; in the end. I want my users to be able to...

What WAMP server is the best?

What WAMP server is the best? ...

Getting all possible combinations of N items in X Groups.

I have a list of Groups that can vary in number, with Items in these groups that also vary in number. I've been racking my head over a way to get all possible combinations of 1 Item from every Group. Bonus: I also need all combinations of not having every items from a group. I've seen and done what was mentioned before, but that requ...

Drupal 6: sorting specific date chronologically...

Hi friends, I'm a drupal newbie... I have created a block with View Module to list events (title, event date) at homepage. dates are being entered into textbox and such format as below; December 5-7, 2010 December 4-6, 2011 July 17-19, 2011 ... When I set Sort Criteria as date, it just mess :/ it doesn't sort chron...

What is the PHP syntax for launching an ssh connection in the background?

I need to launch an ssh shell to a remote server for remote port forwarding in the background from a PHP script using the exec() function. The command when run in the background is $execStr, so I use exec($execStr ." > /dev/null &"); $execStr works fine manually, but not in the script. What is the correct syntax? Here is the rogue pro...

PHP Url Regex filtering

Hello guys, Example url: http://p.static.com/i/logo.jpg I want to be able to extract the urls from my own CDN that are referenced in a string, extract the src url and from the src file and folders, so /i/logo.jpg, and then replace this with a hashed version, so any hashing function I may use like encode('/i/logo.jpg'). I'd like an ar...

All object properties are being saved, is it possible to only persist the fields that I've mapped?

I'm using Doctrine 2 ODM (with MongoDB). My Document model: class Users_Model_User { public $id; public $username; public $password; public $myRuntimeProperty = 'some value'; } My Document mapping in YAML: Users_Model_User: db: my_db collection: users fields: id: fieldName: id id: true usernam...

How can I output a row with id lets say 31.

<?php $link = mysql_connect('localhost', 'username', 'password'); if (!$link) { die('Could not connect: ' . mysql_error()); } echo 'Connected successfully'; if (!mysql_select_db('database')) die("Can't select database"); // choose id 31 from table users echo $id; //31 echo $name; //id31's name echo $surname //id31's surname e...

Online Software Tracking Software

I am looking for a good development tool that will help me track revisions of software I am creating, and that is web based. Just looking for suggestions on what others use. And not one that is hosted through another solution but that I can host myself. ...

How to get this regular expression to match </span>

This is the sort of HTML string I will be performing matches on: <span class="q1">+12 Spell Power and +10 Hit Rating</span> I want to get +12 Spell Power and +10 Hit Rating out of the above HTML. This is the code I wrote: preg_match('/<span class="q1">(.*)<\/span>/', $gem, $match); But due to <\/span> it's escaping the / in </span>...

How to display date and price in a MySQL database and display it in various formats in PHP

I am a php/mysql novice so I have been inserting dates in whatever format I usually display dates on my pages, like: Saturday, June 19, 2010 directly into the database in plain text. But I have seen people enter it in some other way and then display that same record in various formats using some php function. What is the way to do thi...

How can I verify a Googlebot

I'm going to block all bots except the big search engines. One of my blocking methods will be to check for "language": Accept-Language: If it has no Accept-Language the bot's IP address will be blocked until 2037. Googlebot does not have Accept-Language, I want to verify it with DNS lookup <?php gethostbyaddr($_SERVER['REMOTE_ADDR']); ?...

Right to left language support in php

I am developing a site where people will put their comments, in arabic. my website is built in php. does any body know a way how to add right-to- left language support to write text in english? ...

PHP Accessor functions and arrays

Using a __set accessor function in PHP I can set the value of a scalar, but not an element of an array. Ie: $p->scalavar = "Hello"; // This works fine $p->myarray['title'] = "Hello"; //This does not work My accessor is as follows: function __set($mbr_name, $mbr_value) { $this->$mbr_name = $mbr_value; } Thanks! ...