Archive for the ‘program in php’ Category

How can I transition PHP website code over to a client who doesn’t program?

I program PHP-MySQL based websites as a side job/hobby. Most of the stuff I’ve done is for family, friends, friends of friends, etc. I have a strong programming background, and many of these websites have been quite extensive.

My question is regarding clients who have as a goal to eventually take the website over themselves. I’m shocked to find that many of these people have pictured in their minds that the site is created in Microsoft Word (or something like that). I can’t help but discourage these people from asking me to turn the site over to them.

I’ve tried to explain to some of them that their website is complex, including a few different programming languages and a large amount of database integration. Few of them take this very well. They just can’t understand why they couldn’t be able to perform "simple maintenance", such as creating a form, or adding a new page to their ordering process. Little of what they describe is really very "simple".

I always tell them that they are welcome to do whatever they like — they own the code if they have paid me for it. But I discourage them from trying to take it over.

One client recently insisted that he be given complete and exclusive ownership his site. It was a website for his business and had taken a couple of years to complete to his satisfaction. I gave him the files, got him setup on his own host, and said "Good luck". He would accept no less. Sadly, the site fell to pieces within weeks of him tinkering with it.

I have another similar client asking me for the same thing now.

So, what do side-job programmers like me do? How can I explain this to clients? What’s the professional thing to do?

The best way is to not create everything yourself.

Create the website with a CMS / shopping cart you like, define user roles, and it gets really easy to perform simple maintenance without killing the code.
If something is still missing, create a plugin.

Don’t take the following the wrong way:
You are still creating websites the web 1.0 way. Nowadays, it’s web 2.0 and people are used to add content, widgets, etc. themselves, like they do it on Ebay, Facebook, Weebly, etc. You can’t tell them that it is not possible to perform simple maintenance because they already do it everyday.

So, invest some time to find a flexible framework you like and then build the websites on it. Believe me, you can even ask for more money that way.

I need to write a program in php that will intake any amount of numbers and find the average?

Its been suggested that I should use the explode function and/or the count function

<?php

function avg_int($intArray){
  $sum = 0; $len = count($intArray);
  for($i=0;$i<$len;$i++) $sum += $intArray[$i];
  return $sum / $len;
}

//test…
echo avg_int(array(1,2,3,4,5));

?>

Can search engines see text that is displayed by PHP programs?

I’m working on a Web site where every page is a PHP program that displays text. Will search engine crawlers look in PHP programs for text, or are the search engines going to see it as an empty site?

Thanks,
Houyhnhnm

Search engines, spiders, crawlers, and robots, and users, will only see the output. So when the page loads, view the source of the website (ctrl + u) and you will see everything that the search engines can see. The PHP code itself is not visible to anyone. Only the code that it outputs.

If for some reason there is a mistake and the server doesn’t recognize the php as php, it could serve the file as a text file, instead of processing it first. In that case it would be visible, but that is not going to happen unless your server gets really messed up or if you save it as .txt instead of .php or something.

set ff as default browser in php program?

hi,im creating a website in which,i need people to open it with firefox alone.how to add code in php?any help?

I agree with Just JR that you shouldn’t do that.

But if you want to know how to enforce the use of FF, look here:

http://php.net/manual/en/function.get-browser.php

It allows you to determine how the browser identifies itself; you can then let your scripts end if it is not as Firefox.

run php-want to run php program written in notepad with wamp sewrver?

want to run php program written in notepad with wamp sewrver

Go to this link and download wamp server

www.wampserver.com/en/download.php

Install it in your pc.
Put your php files in c:\wamp\www\yourcustomfolder\
Start your wamp server
Open the browser and type http://localhost/yourcustomfolder/
you ll see your php files running on it

What is the most famous programming Language in australia, I am a Java develper + Web Designer(PHP,Flash) Wh?

I want to know what is the most common programming language that are using for software development in Australia ( like in india Java , PHP and .NET). Anybody have clue please help me

I don’t think they have stats available for specific countries, but as far as popularity goes, the most widely used programming language in the world is Java.

Can you help me with this program (php or javascript) please,?

A bank in your town updates its customers’ accounts at the end of each month. The bank offers two types of accounts: savings and checking. Every customer must maintain a minimum balance. If a customer’s balance falls below the minimum balance, there is a service charge of $10.00 for savings accounts and $25.00 for checking accounts. If the balance at the end of the month is at least the minimum balance, the account receives interest as follows:

a. Savings accounts receive 4% interest

b. Checking account with balances up to $5000 more than the minimum balance receive 3% interest; otherwise, the interest is 5%.

Write a program that reads a customer’s account number (int type), account type (char; s for savings, c for checking), minimum balance that the account should maintain, and current balance. The program should then output the account number, account type, current balance, and an appropriate message.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<script type="text/javascript">
function calculate() {
var accnumber = Number(document.getElementById(‘accnumber’).value),
acctype = document.getElementById(‘acctype’).value,
minimum = Number(document.getElementById(‘minimum’).value),
balance = Number(document.getElementById(‘balance’).value),
output = document.getElementById(‘output’),
info = ”,
interest,
total = 0,
actypestring;

actypestring = acctype == ‘c’ ? ‘Checking’ : ‘Saving’;
// check for empty values
if( (accnumber == ”) || (acctype == ”) || (minimum == ”) || (balance == ”) ){
alert("Please fill all the fields!");
return;
}

// workout a savings account
if( acctype == ‘s’ ){
if( balance < minimum ){
total = balance – 10;
info = ‘You have received a service charge of: $10.00′;
} else {
interest = (balance / 100) * 4;
total = balance + interest;
info = ‘You have received interest of: $’+interest;
}
} else {
// checking account
if( balance < minimum ){
total = balance – 25;
info = ‘You have received a service charge of: $25.00′;
} else {
if( balance – minimum > 5000 ){
interest = (balance / 100) * 5;
} else {
interest = (balance / 100) * 3
};
total = balance + interest;
info = ‘You have received interest of: $’+interest.toFixed(2);
}
}

output.innerHTML = ‘<p>Account Number: ‘+accnumber+’</p>’;
output.innerHTML += ‘<p>Account Type: ‘+actypestring+’</p>’;
output.innerHTML += ‘<p>Starting Balance: $’+balance.toFixed(2)+’</p>’;
output.innerHTML += ‘<p>’+info+’</p>’;
output.innerHTML += ‘<p>Your new balance is: $’+total.toFixed(2)+’</p>’;

}
</script>
<body>
<table border="0" cellspacing="5" cellpadding="5">
<tr>
<td><label for="accnumber">Account Number:</label></td>
<td><input type="text" name="accnumber" id="accnumber" /></td>
</tr>
<tr>
<td><label for="acctype">Account Type:</label></td>
<td><select name="acctype" id="acctype">
<option value="c">Checking</option>
<option value="s">Saving</option>
</select></td>
</tr>
<tr>
<td><label for="minimum">Minimum Amount:</label></td>
<td><input type="text" name="minimum" id="minimum" /></td>
</tr>
<tr>
<td><label for="balance">Account Balance:</label></td>
<td><input type="text" name="balance" id="balance" /></td>
</tr>
<tr>
<td colspan="2"><input type="button" value="Calculate Interest" onmouseup="calculate();" /></td>
</tr>
</table>
<div id="output"></div>
</body>
</html>

If this code gets chewed up by Yahoo’s awesome formatting I can email it to you just contact me through my profile on here

Cheers

Adding an Ajax Web Photo Gallery to Your Website for Amateurs. (based on My Own Experience)

I was recently found a new product from Vista Web Photo Gallery.com, http://vistaphotogallery.com/, an IT company. The new product has the same name, Vista Web Photo Gallery, http://vistaphotogallery.com/, and it helps users to create albums of photos and put them online. Vista Web Photo Gallery is announced as the only software that creates AJAX-powered on-line picture galleries without the need for server side setup. It means you just upload files generated by the program to your web server and it will run instantly, even if it’s a free web hosting without a cgi, php, asp, mysql support.

I’m not a pro of html design or web coding, so I wanted to find out how easy it is to make that “high-end image gallery apps that look and behave exactly like desktop software”. I downloaded the free test version of software from the VistaPhotoGallery.com web site http://vistaphotogallery.com/vistaphotogallery-setup.exe and installed it on my home computer (I’m on Windows).

After running through a fast installation procedure, Vista Web Photo Gallery opens on your desktop – and right away you see step-by-step hints in the main window on how to get your photo web gallery ready.
http://2.bp.blogspot.com/_OddNt6Ea0Ks/SQBm9bSq0eI/AAAAAAAAAA4/__8NSie5VFM/s1600-h/0.jpg

In short, you should drag and drop image files, add descriptions and tags, and then publish using “Publish Gallery” button.

Vista Photo Web Gallery’s interface is very simple and clear. You’ll see a toolbar running along the top, “Tags”, “Date Taken”, “Folders” trees at the left, and an picture data panel that runs beneath the main window. If you ever used the standard Photo Gallery software that comes with Windows XP or Windows Vista, you’ll find Vista Web Gallery very familiar.

I dragged and dropped some photos from Windows Explorer, thumbnails appeared in the preview window and the “Date Taken” tree at the left was filled with dates of images. Then I tried to drop four folders with my recent photos, more that 300 in total – no problem, all thumbnails were displayed in the main panel and folder names were added to “Folders”.

I very liked “Date Taken” tree functionality. All the pile of photos I dropped to the program, were sorted by date, so I could easily navigate through years, months and days of feelings and memories ;) I’m already thinking about using this software as a organizer for all my photo collection. http://4.bp.blogspot.com/_OddNt6Ea0Ks/SQBpj1D-eOI/AAAAAAAAABA/8LPcAMeUaxo/s1600-h/1.jpg

Vista Web Photo Gallery offers some options for working with tags, including the “Tags” tree and “Add Tag” field on image info panel. I added several tags and several captions for my photos without any troubles.
http://4.bp.blogspot.com/_OddNt6Ea0Ks/SQBp9imH8eI/AAAAAAAAABI/bq8WJjgcJXw/s1600-h/2.jpg

Ok, not bad so far. I had a photo gallery on my computer, but what about online gallery? Much to my surprise, generating the image web gallery was even easier than I imagined! http://1.bp.blogspot.com/_OddNt6Ea0Ks/SQBqd4iHHqI/AAAAAAAAABQ/796t3hus6eI/s1600-h/3.jpg
I clicked “Publish Gallery”, selected a folder to save, a couple of seconds, and .. WOW! The gallery was opened in my Internet Explorer, but at the first look I didn’t realize that it’s my finished photo web gallery! Great vista-like style design, the same “Tags”, “Date Taken”, “Folders” trees at the left with the same “on-fly” sorting and filtering, picture thumbnails with zooming on mouseover and changing the preview mode – all looks and acts as a Windows desktop application but inside the web browser.

Finally, I uploaded the folder with generated gallery to my free webhosting account at 50webs.com, http://eskolahti.50webs.com/, and it ran at the first try without any efforts from my side in spite of the fact that 50webs does not support PHP, CGI or any server scripts in free hosting plans. You can see my gallery at http://eskolahti.50webs.com/. It’s not a full web gallery I made, just a small part for public eye, but as a sample it’s very good.
http://4.bp.blogspot.com/_OddNt6Ea0Ks/SQBwHxi2-BI/AAAAAAAAACI/9uEWsR-KJH8/s1600-h/4.jpg
http://2.bp.blogspot.com/_OddNt6Ea0Ks/SQBugOczBVI/AAAAAAAAAB4/bpbYNjBizXU/s1600-h/5.jpg

Vista Photo Gallery is an excellent software that is friendly to amateur website developers, but at the same time is powerful enough to meet the needs of more-advanced users. The advanced AJAX-powered engine is the key feature that makes photo galleries looks and performs great. I had some experience with other gallery generators before, but Vista Web Photo Gallery, http://vistaphotogallery.com/, is definitely best in both easy-to-use and final result.

Esko Lahti

Affiliate Tracking Software Review: Partnersmanager

Building Muscle Supplements – Steroid Like Results Fast!