php

How to access my member variables by $instance['name'] in PHP?

$instance = new className(); $instance['name'] How to make it work,an example? ...

How to block uploads of nude images?

I need a provision of detecting the adult image in the websites where the user uploads the pictures to determine that a picture isn’t acceptable for my site. Can any one suggest the method to do this? I need kind of open source code/program (PHP) that could be implemented in the website and stops the user to upload the picture. Earlier ...

Can I trigger a javascript function that is part of an external website?

Hi, My first post so apologies in advance for being a noob! I want to write a script which will click a button on an external website (one which belongs to someone else). The button is defined as follows: <input class="btnAdd" type="image" src="/superstore/i/b/btnAdd.gif" id="i61109534-a" onclick="return a(61109534);"> Basical...

Is any solution the correct solution?

I always think to myself after solving a programming challenge that I have been tied up with for some time, "It works, thats good enough". I don't think this is really the correct mindset, in my opinion and I think I should always be trying to code with the greatest performance. Anyway, with this said, I just tried a ProjectEuler ques...

PHP: How can I access / use a method within its own class?

Hello, I am trying to figure out how to use a method within its own class. example: class demoClass { function demoFunction1() { //function code here } function demoFunction2() { //call previously declared method demoFunction1(); } } The only way that I have found to be working is whe...

Simple $_GET question

Hey, i am currently creating a pagination script using php and jquery and for some reason can't display the $_GET that im trying to grab. There is no form, but looking at the firebug console I get a url like this: pagination.php?id=category Just wondering how I can get that 'category' and just echo it out. ...

(Zend Framework 1.10) How to use custom DB adapter?

Hello, How could I set up custom DB adapter (I will use simple DBSimple) and then use it inside of my model? I don't want to extend my model with Zend_Db_Table, it seems pretty useless for me at the moment. Sorry for question, but I'm real noob in ZF. Thank you ...

Error logging php - error_reporting(0) not having desired effect

I've got a pretty simple page which fetches a url and parse some data. I have built into my page some error handling in the event that the response is a 404 error. However, I can't seem to stop php from spitting out the following errors Warning: file_get_contents(http://url-to-retrieve.com/123.html) [function.file-get-contents]: f...

php image not showing

i have following php code which display company logo <?php $key=$_GET['key']; /// key process /// //////////////////// ?> <img src=images/logo.jpg" /> when i run this php file this show logo.jpg but when i call this from <img src="../temp.php?key=123" width="438" height="100" /> it didn't show...

PHP - get everything after the #?

I've got a flash file (that I can't edit) that is making erroneous requests to a file ending in a #. So the link where the file is being accessed is /files/flash/, so the requests are being made for /files/flash/# Is there any way for me to detect the # in the link so that I can have those pages not load? ...

Connecting PHP to Microsoft SQL Server 2008

Hi people, I used xampp for php and mysql. But i need to work with php and sql server 2008. can any body help me providing any link or tutorial that describes the configuration for php and sql server? Is there any software like xampp(php-mysql) that provides built in php-sqlserver? ...

Using Timthumb to Resize Images from CKEditor

I am using CKEditor to do basic text and image input into my website. I have noticed that it is quite sporadic in it's method of generating HTML for images when you add them. (Sometimes it might use height and width tags, other times it might use CSS). I use Timthumb for on the fly image resizing on a number of other websites and find i...

Jumi (Joomla plugin) breaking PHP global keyword

When I include a PHP script via Jumi, it seems to break the global keyword. Example: <?php $a = 5; function foo() { global $a; if (isset($a)) echo $a; else echo '$a is not set'; } foo(); ?> When I run this PHP script (named test.php) by itself, it correctly prints 5. When I...

PHP, SimpleXML, how to access <tag> by its id attribue and now array position ?

Hi, I would like to understand how to access a by its id and not trough array position, example, I dont want to do this, $myXML->someNameHere[1]->home[0] I want to go access someNameHere by its ID "hi" Thanks a lot for your atention, ;D ...

How to do instantiation and call a method in a mouthful in PHP?

I tried these two ways: (new NewsForm())->getWidgetSchema(); {new NewsForm()}->getWidgetSchema(); With no luck... ...

Code audit for outdated php file

I've finally found a rogue .php file that runs on a daily basis that essentially acts as a spell check for our product database. Most of it is no longer needed for various reasons (was created 10 years ago) so I'm trimming it. However, I don't know much PHP (I'm mostly HTML) and this one line is bugging me: $name = ucwords(strtolower($n...

What could cause headers to already be sent, and how would I track it down?

First off, I'm by no means new to PHP, or sending headers. However, I'm getting the following error: Warning: Cannot modify header information - headers already sent in /var/www/oraviewer/download/scripts/start.inc on line 30 Warning: Cannot modify header information - headers already sent by (output started at /var/www/oraviewer/down...

Modulus PHP Problem

I have a problem, I am trying to calculate what the lowest prime is of a number but I do not understand the result that PHP is giving me. If I have this number $number = 600851475143; Then I modulus it: $primes = array( 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97); foreach($p...

Array call from key not working correctly

I'm trying to call to a specific part of an array with the key # and it's not working. I can output the array and see it... Array ( [6] => Array ( [0] => [email protected] [1] => [email protected] ) [7] => Array ( [0] => [email protected] [1] => [email protected] ...

PHP: How to Remove Space Additionally to the Special Chars?

Hello, in my functions.php if have this code: echo '<a href="' . preg_replace('/\s/', '-', $search) . '-keyword1.html">' . urldecode ($search) . '</a>'; this removes the special chars.. but how can i additonally add remove space and replace it with - and remove " so, if someone types in "yo! here" i want yo-here thank you! ...