php

Upload a file to Google Code Hosting with PHP and fsockopen().

Hi, Google Code Hosting has the ability to upload files to it remotely. I've been trying to program a script in PHP which uploads files to my account. Here's the script itself: <?php /* I censored a few details. */ $username = '***@gmail.com'; $password = '***'; $file = 'test.txt'; $project = '***'; $summary = 'test'; $uploadHost = "...

What are the common patterns for validation in model in PHP?

Currently, I create an object and use its setters to set the get/post data received from client. And call the validate() before calling the save() function like this: //member registration $m=new Member(); $m->setName($_POST['name']); $m->setBirthDate($_POST['birthdate']); $m->setAddress($_POST['address']); $arrOfErrMsgs=$m->validate()...

In PHP, what is binary string?

like this: $str=b'xxxxxx'; ...

Official end of support for PHP4?

Is there an official date for when support for PHP4 will end? I keep reading this date and that on various sites and blogs, but can't find anything on the PHP website. Am I overlooking something? ...

Mysql trigger/events vs Cronjob

Hello, I have an auction website which let my users place an unlimited amount of autobiddings. To monitor these autobiddings something has to check the database every second. My question is if it is better to use mysql trigger events or to user a cronjob every minute that executes a 60 sec looping php script. If i use the mysql tr...

nuSoap or Zend Soap?

Hello, I would like to know the differences between nusoap and ZendSoap, which is the best? what benefits and disadvantages of each? Anyone who has used both technologies could make this comparison? Thank you ...

pluralisation/depluralisation

Does php have any function to deal with pluralising or depluralising words? Obviously it's pretty easy to take off or replace the 's' at the end of words like 'apple' but other words are not so simple. If php doesn't have a native way of dealing with it, how do other languages deal with the problem? Is there a function that can handle ...

Floating point number format

Hi all, I want to use number_format function in PHP. For example: $number = 234.51; echo number_format($number,2); This works for float numbers but I want to use it for different numbers. If a number is decimal and doesn't have any floating points, it shows like : 145.00 . How can I fix this? I mean I want to show as many floating po...

What is the equivalent of JavaScript's encodeURIcomponent in PHP?

What is the equivalent of JavaScript's encodeURIcomponent in PHP? ...

Ready solution for manipulate images.

I'm searching for a class or function, to convert, add borders and text (using ttf fonts) to an uploaded image before the image is saved on the server. Do you know something? ...

Send XML in a js variable

Hi , I have this php code and the variable is XML data $strXML = "<chart caption='ADI Chart Test ' xAxisName='Month' yAxisName='Units'" $strXML.= "showValues='0'formatNumberScale='0' showBorder='1'>"; echo "<td align='right' onClick='drawchart($strXML)' > $totalcost </td> " ;` this is passed to a javascript function function drawc...

eclipse with php and C/C++

hi there I'm into the learning stage of C and PHP. Until now I was using MS Visual Studio IDE for C/C++ applications and Notepad++ for PHP application. Now I'm thinking to use same IDE for those languages and Eclipse seems to support both of them. My questions are: - Do you think is good to forgot about using MS Visual Studio for Ecl...

special characters wont be inserted into mysql table the right way...

I have a mysql database which Im trying to submit values to through a php file from a form. If I manually insert values to the table 'myTable' with special characters like the swedish åäö letters, it works fine. But when I am trying to use 'INSERT INTO' after a form is submitted on my page, to insert values to the table, all special ch...

save variable as txt but not in the server

how can i save some variables in a txt file for the user? dont want to generate and store in my server, just want to generate and then the user save on his pc, nothing changes on the server btw, is this operation heavy on resources? thanks ...

Zend_framework - relative paths of images

When i am developing a web application on Zend_framework (php) i have to include images (css files, js files, etc). The solution for inclusion was to specify the absolute paths each time i needed an image (i was storing in "global like" parameter with my host and concatenated it with the relative path of the image on the host). As i un...

would it be faster to implement php code into html, or to use only php? See more details...

Im currently using PHP to fetch results from a mysql db. Im also displaying the results by building a table and all with PHP also. My question is, would it improve loading speed if I would just call the php variables from a HTML document (PHP + HTML). Or maybe it doesn't matter, and I should go with the ONLY PHP solution that I alread...

Large PHP file containing multiple pages vs Multiple PHP files with the use of session variables

What are the advantages/disadvantages of using include/require's to achieve a singular file that contains multiple pages as opposed to directing the user to many individual pages and storing the variables as session variables? In particular I am asking with regard to a long multi step process (think questionnaire). ...

Checking file props before upload

I am practicing with PHP and AJAX but I have some problems! I'm trying to get the filename, type, size from a jQuery alert after select an image to upload, but I keep getting an empty string. <form action="upload_file.php" method="post" enctype="multipart/form-data"> <label for="file">Filename:</label> <input type="file" name="...

changing content of a div with javascript and php include

Hello. I wish to do something iframe-like with my div i've got going here. Basically, i've gotten as far as making links change the content of the div like so: <a href="#self" onClick="document.getElementById('maincontent').innerHTML = '<?php include 'file.php'; ?>';">Open file</a> This works pretty well, sadly though, if i make ano...

How to create a temporary table in MySQL to output table data as a CSV file?

I've got a script for creating a CSV file from a database table, which works fine except that it outputs all the data in the table, and I need it to output data only for the current logged in user. The app I'm developing is for users to be able to store lists of books they've read, want to read, etc., and I want to be able to allow them ...