php

How do I get Drupal's book module to jump to the first chapter when clicking the book?

I have a page listing all of the books, e.g. book 1 [description] book 2 [description] book 3 [description] If you click on book 1, you're taken to a page with the exact same description you just saw, with a table of contents. I would rather the clicking on book 1 took you to the first page. I'm playing around in the book modul...

PHP -> XML output is different on IE.

Hi, I have been trying to output XML with php but encountered a strange(!) error in Internet Explorer. The expected xml output is this:(simplified) <root> <match_id>12</match_id> <stadium_id>43</stadium_id> <tribune_id>2</tribune_id> <fan_id>453</fan_id> </root> I am producing this output with the following php code: echo "<?xml v...

What's a good & complete PHP/MySQL Screen Scraper project?

Requirements Written in PHP Control over the code (open source would be awesome, purchasing code is an option too) Optional features Listen to robots.txt Automatic rate limiting Scrape based on rules into a data object Admin interface, or configurable back end, to setup new rules Something like CSS selectors to pick our data in th...

prevent user fom logging back in after logging out by hitting back button

I am using a PHP login script that challenges user for username & password. Once authenticated program stores a session value. On logout, session value is set to blanks. Once logged out I want to avoid allowing user hitting the back button a few times and and betting allowed to see screen of data or accidentaly logging himself back in....

When can you call yourself PHP professional?

What makes you professional PHP programmer? When you know OOP, smarty, framework. I guess that's it, right? If not, then what else? ...

display tooltip on hover over text

How would I go about displaying a tooltip when the user hover overs some text? These text are keywords. I don't want to manually add these tooltip for each keywords. I am looking for a way to create a script of some sort to automatically do this either on the client side or server-side. When a user hovers over these keywords, and if the ...

How to let a user manipulate text (make it bold/italicized), before it is saved in a MySQL table?

Hello, Is there a way one can let a user manipulate text he/she may be typing via PHP? For example, the user may be able to make the text he/she has typed bold or even italicized. One can assume, that I am trying to get similar effects of this website. Is there a way to do this in PHP? I am trying to do this because once the user hits ...

CodeIgniter: How to 'highlight' the link of the page the user is currently on?

Fairly new to CodeIgniter, still grasping the MVC approach. I'm just wondering what's the best way to solve this: I got my navigation bar highlighting the currently active link like so: <a href="index.hml" id="active">Index</a> <a href="blog.hml">Blog</a> Now, when I go to blog.html I want id="active" to shift accordingly. Usually I'...

What is your favorite PHP programming trick?

what are your favorite PHP programming trick(s)? I myself like Resession (Session Manager) ...

Write to htaccess file

Hello all. I am having problems with idiots coming on my site and just being abusive. I can ban their account and then put deny from xxx.xxx.xxx.xxx in the htaccess file. Is there anything else i can do to stop them getting back? The main reason for this question is, whats the best way to write the deny from to the htaccess as an optio...

mysql get non existing results

Using php and mysql, I have a table "subdomains" that contains subdomains for my application, depending of a category. subdomains - id, cat_id, subdomain Some categories have subdomain and others don't have. For those that don't have subdomain, I want the subdomain to be 'www'. Now in my subdomains table there are a few values, for exa...

php implode question

So I am doing a search and I am using an implode in my select statement, which I find quite useful. Basically this search engine will have 3 different selects which will select different things based on different criteria and when I use my implode I get an error of invalid arguments passed. Here is my sql statement: $sql = "SELECT DIST...

How to make a Joomla "build"?

In drupal, it's possible to create a "build", also known as "install profile" or "distribution" that basically combines several modules and your settings for them. So the next time you setup the same exact site, you don't have to re-configure all the modules. Does Joomla have a similar concept, and what is it called? Please reference d...

what mysqli functions to use instead of mysql?

This will probably sound pretty dumb. I've got a mysql function containing the following... @mysql_connect() @mysql_select_db($databaseName,$link); mysql_query($sql,$link); mysql_error() mysql_fetch_array($result,MYSQL_ASSOC) mysql_num_rows($result) Can I just bung an i after mysql like this... @mysqli_connect mysqli_query($l...

Validating US phone number with php/regex

Ok, so I've already got the bulk of this worked out... I've got a function right now that will run a pattern check on the phone number it's given and then determine whether it's a "valid" phone number based on the NANPA guidelines. However, the problem I'm running into is that it allows people to enter "extension" numbers, but I can't f...

cakephp routing problem (or maybe just confusion)

Hi, I've just started learning cakephp and have gotten the Blog example working except for the routing, I'm still not quite sure how it works after reading many, many documents on routing (including the ones in the official cookbook). My problem is with the '/' root routing, I want it to go to the index() function of the PostsControlle...

Should I combine .css files with php to reduce http requests?

I was thinking today, as I linked a webpage to 3 external .css files: "This is too many HTTP requests!" I got to wondering if I should be using php to combine these files into one? Or should I just import all three into the <head> with <style> tags? I found one relevant link on the interwebs: Suture CSS or JavaScript Files to Reduce H...

PHP Static Method Using Private Class Functions/Variables

If I write a public static method in a class ie... public static function get_info($type){ switch($type){ case'title': self::get_title(); break; } } I have to write my get_title() function as public... public static function get_title(){ return 'Title'; } ...

php - test if sessions are started

How do you test to see if sessions are on. This is not the way... <?php session_start(); if(isset($_SESSION)) { echo "sessions ON<br>"; } else{ echo "sessions OFF<br>"; } session_destroy(); if(isset($_SESSION)) { echo "sessions ON<br>"; } else{ echo "sessions OFF<br>"; } ?> ...

PHP Session Variables - At Wit's End

I'm just getting in to MySQL and PHP--and I'm just trying to create a simple login system for a project we're testing. I've connected and created the login logic just fine, but now I can't for the life of me get the session variables to carry over to the new pages. Could someone please show me the correct way to do this? Here is my lo...