php

Authentication / Denying access to files in directory with php

I have a directory of files that logged-in users can upload to and access. Some of the files are public, and others are private - for internal access only. The filenames and access settings are saved in a database. Can anybody give me some resources or show me an example of how i can use session data (and .htaccess?) to allow access of ...

How can I get insert query to work with two if(isset statements?

On a users profile, there is a comment box that enables other users to post comments on their profile. I am now working on a dynamic comment area that has a changing text box depending on if A. you are looking at your own profile B. looking at someone elses profile C. not signed in at all. I am trying to implement "updates" now when you...

adding Lots items and single item to a shopping cart help!

I have a two different tables for two types of item list one called a single item list and another list called lot items that uses the same item name field from the single item list. Then the second table is used for the prices, sizes and amount of pieces per lot. the single item list is adding each item as expected, a single item come f...

Access gmail or yahoo mail using script

I was wondering how one would go about writing a php script to access mail from yahoo or gmail ? ...

How do I retrieve external data from MS SQL from a Wordpress Blog?

In Wordpress, how would I pull data from an external Microsoft SQL database to display as a read only table? To be clear, this is not a question on how to convert Wordpress over to MS SQL, but rather how to pull data for a specific widget from a source outside the primary Wordpress DB. The data I need to pull from happens to be in a MS ...

How to set REMOTE_ADDR in apache before php is invoked

I have a website set up with nginx acting as a reverse proxy to apache 2.2, which is running php. From apache and php's perspective the IP address of all requests is the nginx server. I'd like php to see the same remote IP that nginx sees. Nginx sets a header X-Real-IP which contains the remote IP that nginx sees. I tried doing somet...

Is file_get_contents slower than include?

have a file caching system for a php 5 library i use often. when the request is made i check for a cached file, if there is one i render it and exit. $contents = file_get_contents( self::_cacheFile() ); echo $contents; exit(); i have to do file_get_contents instead of just include because of cached xml files with the pesky `<?x...

Why can't Doctrine retrieve my model data?

So, I'm trying to use Doctrine to retrieve some data. I have some basic code like this: $conn = Doctrine_Manager::connection(CONNECTION_STRING); $site = Doctrine_Core::getTable('Site')->find('00024'); echo $site->SiteName; However, this keeps throwing a SQL error that 'column siteid does not exist'. When I look at the exception the SQ...

Displaying query result in a HTML table in PHP

Hi All, I need to display a table in a web page. The data from the table comes from database which I can query using mysql php library. I am looking for a template/example of how to come up with a nice looking table (I am not good at front end design :(). Any link/example/references will be appreciated. Thank you. ...

display results on the go in php ?

i have a for loop that will loop through a set of page in php. for ($count=0;$count<=$curr;$count=$count + 10) { if ($find==1) { $result = "file.php?count=$count"; }else { $result = "file2.php?count=$count"; } $match = file_get_contents($result)...

how to bind to an openldap server

I am using the PHP extension. The username is admin password is 111111 I try to bind using ldap_bind($rs,'admin','111111') It gives me an error: Unable to bind to server: Invalid DN syntax in [line of the ldap_bind] I can bind anonymously, what is the correct syntax? ...

How do i access my own MAMP webserver on a VM

Hey guys, I have MAMP running on localhost on my MAC, now i would like to view this on my Windows XP VM (VMWare Fusion). I have set my MAC up to have 'Web Sharing', but this only allows you to view files in the 'Sites' directory in your user home, but, my MAMP web folder is on my desktop. Any suggestions about how i can somehow view th...

How could I validate a form, but have it return to the same form on action is there was an error? Very newbie question.

Here's my registerFormOne.php code: <?php session_start(); require("validationLibrary.php"); $validForm = true; ?> <html> <head> <title>Registration Form - 1 of 2</title> </head> <body> <h1>Registration - Part 1 of 2</h1> <p>Please fill in all the required information before submitting the informati...

How secure (hardened) is this script?

The script below, test.php, is intended to be placed in a specific directory of all my wordpress sites. Its purpose is to grab the file at the $source address below and extract it to the directory in which it resides. That's all its intended to do. For example, I will have a dashboard interface on my central server that lists all my sit...

Massive newbie error while using the PHP header() function.

I'm trying to redirect to a .php page if the $validForm variable is TRUE. Here's my code: <?php session_start(); require("validationLibrary.php"); $validForm = true; ?> <html> <head> <title>Registration Form - 1 of 2</title> </head> <body> <h1>Registration - Part 1 of 2</h1> <p>Please fill in all t...

elegant way to map two arrays to each other

I've got two arrays, one with IDs and one with Names: $ids = array(4, 13, 6, 8, 10); $names = array('alice', 'bob', 'charles', 'david', 'elizabeth'); I need to update the db so that the rows with the ids have the names in the array. Here's the tricky bit: I also have two ints: $special_name = 2; // the index in $names, in this case w...

Access database variable in functions with PHP

I am fairly new to PHP and I have found that a lot of my functions require access to the database. The problem is I currently connect to the database in a file that I require at the top of every page like so: $db = new mysqli("localhost", "my_user", "my_password", "world"); The problem I find is then when I want to access it within a ...

database encoding problem? Double and single quotes being displayed w/ question marks

Old server db = MySQL v4.0.21 New server db = MySQL v5.0.45 I am moving an app to a new server, and I copied over the database. The app sends an agenda for the day and whenever there are double & single quotes " ', they show up as question marks ? Comes up like this on the server it was moved to ?The Horror of Race: HBO?s True Blood? ...

Form isn't moving to the other page I specified, please help. A PHP newbie problem.

Here's my code: <?php session_start(); require("validationLibrary.php"); $_SESSION['validForm'] = true; if($_SESSION['validForm'] == true){ header("Location: registerFormTwo.php"); } ?> <html> <head> <title>Registration Form - 1 of 2</title> </head> <body> <h1>Registration - Part 1 of 2</h1> <...

really weird symbol in php?

what does the ∫ symbol mean in php? Here is copy/paste of my var dump.. note the @user_id symbol then(0). Thanks! `` object(dbStoredProcedure)#13 (9) { ["dbh:private"]=> resource(27) of type (mssql link) ["sp_name:private"]=> string(24) "[dbo].[user_account_ins]" ["sp_parameters:private"]=> array(0) { } ["st...