php

Wordpress - Plugin. using remove_action for favorite_actions

Learning php, figure as well as following tutorials doing some practical useful stuff is import. So a wordpress plugin.... Trying to remove the favorite actions box that you get in the wordpress admin header. <?php /* Plugin Name: Hide Favorite Actions Plugin URI: http://www.mysite.com Description: Allows you to remove the Screen Optio...

php check form submit from url

How do I ensure that the attacker or spammer do not attempt to sent data from http://localhost computer? I am developing Flex/flash application which would then submit the data to PHP. I know they have the ability to decompile actionscript, would the HTTP_REFERER help? ...

How to make Wordpress function example for html header

How to create a simple Wordpress function in functions.php I want to make a function something like custom_header() and the code in the function is <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; <html xmlns="http://www.w3.org/1999/xhtml" <?php language_attrib...

Why doesn't PHP's MySQL driver cast datatypes?

I've pondered this for a long time, but I've never heard an explanation. I'm guessing that either MySQL's C API is simply not constructed to hand over data in its original type (which sounds like a design flaw), or the original mysql driver (replaced by the mysqli driver) was simply poorly designed and the mysqli driver was trying to be...

Serialize, unserialize, add elements and serialize again

Can anyone please tell why this code doesn't work: $ser = array('one','two','three','four'); $x = serialize($ser); $x = unserialize($x); $x = array_push($x, 'five'); $x = serialize($x); echo $x; I think it doesn't require any further explanation... The result is only: i:5; ...

Select from mysql database json objects

I need to store a json string in database and to select entries depending on the values of json object. Is there any way to do this selection using mysql ? (i am using php, mysql 5.1) ...

create array from mysql query php

Hi. I have a little problem that I don't understand. I have a db that has an owner and type (and more off course). I want to get a list of all the type values that has owner equal to the current user, but I get only two result $sql = "SELECT type FROM cars WHERE owner='".mysql_real_escape_string($_SESSION['username'])."' AND selling='0...

Magento programmatically creating a sales/quote_address object

Hello, I am having an issue with creating and adding sales/quote_address objects to the multishipping checkout process. Currently, whenever I create a new address object, it is just reusing the exact same object over and over; Thus, when I add items to one address, it will add them to all addresses. As a check, I put a for loop after ...

jquery update page when db update

Hi everybody, I've a page that show data inserted in a mysql db; I'd like (if it is possible) that this view page automatically update when a record is added to the db (data are not inserted from the same page or may be inserted from another user). thanks in advance ciao h. ...

PHP update url in variable

$link = http://site.com/view/page.php?id=50&amp;reviews=show How can we add &extra=video after id=50? id is always numeric. url can have many other variables after ?id=50 &extra=video should be added before the first & and after the 50 (value of id) It will be used this way: echo '<a href="' . $link . '">Get video</a>'; Thanks. ...

Mixing PHP and jQuery

Working on the same page as before,but now I'm using it as a playground for messing around with jQuery so I can learn it for my'boss.' Unfortunately, I can't get the javascript in this file to execute, let alone give me a warning. All of the PHP and HTML on the page work perfectly, it's just the script that's the issue. What am I doing w...

How to avoid UNLINK security risks in PHP?

I'm using UNLINK with PHP and AJAX. I know that in this way is very dangerous, because everyone can delete any files. But I need to use AJAX because I can't reload the page when I delete the files. So how should I do to allow to delete the file only for the user who owns it? Please let me know other things too if you think I'm doing h...

Search engine with 'did you mean'

Possible Duplicate: How does the Google Did you mean? Algorithm work? Hi, I have a database table with about 2 million records. I'm using mysql fulltext to searching but users very often enter bad words ex gmes -> should be games so I need a library with PHP wrappers to have feature like in google 'did you mean' What should I...

CCK in input form, but not in node structure

I have a content type (Witl) that the user creates. On the creation form, the user selects an option out of a list of nodes that's generated from a view (VOut). Right now I store that option as a node reference on Witl. I need to restructure things around, so that this node reference isn't stored on Witl itself, instead eventually stor...

Existing alternate PHPDoctor doclets or styles?

We are about to start using PHPDoctor to auto-generate documentation for our PHP codebase at work. (It was the only one we've tried that could handle our very large codebase, and unlike PHPDocumentor, it's still being updated and supports PHP 5.3). We'd like to try using different doclets and/or stylesheets than the default that come wi...

How can I parse a CSV into array with first value as key?

So I have a CSV file that looks like this: 12345, Here is some text 20394, Here is some more text How can I insert this into an array that looks like so $text = "12345" => "Here is some text", "20394" => "Here is some more text"; This is what I currently had to get a single numerical based value on a one tier CSV if ...

In PHP do i need to escape backslashes?

I think this may be a stupid question, but I am quite confused whether I need to escape backslash in PHP. echo 'Application\Models\User'; prints Application\Models\User echo 'Application\\Models\\User'; same output echo 'Application\Model\'User'; gives Application\Model'User So it's a escape character, shouldn't I need to escape it (\...

PHP get variable from function

function first() { foreach($list as $item ) { ${'variable_' . $item->ID} = $item->title; // gives $varible_10 = 'some text'; (10 can be replaced with any number) } $ordinary_variable = 'something'; } How to get values of this function inside an another function? Like: function second() { foreach($list ...

Zend_Form_Element_Image is needed here?

How can I make image preview and image-loader (to replace existing image) into the form via only one Zend element. Zend Framework have any solution? Zend_Form_Element_Image can be helpfull for that, or I need write my self Zend Element? ...

How to take the current key from array? PHP

Hello, I want to take the current key in the array. I know the function current($array) but it take the value. Rules: I cannot use in any loop. Without array_flip(). I need function.. if you can mix the function current($array) it'll be great! Thank you. ...