php

Library to aid with creating sites that users register for

Hello, I am trying to create a website that users have to register for, and this gives them access to all the site features. Potentially, maybe i want users to pay a yearly subscription fee. Is there a library to handle this for me? This should include, keeping track of user cookie and logged in status, keeping track of expiry date, ve...

What are the best tips & tricks you use with Eclipse PDT

There are a couple of similar threads here, but most of the other tips don't work on PDT so let's make this one specific to Eclipse PDT for PHP. I'll start (w/ credit to those that work from other the other threads): CTRL-SPACE = code completion CMD-/ = auto comment CMD-SHIFT-L = key assist If autocomplete isn't working righ...

localhost/test.php is also reachable under localhost/test/

What is wrong with my apache-conf, why is the file also reachable under a folder-path without an extension? I haven't set any rewrite rules and there are no .htaccess files. This is the default os x apache installation. ...

extract part of file name

If I have a string in the following format: location-cityName.xml how do I extract only the cityName, i.e. a word between - (dash) and . (period)? ...

System to handle hash tags for tab content? (!#)

I have four pages on the main part of the website I am working on, and I want the switching between the 4 tabs to be a fading transition (using jQuery), that's all fine and dandy but I also want SEO to think of each as a separate page, I also want to be able to link to a URL and for it to pull up the right content, even though it is tech...

Returning a reference to an object in PHP

I'm using PHP 5.2.14 and PearLog 1.12.3. The latest documentation from the singleton method in Log.php (PEARLog) states: You MUST call this method with the $var = &Log::singleton()syntax. Without the ampersand (&) in front of the method name, you will not get a reference; you will get a copy. However, doing so generates the...

How do you make a social network badge?

You see them everywhere. Like the twitter and facebook buttons that show up on blogs and websites that display a number of "tweets" or "likes". All I need to be able to do is display a number from my MySQL database based on two variables (username and an ID). It would probably be useful to encrypt the variables somehow so that users can'...

Can .htaccess rewrites request files outside of the htdocs/httpsdocs area of a server?

On my server, a website resides within a directory similar to /domains/domain.com/public_html. I wish to keep the domain at this path, as all the main files are there, but is there any way to source some files from another location in my server, eg. /global/script.js? In short, I hope to write a mod-rewrite than can source specific file...

explode an string and html special character filter in php

hey guys i have a textarea with ckeditor customized toolbar which user can only select smiley now i want users can only use smilys and new line function so if $comment is my raw text output with html tags and i want only smiley and text with new lines appeared in output not other html tags sample raw data : <p> this is a sampl...

create mysql database on mac os x

I know this sounds a little ridiculous, but I'm just honestly wondering how I can create a MySQL database on my Mac OS X machine. I have MySQL installed (as far as I know) as well as PHP, and I'm wondering how I can create one. I have downloaded a sample PHP ecommerce site to kind of delve into what I'm trying to familiarze myself with...

PHP: How to quickly split a key=value file into associative array

When you send a PDT transaction ID back to paypal, you get back a list of transaction data. It has SUCCESS on the first line, and then a list of key=value pairs. One pair per line. For example: SUCCESS [email protected] charset=windows-1252 custom= first_name=Alice handling_amount=0.00 invoice=NN0005 item_name=Bear item_number...

UNIX timestamp issue on MYSQL insert via PHP

Im receiving data with a created time field given in a unix timestamp format for example "1251324809" which to my understanding is the amount of time elapsed since the epoch, 1970. Ive got a DATETIME formatted field in a MYSQL table, and im using this to return the UNIX time to a YY-MM-DD HH:MM:SS format: date('Y-m-d H:i:s', $timestamp...

Why is $wpdb->insert_id and mysql_insert_id() returning with an extra '1' at the end?

I need to retrieve the ID of the AUTO_INCREMENT value of the last query. My query looks like this: $result = $wpdb->query( $wpdb->prepare( " INSERT INTO $table_name ( name, season, copyright, description, path ) VALUES ( %s, %s, %s, %s, %s )", $galleryData['name'], $galleryData['season'], $galleryData['copyright'], $...

What is aggregation and delegation in PHP...?

Hi guys I was wondering what these terms are in php...I looked up google but couldn't find any good answers. I would appreciate if someone here can help me about it. Thanks a lot.!!! ...

MySQL hook up to a website ?

Hi, I am trying to develop a WebSite for my Church. I don't have much experience in IT, but I have a home page with html and css right now. I would like to have a database that I could hook it up to.. Are there any basic tutorials on how to do this? I am running linux mint. and My website is PHP. How could i hook up a MySQL Database...

PHP Apache SQL Server production environment on OS X

I have a client who wants me to build a site using PHP and SQL Server. Problem is I do all my PHP development in OS X running Apache. I have one machine running Windows with an SQL Server production environment but I can't seem to connect via "sqlsrv_connect" because I can't install the drivers for sql server on my Mac Has anyone found ...

Ignore fatal errors and DB exceptions in a PHP web service

I have a web service written in PHP, that returns JSON results. It works well and has been thoroughly tested. I needed to add logging to the service calls (who called and when). I implemented this using a SQLite database (for very small amount of data) and PDO. The one condition to the logging was that it should not harm the web servic...

Adding an integer to a float in PHP rounds the float to 1 decimal place

For example, I have this line of code: echo 10359023529 + 0.2137582935; Why does this return: 10359023529.2 instead of: 10359023529.2137582935 ...

Ensuring user input code does not damage server when executed

I'm working on a web app that can allow the user to input some code, and it will be compiled and executed, and they can see the result. I'm coding the app in PHP and I need a way to ensure that if the user inputs some harmful code (this example is PHP), it can't execute and destroy my server. Example: <?php shell_exec('rm -rf /'); ?> ...

PHP Case Insensitive Version of file_exists()

I'm trying to think of the fastest way to implement a case insensitive file_exists function in PHP. Is my best bet to enumerate the file in the directory and do a strtolower() to strtolower() comparison until a match is found? ...