php

How do you structure your site?

Im new with php. Have some questions on how to build. I include everything in index.php. Ex: ob_start.. html... functions etc.. if ($_GET['page'] == "forum") include('forum.php'); elseif ($_GET['page'] == "profile") include('profile.php'); else error...etc /html... I do it this way because I dont like to have to include a page in t...

PHP HTTP POST fails when cURL data > 1024

Note: solution at the end If I attempt to do a HTTP POST of over 1024 characters, it fails. Why? Here is a minimal example: recipient.php: <?php if (strlen(file_get_contents('php://input')) > 1000 || strlen($HTTP_RAW_POST_DATA) > 1000) { echo "This was a triumph."; } ?> sender.php: <?php function try_to_post($char_count) { $u...

A PHP API for retrieving Mail From Yahoo, GMail, Hotmail

Hello all, There are a few APIs for grabbing the address book/contact list from the major providers of email. I was wondering do APIs like this exist for grabbing emails/messages received? Thanks all EDIT I am sure I can do this myself. However, I don't want to "re-invent" the wheel if someone has done it already. Probably better th...

Possible to post data in a PHP redirect?

Well right now I have a page (page2.php) and at the top it does some validation checking and if something fails it bounces back to page1.php. The problem is that page1.php is loaded by a post meaning it is the end result of a form. This means that all the post data I originally have on page1.php is lost. So here is my code: if ($vali...

Python VS PHP, Differences?

I'm already proficient in PHP and Javascript, but for a project a client is insisting that it be done in Python instead. Its a good opportunity, so I've agreed to learn Python. My questions are: How easy/hard will it be to build AJAX powered web applications in Python compared to PHP what are the main differences in the two languages...

CURL usages in PHP

Hi friends, I had a doubt in CURL (PHP) . I want to login directly into a site using CURL. Is it possible, if possible please guide me. I tried with the following but its not working http://username:password@myurl Please solve this.. Thanks in advance ...

JSON in JQuery

Dear all i am using php and JQuery, and JSON.Now i need to know how to parseThe JQuery data in javascript. load.php <?php ... $json =json_encode($array); ?> It Returns jQuery by following data [{"name":"STA","distance":"250","code":25}, {"name":"GIS","distance":"500","code":45}] jQuery $.getJSON("load.php", function(json...

Connect to a MySQL server over SSH in PHP

Hi , i read one post regarding this topic, i also want to do the same, i have my database on remote linux machine, and i want to connect using ssh and php funcitons,(i am currently using ssh2 library for that) i tried using mysql_connect, but it gives me cant access (although i have granted permission) when i tried using this function:...

Best tool to check and ensure PDF/A compatibility under Linux

I am working on an online portal, where researchers can upload their research papers. One requirement is, that all PDFs are stored in PDF/A-format. As I can't rely on the users to generate PDF/A conforming documents, I need a tool to check and convert standard PDFs into PDF/A format. What is the best tool you know of? Price Quality Sp...

Dynamic backgroundimages PHP GD

Hi Stackers, Problem Basicly, it's impossible to use a full-size photograph with the background-image in a proper way imo. Different resolutions, wide-screen etc etc. What im looking for is a JS/PHP GD solution for this problem. Technique From what i hear, it would be as follows. Javascript looks up available screensize (browser window...

php variable problem

Hello, I have the following php code, which has been snipped for brevity. I am having trouble with the code after $lastImg is declared, specifically size never seems to get assigned any value, and the hence outputwidth and outputheight remain blank. I have been unable to spot the cause of this. pic_url is just a string in the database,...

Building personal CMS - classes and libraries

I'm building my personal CMS and need your advice organizing core functions and classes. I have folders: /shared /classes DB.php Session.php Config.php ... /libraries Arrays.php DateTime.php Email.php ... The files in 'classes' folder contains core classes (one class per fi...

List table names

I'm in the process of trying to migrate my ASPNET site to Django. All my current data is tied up in MS SQL Server on a shared host that (helpfully) doesn't support python... I could use my existing code to export all the data but I've also stopped using Windows. The site is mainly compiled VB.NET so I'd need to install Windows and Visual...

curl and php problem -- blank page

I am attempting to download images saved in a url to a local folder, and have made the following attempt at doing so with curl. I would like to know if it is necessary to include curl or download it seperateley, or if my function will just work. I would like to know if there are any obvious problems with my implementation below. I am awa...

php calling bash problem

I have this simple php script <?php echo '<pre>'; // Outputs all the result of shellcommand "ls", and returns // the last output line into $last_line. Stores the return value // of the shell command in $retval. $last_line = $output = system ("~/public_html/cgi-bin/srch.sh &> ~/public_html/errors.txt",$retval); // Printing additional i...

DSN-less ODBC Connection to iSeries

I'm running PHP 5.2.4 with ibm_db2 v1.8.0 on Ubuntu 8.04.1 Server. I am trying to hit an IBM iSeries running OS/400 v5R3 but I'm not sure at all how to actually connect without a DSN. I've looked at http://www.connectionstrings.com/ but none of the DB2 or AS/400 connection strings seem to work. All I end up with is: [IBM][CLI Driver] SQ...

Class Instantiation Fails

Hi Everyone, I'm having some problems getting my object to gracefully fail out if an invalid parameter is given during instantiation. I have a feeling it's a small syntax thing somewhere that I simply need fresh eyes on. Any help is more than appreciated. class bib { protected $bibid; public function __construct($new_bibid) { ...

SERVER_ADDR undefined index

Hey, I am getting an undefined index on my config page and it reads: Notice: Undefined index: SERVER_ADDR in inc/config .inc.php on line 3 Any idea on how I can fix that? I know its warning, but would still like to get at it. I am using it to check for the address whether to use my local or remote config settings. Thanks, Ryan ...

PHP list directories and files

What would be the easiest way to have a page where it will display a list of directories that the user can click on to open, where there will be more directories or eventually files to download and have it all happen on the same page? ...

Why doesn't my email regex for PHP work?

I have the same expression in Javascript but it won't work in PHP for server side validation. Here's the code if (ereg('/^([a-zA-Z0-9_.-])+@([a-zA-Z0-9_.-])+\\.([a-zA-Z])+([a-zA-Z])+/',$_POST['email-address'])) echo "valid email"; else echo "invalid email"; ...