php

Run mediawiki userOptions script without SSH

Hey, I'm trying to run the userOptions script for MediaWiki to add a new namespace to the default search namespaces for all existing users. Unfortunately, I don't have shell access to my hosting provider, and to be honest I'm really not at home with using cron jobs. What's the easiest way for me to run this script on my MediaWiki insta...

Difference between access class methods

Up until the yesterday I though that both of these methods for accessing a class where identical. Google turned up noting (either that or my keywords were bad). What is the difference between accessing a class by defining a new instance of the class rather than just calling the class methods directly. I hardly understood what I just as...

Override public method in subclass in a way that restricts public access while still allowing access from parent class?

I have a generic Collection class, with a variety of public getter methods. To get one item from the Collection, you call get(). There are also several methods that return multiple items: getMany(), getRange(), getAll(), find(), findAll(), query(), queryAny(), etc. Internally, all of these methods that return multiple items have a loo...

Running an AJAX code on the submit of a form

Here's my form: <form action="/scripts/addemail_fb.php" method="post"> <input type="text" name="email" value="Enter your email here!" /> <input id="submit" type="submit" name="submit" value="Go!" /> </form> And my jQuery: $(document).ready(function() { $('form').submit(function() { email = $('input[name=email...

rss Xml namespace confusion

<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" xmlns:jskit="http://purl.org/dc/elements/1.1/" > <channel> <title>www.domain.com/page_735.htm comments</title> <link>http://www.domain.com/page_735.html&lt;/link&gt; ...

How to take out .gif, .jpg or .png

I use Windows and I display a file extention. When I upload an image file with PHP, a image name of image1_big.jpg becomes image1_big.jpg.jpg. And image2.gif becomes image2.gif.gif. I don't want to turn off file extension. How can I avoid this problem? function addProduct(){ $data = array( 'name' => db_clean($_POST['na...

Can anybody explain me this error..

I am firing a update query. Its working for one page and not working on other one. Can anybody take a look. thanks <br /> <b>Fatal error</b>: Uncaught exception 'Doctrine_Connection_Mysql_Exception' with message 'SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens' in C:\xa...

PHP/passthru/mysqldump seems to timeout

I've got a PHP script that I call to run MySQL database backups to .sql files, TAR/GZip them and e-mail them to me. One of the database is hosted by a different provider than the one providing the web server. Everything is hosted on Linux/Unix. When I run this command: $results = exec("mysqldump -h $dbhost -u $dbuser -p$dbpass $dbname...

How to encrypt mysql passwrod in php (or how to defeat automated code scanner red flag)

Management strikes again. How should I satisfy the code scanner that is going to read my php source and red flag my MySQL connection string? Linux Server (soon to be Sun) php 4.2 (soon to be latest version) MySQL database Servers in a DMZ outside of the firewall Read only MySQL account Not a single byte of non public information in t...

Fast autocomplete for drop-downs

Hi, I am using JQuery's autocomplete plugin, but it is not fast and also it's not that relevant to my site. I want an autocomplete like the www.hotels.com. How can I achieve this type of autocomplete? Are there plugins for it? ...

Solution to HEAD request problems

I have been working on a script to post customer data to a dialing server. I posted a similar problem about this a while ago but was finally able to get some responses. However, I am facing another issue. When I test the script from my localhost server, the data is being sent successfully and I get a 200 OK http response. From my loca...

facebook iframe php api

i am starting on a php based facebook app. the documentation at facebooks developer page is quite confusing. i have chosen the iframe method for rendering the canvas page. i have made my app in php and is hosted on my server. now the app loads fine in apps.facebook.com canvas. but the thing is I am unable to make API calls work. what i...

jQuery Parser Error Long JSON text

fixed; I'm using a simple jQuery to download text off a server, datatype json. $.get('http://169.254.100.5/ajax.php',{action:'p',i:'{$data['id']}'},function(data) { $.each(data.responses, function(i,response) { alert(response.longtext) } } When response.longtext is short (less than 1000 chars like "hello world")...

display the name of user

this might be the simplest of questions. $appapikey = '...'; $appsecret = '...'; $facebook = new Facebook($appapikey, $appsecret); $user_id = $facebook->require_login(); i have the user authenticated and everything. now i want to say hello to the user. like: echo 'Hello, $user_id'; how to write that code. because what $user_id co...

Is there a more efficient way of coding this?

The code in question is the code contained within the 2nd foreach loop, the purpose of which is to prevent exact duplicate latitude and longitudes. foreach($aUsers as $k => $v) { // generate address $aAddress = array(); if(!empty($v['city_location'])) $aAddress[] = $v['city_loc...

Printing $node vars in page.tpl.php

In Drupal's page.tpl.php <?php foreach($node->og_groups as $test) {dpm($test);} ?> Gives me But when I do <?php foreach($node->og_groups as $test) {print($test);} ?> The value doesn't show up. this is kinda frustating.. Any help is appreciated. Cheers! ...

unsetting php reference

So I have this function, and it returns me a reference to a particular point to the array passed in. I want to make a call to unset that will then remove the result from the array/reference, but calling unset only removes the reference, not the data from the original array. Any thoughts? ...

Migrate from ereg_replace to preg_replace

Just migrating from PHP 5.2 to 5.3, lot of hard work! Is the following ok, or would you do something differently? $cleanstring = ereg_replace("[^A-Za-z0-9]^[,]^[.]^[_]^[:]", "", $critvalue); to $cleanstring = preg_replace("[^A-Za-z0-9]^[,]^[.]^[_]^[:]", "", $critvalue); Thanks all ...

Using preg_split on alpha-numeric string in PHP

Consider the string 12345aaa. I want to use preg_split() on it so only the numeric part of it will be returned (i.e. 12345). How would I write the regex for it ? Thank you in advance ! ...

importance of link identifier in mysql_real_escape_string()

Why is it necessary to have a link identifier as an input when using mysql_real_escape_string(). I know that the function should be used with MySQL queries, but the function is really just a string manipulation. ...