php

Drupal 6 - Refresh tokens through ajax

I'm experimenting with asynchronous loading objects to speed up drupal. For this, I'm using the authcache module, together with ajaxify regions. So far, I've come a long way by adding regions on the node page, and load blocks to the region with ajaxify regions. This has got me almost all the way with great speed and only a little lag for...

Curl in PHP having problems with redirects

Well, here's the code: <? // Getting the comic page if (!empty($_GET['c'])) $id = $_GET['c']; else $id = "new"; $url = "http://www.explosm.net/comics/$id/"; $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_FAILONERROR, 1); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($curl, CURLOPT...

Declaring protected variables in methods

I've had a good look round and can't seem to find an answer to this problem. Basically I'm using the _call method to dynmically generate get and set methods, however when declaring a variable PHP's default is public. Is there anyway to declare a variable from within a class as protected? function __call($method, $arguments) { $pref...

How should I skim money off a transaction between 2 people on my site?

This is sort of not relevant to programming but I think it also is: MY site is being built around people selling products through the site and customers buying the product through it. I'll then shave a % off the top of the sale. As far as skimming a % of the sale off the top, what is the order of events that should take place to do tha...

"LIKE" in mysql

I have written a simple mysql search form that searches between two dates. This query working perfect: $sql = "SELECT * FROM table WHERE dateStarted like '%$checkin%' AND dateEnded like '%$checkout%'"; But with $sql2 = "SELECT * FROM table WHERE dateStarted = $checkin AND dateEnded = $checkout"; There is no any result? What is...

What should I install in order to use Zend Framework?

Hello all, Based on the http://framework.zend.com/download/latest Zend Framework + Zend Server Community Edition(CE) Zend Framework Full Package Zend Framework 1.10.7 Full Should I install Zend Server Commuity Edition or just install package? Thank you ...

Trouble posting with cURL

I'm trying to make cURL post to this page the data txt_code=1605120090100999. Can anyone show me the PHP code that posts that value to that page and gives me the result as output? I tried this: $url = 'http://195.246.54.62/support/mis_support.aspx'; $txt_code = '1605120090100999'; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url)...

accessing xml attributes in xsl

i've this xml code: <title xml:lang="ar">أربيك</title> <title xml:lang="en">English</title> which i'm formatting in xsl: <div class="title"> <xsl:value-of select="root/title"/> </div> however, this^ only displays the arabic title, and not the english one. i tried this code: <div class="title"> <xsl:attribute name="...

Problem Inserting Multiple Arrays into Database

Hello everyone, I was inserting multiple arrays into my database using this code: $queries_cols = array(); for($i=0; $i<count($cols); $i++) { $queries_cols [] = "('".$cols[$i]."','".$int_manha1_1[$i]."','".$int_manha1_2[$i]."','" .$int_tarde2_1[$i]."','".$int_tarde2_2[$i]."','".$h1_1[$i].$h1_2[$i]."','".$h2_1[$i].$h2_2[$i]."')"...

Extract part of a string in php

Hi, i have this kind of string into my db http://www.mydomain.com/assets/Image/......./image.jpg and would like to clean it up and make it image.jpg how could get the part of the string starting from the right until the first "/" ? ...

MySQL -> PHP -> JS/jQuery

I'm a bit confused about displaying data from a MySQL database. I would like to make a single $.getScript(''); request to grab point values if possible, but my trouble is getting it to work with multiple members. I need to grab the point values for each user by their ID number. (this is for a forum software- ZetaBoards.. basically a poin...

Getting error: Cannot use object of type mysqli_result as array

I'm following a php pagination tutorial that uses MYSQL but I use MYSQLI object oriented all around my site. This is causing some errors.. For this part.. $sql = "SELECT COUNT(*) as num FROM categories"; $total_pages = $connection->query($sql) or die(mysqli_error($connection)); $total_pages = $total_pages['num']; I get *Fatal error:...

CakePHP What is the best way to retrieve database information in a helper?

What is the correct way to retrieve Database information using a custom cakePHP helper? ...

MySQL Alter Table Add Field Before or After a field already presant

I have this, but it doesn't work: $query = "ALTER TABLE `".$table_prefix."posts_to_bookmark` ADD `ping_status` INT( 1 ) NOT NULL BEFORE `onlywire_status`"; I appreciate it! ...

As basic as possible: jQuery Contact Form

I'd like to create a very basic contact form. I've got the HTML, Javascript, and PHP written using what little knowledge I know of the language, but it apparently doesn't work. What's missing? The HTML: <form> <fieldset> <fieldset> <input name="name" value="John Doe" size="30" /><br /> <input nam...

php: number only hash?

In php is there a way to give a unique hash from a string, but that the hash was made up from numbers only? example: return md5(234); // returns 098f6bcd4621d373cade4e832627b4f6 but I need return numhash(234); // returns 00978902923102372190 (20 numbers only) the problem here is that I want the hashing to be short. edit: OK let ...

A CCK field that's a random number

Anyone aware of a CCK module that adds a text field that's just a randomly generated number? This means that when the user tries to create a fresh node, he sees a pre-populated random number as one of the fields (and can't change that field) ...

PHP/ImageMagic Get the "shadow" of an image

Hi, I would like to script PHP/ImageMagic in order to produce the "shadow" of a given image. Like in this example (done manually in GFXeditor) : original shadow ==> Note: All the originals images will be on a white background like in the example. I've check the ImageMagic documentation but I haven't found anyt...

Variables from function are undefined

I'm placing an entire pagination script into a function so I can use it more times. The code is long but there's just one part I'm having trouble with. After I call the function paginate($connection, "categories"); I use $sql = "SELECT * FROM categories ORDER BY cat_name LIMIT $start, $limit"; etc.. and I get these errors. Not...

Wordpress functions in wordpress functions and escape characters...

I have been trying use the edit_post_link() function to contain an image. All of the quotations and parameters are driving me crazy... How can I get this to work? This outputs Edit inside the anchor link for editing the post. <?php edit_post_link(__("**Edit**"), ''); ?> This outputs the image I want to use. <?php echo "<img src=\"" ...