php

PHP - Access a function from another class...

How can I access function b from within function a? This is what I have so far, and I'm getting this error: PHP Fatal error: Call to undefined method a::b() class test { function a($x) { switch($x) { case 'a'://Do something unrelated to class test2 break; case 'b': $this->b(); break; } } } ...

mod_rewrite question about modifying urls

I've finally got the mod_rewrite rule down somewhat, but would like to do a bit more with it and am not sure how. Here's what I currently have: RewriteRule ^rider/(.*)/(.*)*$ /bar/standings/rider.php?lnum=$1&short=$2 Which allows me to do this: http://pca.localhost/rider/214142/sme instead of http://pca.localhost/bar/standings/ride...

php problem,whatwrong?

the image above say what the problem i face to. if the password and confirm password is not the same, the box prompt up to choose my DB user.why??? here my code : else if($_POST['submit']=='Save') { // If the Save form has been submitted $err = array(); if($_POST['confirmset'] != $_POST['setpass']) { $err[]='please make sure...

Cross-module Communication

Hi, Quite simply, it of course makes good sense to group parts of an application into appropriate modules. Commonly, keeping these modules decoupled is not an issue, however it often arrises that data from the a user management module is required by other components. It is substantially less than ideal by normal principles that these ...

Check for cookies with PHP (not JS) to use for splash page redirect

I want to redirect to a splash page for first time visitors to the site using cookies to remember that they came. This is easy, however, for people with cookies disabled, I never want to redirect them to the splash page. The problem I'm running into is that when I set the cookie, PHP won't see it until I reload the page. This means fi...

PHP - CMS Sitemap ... to much queries used / how to improve it?

Check this out, sorry for external link but it looks ugly here (maby iam to stupid to format it correct) ^^ http://codepad.org/GiOgLhNE Join my irc channel if you like to talk to me tinyurl.com/ylsf7ef (webchat) ...

Best practices for an API in PHP : functions, or classes ?

Hi, In my company we have developped some applications. We have to create an API for one application (say application A), so that the others can use it (an its data). The question is : we already have developped PHP classes for the model of Application A, if we want to create an API, should we : - re-use these classes (too much functio...

Best strategy to convert array output to an object?

I'm taking array output from a command-line program and parsing it into a PHP object. Consider this example of a very simple way to do this: $output = explode("\n", shell_exec(myProg)); $obj = new MyObject(); $offset_field1 = 0; $offset_field2 = 1; $obj->Field1 = $output[$offset_field1]; $obj->Field2 = $output[$offset_field2]; This ...

Making a Twitter Bot in PHP?

Hi, I've made a twitter bot using the CURL library for PHP, and a MySQL db. But I would like to expand its functionality by automatically retweeting tweets marked with a certain hashtag. I do not know quite how to do this, so would any of you be willing to point me to a learning resource on how to do this? Or if you really want to, ...

Parent category as a mainmenu and sub category as a submenu in wordpress

Hai, I would like to have a parent category as a mainmenu in horizontal view and child categories as a submenu that corresponds to the mainmenu. For example, Parent categories as Apple, Orange and Mango Sub Category for Apple is apple1, apple2, apple3 Sub Category for Orange is orange1, orange2, orange3 Sub Category for mango is...

jQuery find li with class until

This might be tricky. Php will generate: <li>element</li> <li>element</li> <li class="alt">element</li> <li class="alt">element</li> <li class="alt">element</li> <li>element</li> <li>element</li> <li class="alt">element</li> <li class="alt">element</li> <li class="alt">element</li> <li>element</li> What I need is a way to find the li...

jQuery, getting a value with a single class and multiple links

Here's the issue I'm running into. I have a list of names, if a name is clicked on, I need jQuery to pass the variable to another page. This is what I have, but of course it only pulls the first name. $('.nameLink').live('click', function() { var coachName = $('.coachName').val(); $('#grayBorder').load('/team.php?coachName='+...

OTP or S/KEY - Conversion of Hex string into 6 readable words

As seen in RFC2289 (S/KEY), there is a list of words that must be used when converting the hexadecimal string into a readable format. How would i go about doing so? The RFC mentions: The one-time password is therefore converted to, and accepted as, a sequence of six short (1 to 4 letter) English words. Each word is chosen ...

A little help using Symfony

Can anyone link me to some Symfony resources, they are hard to find. I am having a little trouble understanding how to use it correctly. Like with CodeIgniter to use the security helper you would load it doing this: $this->load->helper('security'); And you would use its functions you would do something like this: $data = $this->input...

Tracking Memory Usage in PHP

I'm trying to track the memory usage of a script that processes URLs. The basic idea is to check that there's a reasonable buffer before adding another URL to a cURL multi handler. I'm using a 'rolling cURL' concept that processes a URLs data as the multi handler is running. This means I can keep N connections active by adding a new URL ...

Passing a value using jQuery and php

I want to pass the value of the file to catch php using jQuery. Is there a way to pass the value of the file to catch.php, so that var_dump($_FILES) will output somthing? ------index.php------------ <p>Name: <input type="text" name="name" id="name" /></p> <p>Picture: <input type="file" name="pic" id="pic" />)</p> <p><a href="#" id="sub...

Adding 2 php input fields together

Hi. I am trying to create a php estimate form for my business. I have 4 input text boxes, being description, qty, unit price and total price. Is there anyway I can show in the total price box the sum of the qty and unit prices? Thanks for your help ...

Problem with accessing a global variable in PHP

Following is code snippet : function something() { $include_file = 'test.php'; if ( file_exists($include_file) ) { require_once ($include_file); // global $flag; // echo 'in main global scope flag='.$flag; test(); } } something(); exit; //in test.php $flag = 4; function test() { global $flag; echo '<br...

Restrict PHP access to root folders?

Im making sort of a service where people can upload PHP files and they get their own directory. Is there a way to prevent any way the PHP can access the root of the server? and just stay in the bounderies of its folder? ...

caculating dates with php

I have a general question on calculating dates with php. What happens if I store a timestamp like this in my database: $db_timestamp = '2010-01-31 00:00:00'; and then run a daily script that checks if a month has passed since the timestamp was saved in the database: if ($db_timestamp == make_unix_timestamp(mktime(0, 0, 0, date("m") ...