Monday, February 28, 2011

Windows Intune

Windows Intune builds on our history of delivering cloud services at scale, including Hotmail and Windows Update, and leverages Microsoft’s cloud experience with Azure, Dynamics CRM Online and Office 365 to give our customers the best Windows experience possible by providing the tools IT professionals need to ensure their employees can be productive and secure from virtually anywhere. Windows Intune also includes upgrade rights to Windows 7 Enterprise, so customers can standardize on a single version of Windows, making management of their PC environment easier and more efficient.

On March 23, we invite you to join us at the Microsoft Management Summit in Las Vegas or tune in to www.windowsintune.com (which should get updated later today) as we introduce the final version of Windows Intune and celebrate its commercial availability in the following countries: Australia, Austria, Belgium, Canada, Costa Rica, Cyprus, Czech Republic, Denmark, Finland, France, Germany, Greece, Hong Kong, Hungary, India, Ireland, Israel, Italy, Japan, Luxembourg, Malaysia, Mexico, Netherlands, New Zealand, Norway, Poland, Portugal, Puerto Rico, Romania, Singapore, Spain, Sweden, Switzerland, Trinidad & Tobago, United Kingdom and United States.

For now, we encourage you to sign up for Windows Intune notifications, where you can find information about the upcoming free 30 day trial. Partners, be sure to visit https://partner.microsoft.com/windowsintune to learn how you can add Windows Intune to your catalog of products and services.

Top 10 Benefits


1.Help manage and secure your PCs from anywhere.

The Windows Intune cloud service helps keep your employees productive in
the office or on the road—all that’s required is an Internet connection. Through
a simple web-based console, your IT staff can provide remote assistance from
virtually anywhere, centrally manage updates, and proactively help protect PCs
from malware threats, so your employees can stay focused on the business.

2.Get the best Windows experience.

Standardizing your PC environment provides a better experience for your
workforce and an easier environment for you to manage. You can upgrade to
Windows 7 Enterprise operating system or run a prior release—it’s your choice.
With its intuitive interface and advanced search capabilities, plus BitLocker®
drive encryption to better protect confidential data, Windows 7 Enterprise
gives your employees the best Windows experience available. As long as
your subscription remains active, you’ll also get upgrade rights to the latest
operating system, so you won’t need to worry about buying upgrade licenses
when the time comes.

3.Achieve big-tech results with a small-tech investment.

Designed to fit businesses without PC management and security infrastructure,
Windows Intune is an all-in-one solution that includes PC management,
malware protection, and Windows upgrades rolled into one easy purchase.
With minimal overhead, simple billing, and no formal training required, it’s easy
to get started and maintain.

4.Stop malware threats before they stop you.

Windows Intune gives you powerful, centralized protection to help keep your
PCs safe from the latest security threats. Built on the Microsoft® Malware
Protection Engine and using the same trusted technologies as Microsoft
Forefront® Endpoint Protection and Microsoft Security Essentials, you get
real-time protection with reporting and alerts to help safeguard PCs against
dynamic forms of malicious software, including spyware, viruses, and root kits.

5. Keep your PCs up-to-date.

Centrally manage the deployment of Microsoft updates and service
packs to all managed PCs. Through the web-based console, you can select
which updates you want to deploy across your PCs to help keep them
running smoothly.

6.Identify issues before they impact business.

Windows Intune makes it simpler for you to proactively monitor your PCs,
sending alerts to help you identify potential problems before they negatively
impact your employees and your business. With Windows Intune, you can
set up security and update alerts that notify you when you’ve got a threat
or if a critical update was unsuccessful—so you can fix it before your PCs
become vulnerable.

7.Easily track your assets and manage licenses.

Effective inventory management is key to optimizing existing investments.
With Windows Intune, you can easily view and track your organization’s
hardware and software inventory, so you can efficiently manage your assets,
licenses, and compliance.

8.Manage multiple customer accounts from a single view.

If you’re a solution provider or an IT consultant using Windows Intune to
manage your customers PCs, the Multi-Account Console consolidates all
of your customer accounts in a single view to help you stay on top of your
customers’ needs.

9.Increase your insight with reporting.

Get a snapshot of what’s going on in your PC environment, so you can quickly
see the status of updates, software, licensing, and more. In just a few simple
steps, you can create a report that gives you a full list of all the installed
software on your PCs managed by Windows Intune—so you can better
analyze specific needs of users in your organization. This data can also be
imported into other reporting tools such as Microsoft Office Excel® so you
can organize it into a view that’s most helpful for you.

10.A cloud you can count on.

Microsoft is a leader in IT infrastructure solutions with the Microsoft System
Center family of products, and we used that experience in developing
Windows Intune. Windows Intune takes advantage of the Windows Update
infrastructure, one of the world’s largest cloud services, which delivers
updates every month to hundreds of millions of PCs. And with a financially
backed 99.9 percent uptime service level agreement, you can have confidence
the service will be there when you need it.

how to make chat on php ?

how to read csv file and display its field values on a web page. Complete PHP source code is provided.
Download filetoread.csv file with tab delemited fields. For simplicity the file has only six fields and five records. Create datafeed derictory in your web site root directory and save filetoread.csv file in datafeed directory. Look at the file records.
the PHP file with source code, which reads the csv file is explained below
');
print('Computer electronics');
print('PartnumberProductCompany
LinkPrice');
//declare variable to count records
$rowcount = 0;
//get path to file assumming that file located in datafeed folder
$path_to_file="datafeed/filetoread.csv";
//open file for reading "r"
$handle = fopen($path_to_file, "r");
//read file line by line
while (($record = fgetcsv($handle, 1000, " ")) !== FALSE)
{
// read number of fields in one record
$numfields = count($record);
//Display all fields for debugging, to know which data is in which field.
//In real scv datafeed file of an affiliated program a lot of fields are stored
//data, that you do not need. Using output below you can see what fields to select
//to build your advertisement on your web page

for($i=0; $i<$numfields; $i++) { echo $i.":".$record[$i]."
";
}

//read field values in variable
$part=$record[0];
$number=$record[1];
$product=$record[2];
$company=$record[3];
$clicklink=$record[4];
$price=$record[5];
//skip the first record since it has field headers only
if($rowcount > 0)
{
//if record has link to item display it in the table row
if($record[3] !="")
{
print(''.$part.''.$number.''.$product.'
'.$company.'
'.$product.''.$price.'');
}
}
$rowcount++;
}
fclose($handle);
print('');
?>
Download readcsv.txt file and save it as .php file in your web site root directory.
Download filetoread.csv file with tab delemited fields.
Remove txt extension after downloading files.
In a web page you want to display records from csv file type:

We are done.

how to get php run on a windows shell ?


>Is there a way to execute PL/SQL scripts from PHP? I have PL/SQL scripts
>that utilizes the DBMS_xxx packages. Is it possible to shell out a command
>that will run the PL/SQL? You'll have to define what you mean by 'PL/SQL script'.

Do you mean a PL/SQL block? Just use OCIParse/OCIExecute. There's an example
in the PHP manual.

Or do you mean you have a file containing one or more SQL and/or anonymous
PL/SQL blocks, which you'd normally run with SQL*Plus? And in particular, does
it use any SQL*Plus commands? (e.g. SET, or COLUMN). If so, shell out to
SQL*Plus with system() or exec() or backticks etc.
46. how to get php run on a windows shell
As well as running PHP scripts via a web server such as Apache, you can also run PHP scripts from the command line (it's also possible to write GUI apps with PHP using PHP-GTK, but I'll maybe look at that another time). This post looks at the two ways you can run a PHP script from a *nix based computer (Linux, UNIX, BSD, OSX) and the single way you can do it from Windows.
UNIX shell scripts are set as executable and the first line in the file contains a "shebang" line which shows the path to the executable which will parse the script.
If your distro's PHP binary is at e.g. /usr/bin/php you would add this to the first line of your script:
#!/usr/bin/php
and then have your PHP script under it.
To run a "hello world script" you'd do this:
#!/usr/bin/php
  echo "hello world\n";
The script then needs to be marked as executable. To set it so it can be run as anyone do this:
chmod 0755 /path/to/script.php
To make it so only you can run it (and so no one else can even read it) do this:
chmod 0700 /path/to/script.php
Read the chmod manpage for more details about file permissions if you don't know about them

how can pl/sql execute php ?

>Is there a way to execute PL/SQL scripts from PHP? I have PL/SQL scripts
>that utilizes the DBMS_xxx packages. Is it possible to shell out a command
>that will run the PL/SQL? You'll have to define what you mean by 'PL/SQL script'.

Do you mean a PL/SQL block? Just use OCIParse/OCIExecute. There's an example
in the PHP manual.

Or do you mean you have a file containing one or more SQL and/or anonymous
PL/SQL blocks, which you'd normally run with SQL*Plus? And in particular, does
it use any SQL*Plus commands? (e.g. SET, or COLUMN). If so, shell out to
SQL*Plus with system() or exec() or backticks etc.

help with php ?

Within the PHP section you'll find PHP help, including annotated links to PHP tutorials, PHP programming tutorials, PHP documentation and manuals, PEAR documentation and manuals, PHP basics, scripts, PHP editors, modules and add-ons, template engines, support applications, other PHP tools, plenty of resources, and more related to PHP. You'll also find a listing of recommended books on PHP.
Know of some great PHP help, PHP programming tutorials, tips, tools, documentation, manuals, software, tools, Web sites, books, or other PHP resources.

get directory name of current directory php ?

You can easily get the current directory name at where the script is currently running. The below code will print the current directory name into screen.


$directory = dirname(__FILE__);
print $directory;


How the script works? Here __FILE__ holds the name of the currently executing file. And using finction dirname() its extracting the directory name component from it.

That means if your script name is "test.php", then __FILE__ has something like "c:\work\test.php". The function dirname() just removing that test.php from it, and returning "C:\work\"

free webhost which support php ?

Below are listed free PHP webhosting sites -- free website hosts that allow webmasters to use PHP scripts. Usually the web server provides PHP4 and/or PHP5, but occasionally they even support PHP3 files. Some free PHP hosting servers will even give you free web hosting with free MySQL database. Also see the free PHP hosting services comparison benchmark results which shows a graph chart comparing the webserver speeds (PHP script execution times) of many free PHP hosts.

check if an object has been instantiated in php?

You have to check a variable to see whether it contains an object of the
right type

Thus
-------------------------------------------------------------
Dim X as clsContract

If X is nothing then
MessageBox.Show("There is No Object here")
Endif
X = New clsContract

If Not (X is nothing) then
MessageBox.Show("There is an Object here")
Endif
-------------------------------------------------------------


However the variable you test can be a shared variable within the class.
This is an example of the 'singleton' pattern.

Thus
-------------------------------------------------------------
Public Class clsContract
Private Sub New()
End Sub
Private Shared mSingleton as clsClass
Public Shared Function GetSingleton as clsContract
If mSingleton is nothing then
mSingleton = New clsContract
Endif
return mSingleton
End function
Public Shared function Exists() as boolean
return not (mSingleton is nothing)
End function
End Class
-------------------------------------------------------------

Your button code might then use this
-------------------------------------------------------------
Dim x as clsContract = clsContract.GetSingleton()
-------------------------------------------------------------

This may or may not be what you mean.

Friday, February 25, 2011

How to insert the malware or virus in php website?


There are several  possibilities insert virus in the php website  and the possibilities are as below:

Possibility : 1

Malicious code is being injected in PHP, Javascript and HTML scripts. Website users are downloading malicious code and infecting others.
When you open a website (most probably in IE) which is infected with malicious code, your browser downloads malicious code (which is a trojan/spyware) from the URL specified in the iframe tag or in the source of a script tag ( some times your browser also opens Acrobat Reader). Most of the anti-viruses don't detect this trojan, some only give a warning but don't block it. So when your computer is infected, a trojan residing in your computer steals your ftp passwords when you type them in your ftp program. Using these ftp accounts, the trojan scans all the directories on your ftp server and find files having any of following words in their name
  • main
  • default
  • index
  • home
  • and all the files included at the top of index file
The trojan then injects malicious code into these files and also infects the users visiting your website.

Possibility : 2

This issue is provoked by a Windows Virus that sniffs the internet connection for user names and passwords of ftp accounts. Then it silently download every (or only index/default) files from the remote ftp to the infected Windows PC and then adds the iframe or javascript code and in the end it uploads back the files. So..first of all when removing this virus from the remote servers check your computers. The virus is known as : Trojan.Script.Iframe.

Possibility : 3

.htaccess file automatically put into my site
It got there through some vulnerability or other, most likely your computer being infected with something and the FTP. But it could be a problem with the security of your host or your scripts.

It basically redirects all requests to your site that were directed there from any of the listed sites, that doesn't have the listed words in the user agent and redirects them to the link at the bottom. Based on the expansive list I would guess it's purpose is supposed to be to hijack bots from your site.

Possibility : 4

Some FTP clients store passwords in plain text. Some viruses search for these files and send them "home". I don't know about WinSCP -- although the protocol (SSH) is a lot safer than FTP, I think it still stores passwords in plain text. That's all I can think of right now, if you give more details maybe other ideas will pop out. Be safe.

Possibilty:  5

Virus attack injecting javascript code , malicious or iframe code into the index page

Normally, The virus attacks following files on your server:
 index.php
 index.html
 main.php
 header.php
 footer.php


At the start or end of these files it will insert the  iframe, javascript ,php or malicious encoded code:
Now the forum is "clean".
 In some case, this "virus" make some modification in your database system. Make sure you checked you database and removed any suspicious code.


What it does?

I can only guess. The code is calling a script on online-channels.info site. It can be sending traffic information. Maybe it is a first case of Internet marketing espionage? Or it can be trying to run some malicious code.

What it does?

He save your FTP password, acces you account, and instal in your index files, (Index from all directory) an IFRAME code that will open a virus page in your index of the forum.


How it's done ?

This is a sophisticated operation, and the infection cycle is involved, but basically, the hacker(s) are setting up innocent looking sites (or using previously hacked sites where the owner is usually unaware of being compromised) and loading them with expensive hacking tools like Mpack. When someone visits that site, their browser is detected and attacked (browsers affected are IE, firefox and opera). The visitor is unaware that they may have a keylogger that sends the persons passwords ect to the hacker(s) and moves on. If the innocent visitor has an ftp or root password for any internet sites, the hackers use a program that goes to the persons site(s) and instantly adds the hidden iframe to every index type page. This is why there seems to be no indication that the site has been compromised, as the hackers already have the ftp or root passwords to login. And since they have at least your account ftp pass, whatever permissions your folders and files are set to make no difference.

After they put the iframe code into that person's pages, anyone visiting that site will be redirected to the hackers infection site, where the person's computer will be injected and infected. The hackers are depending on site owners not knowing their sites have been hacked so that the number of hacked sites will grow (as they have starting in Italy) into the tens of thousands... Please don't think you can depend solely on your antivirus software to protect your computer. It more than likely won't help you. For $1000 dollars, the russian hacking bulletin boards are offering Mpack with 1 year support and a GUARANTEE that virus programs will not catch the keyloggers. SO, keep your virus program updated, but don't depend on it completely!
This way this hack is spreading fastly from one computer to another broadcasting the passwords to hackers.During my research in this, I even found some of the password files collected by the hack on some of the hacked server, where they pass this password file to thier tool to add the code. In some cases Google bots picks this files and you can even find the login details of FTP accounts and Server root login details in google.

How Do I got attacked  ??

1. Your computer or a computer you use to administrate your website gets infected with a virus or trojan.
2. That virus or trojan runs a process on the computer searching FTP applications and their databases for username and password combinations or just looking for username and passwords in files on the computer.
3. When a username and password is found, that information is e-mailed, or somehow sent to an individual or a group of individuals.
4. That individual or group of individuals then have access to your account login information. They proceed to connect to your account via FTP using the hostname, username, and password that the trojan/virus provided for them.
5. Once connected to FTP on your account, they download your index page, edit that index page, place a malicious piece of javascript code or iframe code into the index page, then reupload it to your account.
6. Your website is now infected with malicious javascript or iframe code, which can then be used to infect or track other visitors of your website.
Your computer being infected with a virus is not a direct result of your website being infected with a virus, or vice-versa. It is because of the type of virus or trojan that is installed on your computer, that your login information was compromised. This compromised data is what led to your website being infected.
How you got infected (Step 1) is completely up in the air. Perhaps you downloaded a program that was infected. Perhaps you received an e-mail that caused the infection. Perhaps you visited a website that caused the infection. There's really no way to be absolutely certain of how this infection initially took place. The best thing you can do is preventive measures. Keep your anti-virus software up-to-date. Make sure the memory resident of the virus scanner stays running. Do routine virus scans on your computer just to be sure. Use anti-spyware software to keep tabs on possible trojans or key loggers that might be installed on your computer. Practice overall safe web-browsing. I recommend using only Firefox for your web browser and installing the NoScript Firefox addon to help prevent any malicious javascript from running in your browser.
All of this assumes that your account credentials were compromised due to a local virus or trojan. That may not be the case. I would bet that your credentials have been compromised in some way, but even that is not a given. Other ways for your credentials to be compromised is if you leave your username and password written down near your desk at work or at a coffee shop, if you leave it in plain view, someone else may be able to read that information and then your information is compromised. There's really no way to know exactly how the information was compromised.
It's also possible that there was no credential compromise at all. You may have an outdated script installed on your account or on your web server that allowed malicious users to gain access to your account and inject material into your website. You should always make sure that you are running the latest version of any scripts or applications you have on your website to prevent something like this from happening.

What is solution now ? 

If you are facing this problem and your administrator says its only your account, just change the FTP password and it will stop
You must have removed the code as soon as it attack and change the file permission to READ ONLY or CHMODE 444 to make sure it never got attack again. Please Change the FTP Password immediately. Just changing password is not complete solution but is the first step.
Whats next, your password is leaked that means your computer is sending out the passwords, so I would suggest you to do a clean format first and then install any antivirus of spyware which you think could block it. But the best solution is to clean format the computer.
Just do the three things:
1) Change the FTP or root password of server.
2) Clean format the PC.
3)  Forum cleaning. 
You can download file_check.php . Put it in your root of the forum and run it from the adress http://yourforumadress.com/file_check.php .
It usually add that IFRAME code after the "?>" of the PHP code. You`ll get some pages that you need to delete the IFRAME.
Now go to the index.template.php from Themes/your theme directory. Search where the code start, and there you`ll find another IFRAME. Delete it (WARNING! Without '; from after the .).
Now the forum is "clean".
 In some case, this "virus" make some modification in your database system. Make sure you checked you database and removed any suspicious code.

what is php file?

* PHP files can contain text, HTML tags and scripts
* PHP files are returned to the browser as plain HTML
* PHP files have a file extension of ".php", ".php3", or ".phtml"

what is phases of php programming?

We specialize in PHP programming and MySQL databases. We write custom PHP programs and customize PHP/MySQL-based packages like open source software products: WordPress® blogs, osCommerce (open source eCommerce solution), and OpenX, formerly known as phpAdsNew (open source Ad Management solution). We have interfaced osCommerce and custom-developed order forms with payment gateways like AuthorizeNet®.

Sampling of Custom PHP Programming

* Blog Preview Window
* Dynamic Selection Fields
* Content Maintenance Module
* PHP Dynamic Site Plan
* Search Within Radius

Blog Preview Window
Blog Preview WindowChris Ploof Studio of Pawtucket RI creates custom, one-of-a-kind jewelry for clients worldwide.

hired Adventures Online to install and customize a blog for his website. At the same time, he wanted to add a blog preview window on the Home page to let people know that he is blogging about all the exciting news about his business.

Solution
Adventures Online installed and customized a WordPress® blog, then wrote a custom PHP program that reads the latest post in the blog and displays the first 25 words of the post in the preview window on the Home page (circled, left). Included in the blog preview is a link to the full post. When the link is clicked, the blog displays with the full post at the top

Dynamic Selection Fields
Vehicle Selection FormThe Lube Dudes of Marlborough MA provides on-site vehicle maintenance to fleets and corporate employees throughout Eastern Massachusetts.

The Lube Dudes hired Adventures Online to design and develop a website for them. In addition to the brochure-type portion of the website, The Lube Dudes wanted a Customers-Only section where new customers could sign up online, create a personal profile and build a portfolio of their verhicles, and, existing customers could login, manage their vehicle portfolio and schedule maintenance for their vehicles.

The Lube Dudes had a special requirement for the Add a Vehicle process, and that was that the choices displayed in the Year, Make, and Model selection pull-down lists be “valid”choices; meaning that the list of Years could only include the list of years that the The Lube Dudes would service, and the list of Makes could only include the Makes that existed in the Year the customer had just selected, and that the list of Models could only include models available in the year:make combination that the customer had just selected. Because each customer would choose different year-make-model combinations and those combination were impossible to predict, the selection fields needed to be dynamically-generated based on the current customer’s selections.

Solution
When the website was launched, there were nearly 12,000 Year-Make-Model combinations that The Lube Dudes were interested in servicing.

1. A custom PHP program was written to insert the initial ~12,000 year-make-model combinations into the online database.
2. An online module was created so that The Lube Dudes could maintain (add, change and delete) year-make-model combinations.
3. Custom PHP programs were written to extract Year-Make-Model combinations to text files. (The text files are used to load the Year, Make, Model selection fields.)
4. JavaScript programs were written to determine which text files to use to load the correct selections in the Year, Make and Model fields.

Adventures Online used a combination of PHP and JavaScript to develop the programming and a MySQL database to store the data.



Custom Content Maintenance Module
PHP programming example Hudson MAReal estate investment manager, Calare Properties of Hudson MA hired Adventures Online to redesign its website. In addition to the redesign, Calare Properties wanted to add functionality – to display its portfolio of properties. They also wanted the ability for staff to maintain the portfolio and have the updates be immediately visible on the website.

Solution
Adventures Online redesigned the website and added menu items for viewing the portfolio of properties. Display pages were created for each individual property, each state and the United States (shown above). The content on those pages changes dynamically according to what the staff enters in the online database. An online maintenance module was created to enable staff to keep the list of properties and descriptions of individual properties up to date. The updates (adds, deletes, changes) are immediately visible on the website.

PHP programs were used to develop the custom content maintenance module. JavaScript was used to validate the information on the data entry forms in the maintenance module, and, a MySQL database stores the portfolio and information about the individual properties. View the portfolio of properties. [US Map creation by MannisMacNeil Design Group.]



PHP Radius Search
Website for Non-Profit AssociationThe American Society of Home Inspectors, New England Chapter (ASHINE), hired Adventures Online to redesign its website. In addition to the website redesign, the association wanted to add the ability for visitors to find home inspectors (ASHI New England members) in their own geographical area.

Business Requirements

1. Allow visitors to search by three different criteria on the Home page; by zip code, city & state, and state alone
2. Include home inspectors within a 10-mile radius of the zip code or city-state in the search results.
3. Include all home inspectors in the state in the search results of a state search.
4. Provide an Advanced Search page on which visitors are able to search by inspector’s business name or last name, and can change the radius (number of miles to include) in order to manipulate the search results.

Solution
A MySQL database was created to store ASHINE’s membership information. Multiple custom PHP programs were written to interface ASHINE’s membership database with a commercially-available US zip code database in order to return the correct results. Try out the Advanced Search!



PHP Dynamic Site Plan
PHP Dynamic Site PlanSteve McKenna & The Home Advantage Team, Arlington MA, the exclusive real estate sales team for Prescott Farms in Bedford MA, hired Adventures Online to bring life to the online Prescott Farms site plan. Although the plan is a simple drawing, there are highly complex, multi-tiered PHP programs running behind the scenes that make the site plan respond differently depending on the phase of the build, the clicking actions of the current viewer and the status of the lot that is clicked.

Business Requirements

1. Website visitors should be able to:
* Quickly understand which lots are available with just a glance at the plan
* Click on each lot and learn the details about it, like the size of the lot, the home styles that can be built on it and the asking price for each home style
* Click on each home style to see the details of the home style, like see a rendering of the floor plan, a written description of the style and the parameters for customization.
2. Staff should be able to:
* Change the status of a lot at any time
* Update information about each lot – like the size and the styles of homes that can be built on the lot
* Open and close phases of the build
* Add and remove lots from phases
3. Updates should be immediately visible on the website.

Solution

1. Assign colors to the different statuses that a lot can have. Add a legend to the site plan. *
2. Create four graphics for each lot, one in each color (status) . *
3. Create an online MySQL database to store the status and other information about each lot
4. Write custom spreadsheet-like PHP programs to enable staff to update (add, change, delete) the status of the lots, the detailed information about each lot, the phase of the build, and the lots included in each phase.
5. Write JavaScript scripts and PHP programs to determine which colored graphic of a lot to display on the site plan
6. Write custom PHP programs to dynamically display a lot’s details (lot size, house styles available for this lot, and pricing for each house style on the lot) -depending on its status
7. Write custom PHP programs to dynamically display information about each house style (like a rendering of the floor plan, a written description of the style, and customization parameters).

This is an ideal application for high-end real estate agents with exclusive agreements on new home developments!

* Graphic design by Circle Graphics, Hingham MA

[In February 2009 all the lots were sold and the website was removed.]

Other PHP Programming Efforts

Personal Best Personal Training, Marlborough MA
Besides being an attractive and informative website, this website has a very robust backend that helps the owner communicate with her clients and manage her business. There is a password-protected Administration Module that the owner uses to monitor clients’ progress, manage health forms processing, and produce reports. Also in the backend, there is a password-protected Members-Only section where members enter food and exercise logs, have access to special fitness articles and the online encyclopedia of exercises, download fitness programs, enter the comprehensive intake forms, and more.

Over 30 PHP programs and two MySQL databases were used to create the Adminsitrative and Members-Only modules.

Regional Chamber of Commerce, Marlborough MA
The Chamber wanted to display the membership list in small, discrete packages. Adventures Online used PHP to interface with a MySQL database to group, retrieve and display information about Chamber members. Try it out!

In the backend, there is a Maintenance Module which the Chamber uses to maintain its Calendars of Events and lists of Directors and Officers. As soon as updates are made to either of these, they are visible on the website, and, since the maintenance module is at the website, staff can make updates any time they want from wherever they are. The Calendars and lists of Directors and Officers are dynamically generated from the MySQL database each time they are viewed.

PHP Online Schedule Maintenance
Turfbuilder Marketing hired Adventures Online to work with Marita Froimson Design to bring life to a website re-design project for its client WAC Consulting in Northborough MA.

php tutorial how to get the array number of an array item?

PHP Tutorials : Arrays
In this PHP Tutorial you will learn about Array basics, Creating an array, Creating a numeric array and Finding the Size of an Array.
Array basics:
An array is made up of elements. Each element has a key and a value. An array holding information about the GPAs of a student has courses names for keys and GPAs for values:

Course GPA
Introduction to computer A
Introduction to programming B+
Discrete structure B
Computer organization A-
An array can only have one element with a given key. In the GPA array, there can't be another element with the key Discrete structure even if its value is B. However, the same value can appear many times in one array.

Creating an array:
To create an array, assign a value to a particular array key. Array keys are denoted with square brackets.

Example:

// An array called $fruits with string keys
$fruits[‘Apple’] = ‘red’;
$fruits[‘Banana’] = ‘yellow’;
$fruits[‘orange’] = ‘orange’;

You can also create an array using the array( ) language construct.

Example:

$fruits = array(‘Apple’ => ‘red’,
‘Banana’=> ‘yellow’,
‘orange’=> ‘orange’);

With array( ), you specify a comma-delimited list of key/value pairs.
The key and the value are separated by =>.
The square bracket syntax is better when you are adding elements one by one.

Creating a numeric array:
PHP provides some shortcuts for working with arrays that have only numbers as keys.
If you create an array with array( ) by specifying only a list of values instead of key/value pairs, the PHP interpreter automatically assigns a numeric key to each value.
The keys start at 0 and increase by 1 for each element.

Example:

$fruits = array(‘apple’, ‘banana’, ‘orange’);
print “I want an $fruits[0].";

This will print ‘I want an apple.’

PHP automatically uses incrementing numbers for array keys when you create an array or add elements to an array with the empty brackets syntax.

Example:

// This sets $fruits[0]
$fruits[] = ‘apple’;

// This sets $fruits [1]
$fruits[] = ‘banana’;

// Create $fruits with three elements
$fruits = array(‘apple’, ‘banana’, ‘orange’);

// Add an element to the end of $fruits
// This sets $fruits[3]
$fruits[] = ‘pineapple’;

The empty brackets add an element to the array.

The element has a numeric key that's one more than the biggest numeric key already in the array.
If the array doesn't exist yet, the empty brackets add an element with a key of 0.

Finding the Size of an Array:
To find the size of an array, use the function count().
count() takes one argument, which is the array, and returns an integer represents the number of the elements of this array.

how to read from weighbridge using php ?

am trying to get an image file to display in an email, the file is stored on the server but it will not send the file with the email. i have been working on this code now for a few days and i cannot get it to work.

the files that i need displaying change so i have incorporated an array to get the file extension, the email is sent with all the text and images which have been coded in using the absolute file path but the images i want to get from the if file exists function will no show.

here is the code for the file exist if anyone can see why this is not working please show me.

PHP Syntax (Toggle Plain Text)

1.
$image = "";
2.
$web_image_folder = 'http://www.acmeart.co.uk/mercury/image/thumbs';
3.
$exts = array('jpg', 'png', 'gif', 'jpeg');
4.
$image_name = 'thumb_image1';
5.

6.

7.
// check for each extension
8.
foreach($exts as $ext) {
9.
if (file_exists($web_image_folder.'/'.$image_name.'.'.$ext)) {
10.
$image = $image_name.'.'.$ext;
11.
}
12.
}
13.

14.
// check if we have an image
15.
if ($image != "") {
16.
// ok we have the image
17.
$broad_img1='';
18.
} else {
19.
// error, we can't find the image.
20.
}

how to php code a list from a csv file?

CSV is a type of file. It means Comma Separated Values. Spreadsheets software like Excel will offer you the opportunity to save files with the CSV extension. We'll see how to work with these types of files now.
The image below shows an Excel spreadsheets. It's just a simple price list:

The next image shows the spreadsheet being saved as a CSV file:

And here's what the data looks like in a text editor:

The above CSV file is the one we want to work with. It shows each line separated by commas.
PHP has a function that allows you to work with CSV file. It's called fgetcsv( ). It's just like the fgets function you used earlier. The difference is that fgetcsv( ) separates each line on the commas, and puts each part into an array. Before trying the next code, make sure you copy the widgets.csv file, from the ones you downloaded, over to the same folder where your script is. The widgets.csv file is in the scripts folder. Here's the code:

";
}
fclose($file_handle);
?>
When you run the script, you should see all the lines of text printed out. Here's how it works.
The first two lines you've already met: get a handle to the file you want to open, then create a while loop to loop round it.
$file_handle = fopen("widgets.csv", "r");
while (!feof($file_handle) ) {
}
Inside the while loop, though, we have our fgetcsv line:
$line_of_text = fgetcsv($file_handle, 1024);
In between the round brackets of fgetcsv, we've typed to things: our file handle, and the size of the line to read. The size, in this case, is 1024 - 1 kilobyte. You can change this value. When the function gets the line of text, it puts it into the variable we've called $line_of_text.
But $line_of_text will now be an array. Each line of our text file looks like this:
Widget1, blue, £10
The fgetcsv function will split this line when it sees the comma. It then creates a position in the array to hold each part of the line. So it will set up an array with three positions, in our case. Those positions will be as follows:
$line_of_text[0]
$line_of_text[1]
$line_of_text[2]
To print it all out, we had a this line:
print $line_of_text[0] . $line_of_text[1]. $line_of_text[2] . "
";
All we're doing here is to print out what is in each position of the array. We've then added a HTML line break, just for display purposes.
If you have CSV files from a spreadsheet that you need to display on a web page, the fgetcsv function can come in quite handy!

how to php ?

PHP is a simple, object-oriented, interpreted, robust, secure, very high-performance, architecture neutral, portable, dynamic scripting language. PHP has "class" keyword similar to Java's "class" keyword. And PHP is designed such that it is 5 times faster than Java, since there is no virtual machine. PHP is very fast becoming a standard, general purpose, object oriented scripting language. PHP is not only meant for web applications but also can be used for developing general applications.

PHP is the next big thing after HTML because today nobody writes static HTML but uses PHP (generate on the fly, embedded dynamic HTML). PHP 'kind-of' supercedes "static HTML". PHP is a very powerful scripting language. PHP will overtake PERL/Python and will replace PERL/Python. PHP is the next-generation PERL/Python scripting. PHP can do whatever PERL or Python does and actually does much more, much better and much, much cleaner.

PHP stands for 'Hypertext Pre-Processor' and is a server side HTML scripting/programming language. PHP is C-like Web scripting language runs on Apache, Netscape/iPlanet, and Microsoft IIS Web servers. PHP is a tool that lets you create dynamic web pages. PHP-enabled web pages are treated just like regular HTML pages and you can create and edit them the same way you normally create regular HTML pages. PHP lets you write simple scripts right in your HTML files much like JavaScript does, except, unlike JavaScript PHP is not browser-dependant. JavaScript is a client-side html-embedded language while PHP is a server-side language. PHP is similar in concept to Netscape's LiveWire Pro product and Microsoft's ASP and Sun Microsystem's JSP.

PHP is not only used for creating web applications, but also for creating general standalone applications.

PHP's strength are :

* PHP is the most superior technology. Other technologies PERL, Python, Tcl, VB script, ASP are older and inferior technologies. Even Java/JSP is inferior to PHP.
* Open source
* Easily learned syntax
* Broad database connectivity
* Massive library of contributed extensions
* General purpose scripting language much superior to PERL, VB script, ASP, JSP.

php who is online now?

Step1: Creating the database
create a new database called 'users', with 3 fields inside a table. These fields are timestamp, ip and file. Name the table useronline by the way. Now with the form on the PhpMyAdmin page, add the following code:

view source
print?
1 CREATE TABLE useronline (
2 timestamp int(15) DEFAULT '0' NOT NULL,
3 ip varchar(40) NOT NULL,
4 file varchar(100) NOT NULL,
5 PRIMARY KEY (timestamp),
6 KEY ip (ip),
7 KEY file (file)
8 );

Step 2: The PHP Script
view source
print?
01 ";
24 }
25
26 //delete values when they leave
27 $delete = mysql_db_query($database, "DELETE FROM useronline WHERE timestamp<$timeout"); 28 if(!($delete)) { 29 print "Useronline Delete Failed > ";
30 }
31
32 //grab the results
33 $result = mysql_db_query($database, "SELECT DISTINCT ip FROM useronline WHERE file='$PHP_SELF'");
34 if(!($result)) {
35 print "Useronline Select Error > ";
36 }
37
38 //number of rows = the number of people online
39 $user = mysql_num_rows($result);
40
41
42 //spit out the results
43 mysql_close();
44 if($user == 1) {
45 print("$user user online\n");
46 } else {
47 print("$user users online\n");
48 }
49 ?>

I've tried to make that code as simple as possible to understand. The //comment won't affect the script, so you can remove those if you want. The script basically works like this. It receives server information and gets he time. In mySQl it fills in the values of the person online and puts up a message if it failed. When the user leaves mySQL deletes the user and displays a message if it failes.

where do headers go in a php script?

Description
void header ( string $string [, bool $replace = true [, int $http_response_code ]] )

header() is used to send a raw HTTP header. See the » HTTP/1.1 specification for more information on HTTP headers.

Remember that header() must be called before any actual output is sent, either by normal HTML tags, blank lines in a file, or from PHP. It is a very common error to read code with include(), or require(), functions, or another file access function, and have spaces or empty lines that are output before header() is called. The same problem exists when using a single PHP/HTML file.


Report a bug
Parameters

string

The header string.

There are two special-case header calls. The first is a header that starts with the string "HTTP/" (case is not significant), which will be used to figure out the HTTP status code to send. For example, if you have configured Apache to use a PHP script to handle requests for missing files (using the ErrorDocument directive), you may want to make sure that your script generates the proper status code.



For FastCGI you must use the following for a 404 response:


The second special case is the "Location:" header. Not only does it send this header back to the browser, but it also returns a REDIRECT (302) status code to the browser unless the 201 or a 3xx status code has already been set.


replace

The optional replace parameter indicates whether the header should replace a previous similar header, or add a second header of the same type. By default it will replace, but if you pass in FALSE as the second argument you can force multiple headers of the same type. For example:


http_response_code

Forces the HTTP response code to the specified value. Note that this parameter only has an effect if the string is not empty.

Report a bug
Return Values

No value is returned.

Thursday, February 24, 2011

php help broderbund?

PHP, which stands for \"Hypertext Preprocessor\", is a server-side, HTML embedded scripting language used to create dynamic Web pages. Much of its syntax is borrowed from C, Java and Perl with some unique features thrown in. The goal of the language is to allow Web developers to write dynamically generated pages quickly. In an HTML page, php code is enclosed within special php tags.

Read more: http://business.ezinemark.com/a/broderbund-support-in-php/#ixzz1EssJ8hOw
Under Creative Commons License: Attribution No Derivatives

how to use php ?

Taken directly from PHP's home, PHP.net, "PHP is an HTML-embedded scripting language. Much of its syntax is borrowed from C, Java and Perl with a couple of unique PHP-specific features thrown in. The goal of the language is to allow web developers to write dynamically generated pages quickly."

This is generally a good definition of PHP. However, it does contain a lot of terms you may not be used to. Another way to think of PHP is a powerful, behind the scenes scripting language that your visitors won't see!

When someone visits your PHP webpage, your web server processes the PHP code. It then sees which parts it needs to show to visitors(content and pictures) and hides the other stuff(file operations, math calculations, etc.) then translates your PHP into HTML. After the translation into HTML, it sends the webpage to your visitor's web browser.

how to open php pictures?

PHP - File Upload: HTML Form Before you can use PHP to manage your uploads, you must first build an HTML form that lets users select a file to upload. See our HTML Form lesson for a more in-depth look at forms. HTML Code: form enctype="multipart/form-data" action="uploader.php" method="POST" input type="hidden" name="MAX_FILE_SIZE" value="100000" Choose a file to upload: input name="uploadedfile" type="file" input type="submit" value="Upload File" form Here is a brief description of the important parts of the above code: * enctype="multipart/form-data" - Necessary for our to-be-created PHP file to function properly. * action="uploader.php" - The name of our PHP page that will be created, shortly. * method="POST" - Informs the browser that we want to send information to the server using POST. * input type="hidden" name="MA... - Sets the maximum allowable file size, in bytes, that can be uploaded. This safety mechanism is easily bypassed and we will show a solid backup solution in PHP. We have set the max file size to 100KB in this example. * input name="uploadedfile" - uploadedfile is how we will access the file in our PHP script. Save that form code into a file and call it upload.html. If you view it in a browser it should look like this: Display: Choose a file to upload: After the user clicks submit, the data will be posted to the server and the user will be redirected to uploader.php. This PHP file is going to process the form data and do all the work. PHP - File Upload: What's the PHP Going to Do? Now that we have the right HTML form we can begin to code the PHP script that is going to handle our uploads. Typically, the PHP file should make a key decision with all uploads: keep the file or throw it away. A file might be thrown away from many reasons, including: * The file is too large and you do not want to have it on your server. * You wanted the person to upload a picture and they uploaded something else, like an executable file (.exe). * There were problems uploading the file and so you can't keep it. This example is very simple and omits the code that would add such functionality. PHP - File Upload: uploader.php When the uploader.php file is executed, the uploaded file exists in a temporary storage area on the server. If the file is not moved to a different location it will be destroyed! To save our precious file we are going to need to make use of the $_FILES associative array. The $_FILES array is where PHP stores all the information about files. There are two elements of this array that we will need to understand for this example. * uploadedfile - uploadedfile is the reference we assigned in our HTML form. We will need this to tell the $_FILES array which file we want to play around with. * $_FILES['uploadedfile']['name'] - name contains the original path of the user uploaded file. * $_FILES['uploadedfile']['tmp_name'] - tmp_name contains the path to the temporary file that resides on the server. The file should exist on the server in a temporary directory with a temporary name. Now we can finally start to write a basic PHP upload manager script! Here is how we would get the temporary file name, choose a permanent name, and choose a place to store the file. PHP Code: // Where the file is going to be placed $target_path = "uploads/"; /* Add the original filename to our target path. Result is "uploads/filename.extension" */ $target_path = $target_path . basename( $_FILES['uploadedfile']['name']); NOTE: You will need to create a new directory in the directory where uploader.php resides, called "uploads", as we are going to be saving files there. We now have all we need to successfully save our file to the server. $target_path contains the path where we want to save our file to.

how to install php?

This tutorial discusses the setup of Apache, PHP and MySQL for both Windows and Red Hat Linux. Because the install for Windows is straightforward, the discussion for Windows is an overview. The tutorial and how to for Red Had Linux is much more detailed and covers both downloading and installing packages as well as using Apache's DSO Module. Overall, more people ask about installing Apache, PHP and MySQL on their local Windows computer because their web hosting company takes care of the install on their web server. A common set-up for web site programmers is their localhost environment is Windows and the web server is Linux. This is an effective set-up. Installing Apache, PHP, MySQL on Windows Computers Installation of Apache, PHP and MySQL is straightforward for Windows computers. Go to each of the Apache, PHP and MySQL sites to download the software. Select the appropriate ZIP file. Pick the versions that match your web server. You will have to modify your ini and configuration files as described in the install READMEs, but you do not have to worry about DSO modules, compiling, etc. as discussed for Linux below. I have omitted detailed discussion of changes to local files because different versions of PHP, MySQL and Apache have different requirements. Most web sites are hosted on a web server that hosts many sites. In most cases your site will be hosted with standard PHP, MySQL, Apache configurations. On your localhost (your own computer), you should not deviate too far from the configuration of your web hosting server. Otherwise, you will find yourself in the common programmer situation of saying ”well it works on my machine.” (More help about this subject is in my web hosting for developers article.) One of the great things about PHP and MySQL is many web hosting companies provide them at reasonable prices. So, install Apache, PHP and MySQL on your machine, write some code test it and upload it to a real web server for all the world to see. Installing Apache, PHP, MySQL for Red Hat Linux Installation is similar on other Linux distributions. The tutorial below covers two approaches. The first discussed is downloading and installing packages. How to use Apache's DSO Module is discussed second. The following tutorial was written for then current (year 2000) versions. For complete information regarding installation, especially if there are new versions released, you should read the install notes for each of the packages. This tutorial assumes you are running Linux and it is installed properly. For help with installing and configuring Linux check out some of the related links at the bottom of this page. Download the Packages First download the required packages to a directory. If you are running a different platform be sure to download the appropiate files for your platform: * Apache download * PHP download * MySQL download Extract the Apache and PHP package into that directory using # tar xfz apache_1.3.14.tar.gz # tar xfz php_4.0.3pl1.tar.gz Note: The pound sign # is the system prompt. You type in only what is after it . Installing MySQL MySQL is easiest to install on Red Hat systems using the RPM packages. To install MySQL in the same directory as the RPM packages use the command: # rpm -Uvh *.rpm Note: You most likely need to do this as the root user. Either log in or su to root. After MySQL is installed you need to set the root password. To do this use the following commanding changing my_password to the password you want for the root user to access MySQL. # mysqladmin -u root password 'my_password' Note: If the MySQL service is not running, you may have to start it by hand before trying to set the password. It should start automatically when the computer boots. The command to start MySQL is: # /etc/rc.d/init.d/mysqld start You can test the MySQL installation by doing the following: # mysql mysql (connect to mysql database) Enter Password: mysql> SELECT * FROM user; (grab some data out of user table) This should return the data in the user table. Type exit to leave. Installing Apache with PHP Apache with PHP can be installed a few different ways. One way is to statically embed the PHP binary into the Apache binary. This is probably the fastest and best way to run PHP. You can also install PHP as a DSO module (see below) Here are the step by step directions to install Apache and PHP in the directory /usr/local/apache In Apache src directory (apache_1.3.14/) # ./configure --prefix=/usr/local/apache In PHP src directory (php-4.0.3pl1/) # ./configure --with-mysql \ --with-xml \ --enable-track-vars \ --with-apache=../apache_1.3.14 \ # make # make install In Apache src directory (apache_1.3.14) # ./configure --prefix=/usr/local/apache \ --enable-module=rewrite \ --activate-module=src/modules/php4/libphp4.a # make # make install This will install Apache in the /usr/local/apache directory. The only thing left to do is to configure them. Configuring Apache and PHP To configure PHP copy php.ini-dist which is in the PHP src directory to /usr/local/lib/php.ini Edit this file setting the options you wish, generally nothing needs to be edited. However, you can set various options such as a default MySQL username and password. To configure Apache edit /usr/local/apache/conf/httpd.conf and set the your document directory and any other Apache settings you may want. To enable Apache and PHP to work together the following line needs to be added: AddType application/x-httpd-php .php Look for this line or something similar already in the httpd.conf file and replace it with the above. Make sure to remove the # comment mark. After editing the config file you need to restart Apache. The command to restart Apache is: /etc/rc.d/init.d/httpd restart To test that Apache and PHP work together, create a PHP file. Name it test.php. The entire contents of the file are: Copy this file to the document directory, if you did not change the document directory in the config file (httpd.conf) then the default document directory is /usr/local/apache/htdocs/ Load this page in your browser by using the following URL: http://localhost/test.php You should now have Apache, PHP and MySQL all installed and working nicely together. To see how to write a web application using this setup check out my Web Database Tutorial. Installing Apache and PHP Using Apache's DSO Module Another way to install Apache and PHP is by using Apache's DSO module. Apache supports adding modules on instead of embedding them in the httpd binary. This works well when you don't want to re-compile Apache each time a module is updated, or if you want to add on numerous modules for development purposes. Compile Apache with DSO support In Apache src directory (apache_1.3.14) # ./configure --prefix=/usr/local/apache \ --enable-module=so --enable-module=rewrite $ make $ make install Install PHP as a Module In PHP src directory (php_4.0.3pl1) # ./configure --with-mysql \ --with-xml \ --enable-track-vars \ --with-apxs=/usr/local/apache/bin/apxs # make # make install This will install Apache and then install the PHP module into the appropiate Apache directories. The only difference in configuration from above is the module needs to be added in the Apache httpd.conf file. To add a module in Apache add the following line in the httpd.conf file (if it is not already there, sometimes the install script adds it for you) LoadModule php4_module libexec/libphp4.so Be sure to following the rest of the configuration instructions above

php if else && ?

The if...else Statement

Use the if....else statement to execute some code if a condition is true and another code if a condition is false.
Syntax
if (condition)
code to be executed if condition is true;
else
code to be executed if condition is false;
Example

The following example will output "Have a nice weekend!" if the current day is Friday, otherwise it will output "Have a nice day!":
html
body



body
html

If more than one line should be executed if a condition is true/false, the lines should be enclosed within curly braces:
html
body



body
html

Wednesday, February 23, 2011

php if else ?

Use the if....else statement to execute some code if a condition is true and another code if a condition is false.
Syntax
if (condition)
code to be executed if condition is true;
else
code to be executed if condition is false;
Example

The following example will output "Have a nice weekend!" if the current day is Friday, otherwise it will output "Have a nice day!":
html
body



body
html

If more than one line should be executed if a condition is true/false, the lines should be enclosed within curly braces:
html
body



body
html

php crash when 2 clients at same time ?

Having an issue that is specific to PHP compiled with PGSQL support
with versions noted in subject line. I understand that there are many
variables to consider here but believe I have narrowed down the Apache
Client Cert failures to my PHP/PGSQL build.

1. Apache PHP without PGSQL works as expected using client certificates

2. Apache PHP with PGSQL works fine with standard SSL connections

3 Apache PHP with PGSQL fails with client certificates - no output

other than Segmentation faults in the apache error logs as follows:

[Wed Nov 30 23:26:57 2005] [notice] suEXEC mechanism enabled (wrapper:
/usr/sbin/suexec2)....

I also performed same tests on another instance of Apache/PHP/PGSQL
which was version 2.0.54 of apache and PHP/PGSQL versions same as
subject line with same exact results.

Any ideas as to the source of this problem and suggestions for
tests/fixes are greatly appreciated. There are no errors in any of the
logs other than what I have included so it's very difficult to see what
is wrong. All I know for sure is that I am able to reproduce the
results on more than one machine.

php if statement?

The if construct is one of the most important features of many languages, PHP included. It allows for conditional execution of code fragments. PHP features an if structure that is similar to that of C:

if (expr)
statement

As described in the section about expressions, expression is evaluated to its Boolean value. If expression evaluates to TRUE, PHP will execute statement, and if it evaluates to FALSE - it'll ignore it. More information about what values evaluate to FALSE can be found in the 'Converting to boolean' section.

The following example would display a is bigger than b if $a is bigger than $b:
$b)
echo "a is bigger than b";
?>

Often you'd want to have more than one statement to be executed conditionally. Of course, there's no need to wrap each statement with an if clause. Instead, you can group several statements into a statement group. For example, this code would display a is bigger than b if $a is bigger than $b, and would then assign the value of $a into $b:
$b) {
echo "a is bigger than b";
$b = $a;
}
?>

If statements can be nested infinitely within other if statements, which provides you with complete flexibility for conditional execution of the various parts of your program.

php if ?

The if statement is necessary for most programming, thus it is important in PHP. Imagine that on January 1st you want to print out "Happy New Year!" at the top of your personal web page. With the use of PHP if statements you could have this process automated, months in advance, occuring every year on January 1st.

This idea of planning for future events is something you would never have had the opportunity of doing if you had just stuck with HTML.
If Statement Example

The "Happy New Year" example would be a little difficult for you to do right now, so let us instead start off with the basics of the if statement. The PHP if statement tests to see if a value is true, and if it is a segment of code will be executed. See the example below for the form of a PHP if statement.
PHP Code:

$my_name = "someguy";

if ( $my_name == "someguy" ) {
echo "Your name is someguy!
";
}
echo "Welcome to my homepage!";

Display:
Your name is someguy!
Welcome to my homepage!

Did you get that we were comparing the variable $my_name with "someguy" to see if they were equal? In PHP you use the double equal sign (==) to compare values. Additionally, notice that because the if statement turned out to be true, the code segment was executed, printing out "Your name is someguy!". Let's go a bit more in-depth into this example to iron out the details.

* We first set the variable $my_name equal to "someguy".
* We next used a PHP if statement to check if the value contained in the variable $my_name was equal to "someguy"
* The comparison between $my_name and "someguy" was done with a double equal sign "==", not a single equals"="! A single equals is for assigning a value to a variable, while a double equals is for checking if things are equal.
* Translated into english the PHP statement ( $my_name == "someguy" ) is ( $my_name is equal to "someguy" ).
* $my_name is indeed equal to "someguy" so the echo statement is executed.

A False If Statement

Let us now see what happens when a PHP if statement is not true, in other words, false. Say that we changed the above example to:
PHP Code:

$my_name = "anotherguy";

if ( $my_name == "someguy" ) {
echo "Your name is someguy! br";
}
echo "Welcome to my homepage!";

Display:
Welcome to my homepage!

Here the variable contained the value "anotherguy", which is not equal to "someguy". The if statement evaluated to false, so the code segment of the if statement was not executed. When used properly, the if statement is a powerful tool to have in your programming arsenal!