tag:blogger.com,1999:blog-6675200584657744372024-03-14T10:12:40.377+00:00Codes For UsPersonal Findings For The Rest Of UsPeter Joneshttp://www.blogger.com/profile/03192918305428815983noreply@blogger.comBlogger73125tag:blogger.com,1999:blog-667520058465774437.post-60898447303694054762019-09-27T23:08:00.002+01:002019-09-30T23:04:37.833+01:00On Few Recent Errors in Linux Mint Virtualisation<div style="text-align: justify;">
Until Linux Mint 17 there were no issues installing Linux Mint on an Oracle VirtualBox. They worked seamlessly together. Though there was no option specifically for Linux Mint distributions, one could have them as the "Other Linux" or just as the "Ubuntu Linux" since Mint is based on the Ubuntu kernel.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
From the Mint 18 distribution a new problem arose. Mint 18 could not find the graphics hardware offered for the guest operating from the VirtualBox. We had this error,</div>
<div style="text-align: justify;">
<br /></div>
<h4 style="text-align: center;">
"Cinnamon Running in software rendering mode Cinnamon is currently running without video hardware acceleration and, as a result, you may observe much higher than normal CPU usage. There could be a problem with your drivers or some other issue. For the best experience, it is recommended that you only use this mode for troubleshooting purposes."</h4>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
or something similar to that. This is no fault of the Linux Mint. It is due to the fact that Oracle VirtualBox tries to default to VBoxSVGA from what has been used to be, i.e., default to VMSVGA.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
VBoxSVGA works fine for the Windows operating Systems, but still fails for all the Linux Mint and Ubuntu.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
If you are using the old VBoxVGA (note the difference with VBoxSVGA) for the Windows guests, then the VirtualBox gives a warning asking you to change it to VBoxSVGA. <b>"The virtual Machine Execution May run into an error … ."</b></div>
<b></b><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEibSMWTZvoe_W__6QCQJjnUTLiWKO88hbrozx_TWVT6vFcM1pAqSxGJ7yJeFDWyj457vDxTey2zdp9jy3i2XtefuDrGUi_4FdmMgzWyfvb-qdJdd6Lp39_xRcQLhkizAO9HeALB5GPzkT8/s1600/SVGAError.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="373" data-original-width="263" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEibSMWTZvoe_W__6QCQJjnUTLiWKO88hbrozx_TWVT6vFcM1pAqSxGJ7yJeFDWyj457vDxTey2zdp9jy3i2XtefuDrGUi_4FdmMgzWyfvb-qdJdd6Lp39_xRcQLhkizAO9HeALB5GPzkT8/s320/SVGAError.PNG" width="225" /></a></div>
<br />
<br />
For Windows easily power off the machine and go to the setting of that machine and change display setting to VBoxSVGA.<br />
<br />
However, For Linux Mint and Ubuntu Graphic accelerator should be set to VMSVGA at this date until all the bugs removed for the VBoxSVGA.<br />
<br />
Another point is, as you do not use VBoxSVGA, as the result the option, "Auto re-size Guest Display" won't become enabled. You are not able to enjoy the "maximise" option of the window pane that is available on your screen.<br />
<br />
To solve this you need to install virtual box guest addition. You do not need to use a terminal. Mint and Ubuntu run automatically the guest addition similar to Windows operating system.<br />
<br />
If before the installation you have increased the graphics memory to 256 MB then you also may receive this message:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi1-kcWSo8NY16Nt3eh0tuYaWe8gLYg3MZDD_oDhjoFEMo_rd0lF3yio4oGkn9SqQ_WeI_vn5tBMB5ZNVc196jObQk_bJwzRF4GyezJBEXIotMzAelheDtWPoFBCO7VtYeO5hycMnvTZLw/s1600/virtual123.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="274" data-original-width="436" height="251" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi1-kcWSo8NY16Nt3eh0tuYaWe8gLYg3MZDD_oDhjoFEMo_rd0lF3yio4oGkn9SqQ_WeI_vn5tBMB5ZNVc196jObQk_bJwzRF4GyezJBEXIotMzAelheDtWPoFBCO7VtYeO5hycMnvTZLw/s400/virtual123.PNG" width="400" /></a></div>
<br />
Then do not try to debug, but click on "OK" and reduce the graphic memory back to 128MB.<br />
<br />
After installation you can increase that memory to 256 MB again.<br />
<br />
In case you do not know how to increase the graphics memory from 128 to 256 MB, you can edit the myvirtual.vbox (where myvirtual is the name of you virtual machine.) or you can do it in the easier way through the setting of the virtual machine.<br />
<br />
First increase the number of screen to eight. The virtual machine allows a 256 MB to be selected. Then click "OK" on the Setting to close it. Immediately, open the Setting again and decrease step by step (one by one) back to one screen. Then again click on "OK" to close the setting.<br />
<br />
<br />
<br />
<br />
<br />Peter Joneshttp://www.blogger.com/profile/03192918305428815983noreply@blogger.com0tag:blogger.com,1999:blog-667520058465774437.post-41794146824468126112018-12-01T15:32:00.000+00:002019-01-16T16:56:40.426+00:00Some notes on virtualisation<br />
When you install an operating system on a new machine, the virtualisation , by default, is off in the BIOS . Depending your hardware you need to log into the BIOS and enable it, based on the hardware manual. In my ASUS x470, first you enter the BIOS.There from the "Easy Mode" you need to enter into the "Advanced Mode." There again from the menu select Advanced. From options down there you can see the "CPU Information" and when you click on it and expand it then you have a set of choices. You need to enable SVM Mode.<br />
<br />
Otherwise, from the Virtual Box you receive messages such as this "AMD-V is not available (VERR_SVM_NO_SVM)."<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjs4UiysVHfW9L9BS4uuSp4iJQ3dqRNRcBgTNPZzauNvC0088IoVzyjCHtwBKc2Uku7PaJpKKmh6cgHkXJase_T2NbB77Q54tx2JbEYDxsynpWLuXL5NOAwWGPDKVAXJshVCXrSr1Ktt-U/s1600/IMG_0460+-+Copy.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="963" data-original-width="1600" height="384" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjs4UiysVHfW9L9BS4uuSp4iJQ3dqRNRcBgTNPZzauNvC0088IoVzyjCHtwBKc2Uku7PaJpKKmh6cgHkXJase_T2NbB77Q54tx2JbEYDxsynpWLuXL5NOAwWGPDKVAXJshVCXrSr1Ktt-U/s640/IMG_0460+-+Copy.JPG" width="640" /></a></div>
<br />
Also in Windows operating system you might need to uncheck Hyper-V enabling options in Windows 10 through the "Apps and Feature" in Windows setting. Right click on the start icon-bottom, left of your screen, and at the top of the menu select "Apps and Feature." On the right side of the dialog click on "Programs and Feature." On the next screen dialog, on the left side then click on the "Turn the Features on and off," then find the Hyper-V manager and uncheck the options under it.<br />
<br />
On the contrary you might like to use Hyper-V, Microsoft hypervisor for your virtualisation then check those two option . Microsoft hyper visor is not as simple to use as the VirtualBox but some people might prefer it. To enable it you can use the PowerShell (opened with administrator privileges) with the following command:<br />
<span class="hljs-pscommand" style="box-sizing: inherit; color: #0101fd; font-family: "consolas" , "menlo" , "monaco" , "lucida console" , "liberation mono" , "dejavu sans mono" , "bitstream vera sans mono" , "courier new" , monospace , sans-serif; font-size: 13.93px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; white-space: pre; word-spacing: 0px;">Enable-WindowsOptionalFeature</span><span class="hljs-parameter" style="box-sizing: inherit; color: #007d9a; font-family: "consolas" , "menlo" , "monaco" , "lucida console" , "liberation mono" , "dejavu sans mono" , "bitstream vera sans mono" , "courier new" , monospace , sans-serif; font-size: 13.93px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; white-space: pre; word-spacing: 0px;"> -Online</span><span class="hljs-parameter" style="box-sizing: inherit; color: #007d9a; font-family: "consolas" , "menlo" , "monaco" , "lucida console" , "liberation mono" , "dejavu sans mono" , "bitstream vera sans mono" , "courier new" , monospace , sans-serif; font-size: 13.93px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; white-space: pre; word-spacing: 0px;"> -FeatureName</span><span style="background-color: #fafafa; color: black; direction: ltr; display: inline; float: none; font-family: monospace , monospace; font-size: 0.87rem; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 19px; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; white-space: pre; word-spacing: 0px;"> </span><span class="hljs-pscommand" style="box-sizing: inherit; color: #0101fd; font-family: "consolas" , "menlo" , "monaco" , "lucida console" , "liberation mono" , "dejavu sans mono" , "bitstream vera sans mono" , "courier new" , monospace , sans-serif; font-size: 13.93px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; white-space: pre; word-spacing: 0px;">Microsoft-Hyper</span><span style="background-color: #fafafa; color: black; direction: ltr; display: inline; float: none; font-family: monospace , monospace; font-size: 0.87rem; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 19px; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; white-space: pre; word-spacing: 0px;">-V</span><span class="hljs-parameter" style="box-sizing: inherit; color: #007d9a; font-family: "consolas" , "menlo" , "monaco" , "lucida console" , "liberation mono" , "dejavu sans mono" , "bitstream vera sans mono" , "courier new" , monospace , sans-serif; font-size: 13.93px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; white-space: pre; word-spacing: 0px;"> -All</span><b></b><i></i><u></u><sub></sub><sup></sup><strike></strike><br />
<b></b><i></i><u></u><sub></sub><sup></sup><strike></strike><br />
If you use Microsoft hyper-V then you are not able to use VM virtual machine or VirtualBox.<br />
<br />
To create a virtual machine in Hyper-V go to "Start" icon left click on it and then click on the "Windows Administrative Tools" and select Hyper-V Quick Create, and follow the instructions you find thereafter. You can use your local downloaded sources such as the "iso" images of Linux distributions or other desired operating systems or the suggested sources, default on the Hyper-V, for direct download and installation.<br />
<br />Peter Joneshttp://www.blogger.com/profile/03192918305428815983noreply@blogger.com0tag:blogger.com,1999:blog-667520058465774437.post-73010371358703598202018-11-12T11:32:00.001+00:002018-11-25T17:09:18.225+00:00I moved to AMD Platform part 5<div style="text-align: justify;">
<br />
I have my AMD computer up and running with all the drives connected, fresh, and ready to work. Except the graphics card driver that had been released the same day as my installation I did not install any other drivers.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
I did not use the DVD of the drivers that came with my ASUS mother board. I did not need it. Windows 10 had taken care of everything. Why should I stuff my smoothly silent working computer with things. I closed both sides of the computer case (the habit that I never had, being used to leave them open) I put all the noise dampers back on their places and look! When you enter the room you cannot recognise a computer is working there. It boots in seconds, moreover.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
My phone immediately was found by the Windows, no waiting for the drivers to be installed and trying to find your ways through the forums and manufacturer sites, etc.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
They have made things easy these days! Of course not much out of good intention! Why? There was a time that as the user of a PC gradually you would become a nerd that could understand what was going under the hood. Then you could find ways around the ad ware spy ware and puffery promises and so on. When you feel you do not need to learn then gradually you become a sheeple that sits and consumes every rubbish, like the golden time of the TV. TV and news papers with loads of rubbish are back but now on computers with much more power, turning the society into a more individualistic way, and at last we have smart TVs. They are actually computers that cannot be tweaked even by most committed nerds.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Next it was the time for installing the Oracle Virtual Box where after adding my Windows 7 x64 I found a new problem. I had no problems with my Linux virtual boxes, though.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
I need this <span style="-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Times New Roman; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: justify; text-decoration: none; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;">virtual </span>Windows 7 as I do my Visual Studio on it.and it is full of my codes. I kept my Windows 7 RTM DVDs when I moved to the Windows 8. But used them to create two virtual boxes one for 32 bits and one for 64 bits Windows 7.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
I also use these virtual boxes when some dodgy producers offer free software etc. I download them on virtual boxes and test; if suddenly on using them they act as bait and switch and solicit you to buy a key to see the miracles of the software or when I found them bloatware or other unwanted undesirable behaviours.</div>
<br />
Now on first boot of Windows 7 64 this message came out:<br />
<br />
<h4 style="color: black; font-variant: normal; letter-spacing: normal; margin: 0px; text-align: center; text-decoration: none; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;">
<i><span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;">"Your PC uses a processor that is designed for the latest version of
</span></i></h4>
<h4 style="color: black; font-variant: normal; letter-spacing: normal; margin: 0px; text-align: center; text-decoration: none; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;">
<i><span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;">Windows. Because the processor is not supported together with the
</span></i></h4>
<h4 style="color: black; font-variant: normal; letter-spacing: normal; margin: 0px; text-align: center; text-decoration: none; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;">
<i><span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;">Windows version that you are currently using, your system will miss
</span></i></h4>
<h4 style="color: black; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; margin: 0px; text-align: center; text-decoration: none; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;">
<span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;"><b><i>important security updates."</i></b> </span></h4>
<b></b><i></i><u></u><sub></sub><sup></sup><strike></strike><span style="font-size: small;"></span><span style="font-family: "arial" , "helvetica" , sans-serif;"></span><span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;"></span><span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;"></span><span style="font-family: "times" , "times new roman" , serif;"></span><span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;"></span><br />
<div style="text-align: justify;">
AMD (and also Intel and Qualcom) have decided that to leave the support for the Windows 7 and also Windows 8.x in favour of Windows 10. This is consistent with the Microsoft model described earlier; supposedly not releasing a new version of Windows.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
If you are interested you can read about this policy change here: <a href="https://blogs.windows.com/windowsexperience/2016/01/15/windows-10-embracing-silicon-innovation/">Windows 10 Embracing Silicon Innovation.</a></div>
<div style="text-align: justify;">
<u><span style="color: #000120;"></span></u><br /></div>
<div style="text-align: justify;">
As we know, Microsoft will push this model forward and individuals resist for a while and gradually market will accept it. It is not bad or evil. It is planned by scores or even hundreds of highly skilled, and experienced programmers and operating system developers. (Well, with cues from marketing people and perhaps other layers behind the scene.) If it was not for the market we still were tweaking with the DOS, assembly and C codes, would be happy to make a connection with a friend on the other side of the ocean.</div>
<br />
<div style="text-align: justify;">
If I had a Windows 7 on my AMD platform as the main (host) operating system and insisted to keep it, due to certain reasons, then it could be a great problem. But for me it is just a guest on the virtual box. I can close the warning, ignore it and continue work until the next booting of the machine. There is no danger not that much for average users to make the security updates very critical.<br />
<br />
You can remember there were too much noise a year or two after the release of Windows XP, regarding security weakness of that product, such that a service pack was released for the operating system and again after a year or two a second service pack. And constant security updates. Even at that time some people continued using the original XP without service packs and any update; just see what could happen. We know nothing happened.<br />
<br />
Most of the time attacks are politically motivated or the attackers look for some precious things. You know that even burglars do not risk themselves into the ordinary people who own nothing of special values.<br />
<br />
I am an expert and know that there is nothing you can do to prevent a committed programmer/hacker unable to intrude into your computer. Anyhow, businesses are interested in your pocket and need to target you legally and get your information. What is the fear? Few months ago I noticed next to the "Angel" Station (a London Underground Station) people were standing in a queue to give their personal information to Google in exchange of a doughnut ( one pack of five doughnuts sells for 50p in Morrisons). The most available information now-a-days is the personal data of ordinary people, under the hammer of data auctioneers.<br />
<br />
For many years I have opted in Windows Insiders Program and always have tested each release of Windows dozens of times before they come to the market. Hence, have no resistance to upgrade and frequently have done it much cheaper.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
As I will explain under another title that I am intending to write on virtual machines I am not concerned about the security threats. I always have a clone of the machine and if something bad happens I delete the infected machine and reboot in the cloned machine. Virtualisation is partly for this. I also do not activate bidirectional shared clipboard and shared folders. I even keep virtual machines beyond an air gap with no connection to the internet. I surf from the host computer.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
I did not want to throw away my Windows 7 DVD's and buy a Windows 10 for my virtual machines.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Happily, more enthusiast people have found a solution. You can delete the file that does not support the new hardware for the security update and use the patch that has been created by this bright enthusiast computer expert at GitHub here: <span style="background-color: white; color: #222222; display: inline; float: none; font-family: "arial" , "helvetica" , sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"> </span><span style="background-color: white; color: #222222; display: inline; float: none; font-family: "arial" , "helvetica" , sans-serif; font-size: 13px; font-variant: normal; letter-spacing: normal; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><span style="background-color: white; color: #24292e; display: inline; float: none; font-family: , "blinkmacsystemfont" , "segoe ui" , "helvetica" , "arial" , sans-serif , "apple color emoji" , "segoe ui emoji" , "segoe ui symbol"; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><a href="https://github.com/zeffy/wufuc">Disables the "Unsupported Hardware" message in Windows Update, and allows you to continue installing updates on Windows 7 and 8.1 systems with Intel Kaby Lake, AMD Ryzen, or other unsupported processors. </a></span></span></div>
<br />
I used the patch and updated my virtual Windows 7.<br />
<br />
Conclusion: As I do not play games and do not develope them and also do not edit videos routinely my AMD Rayzen 7 2600 and X470 platform with its stock cooler is enough for me. I have thrown away all the stupid extra fans and all the home made led lighting that I had made. I have a silent well behaving computer with enough power for my C/Java coding, maintenance of my websites and other works. My powerful Graphics card is also beyond the power necessary for watching even in 4k. As I already had case, PSU and graphics card it also did not bring much expenses. (I gave my older parts still with a good life time remaining in them to the charity of cats to sell them on eBay). I might buy a glass window for my Thermaltake case to enjoy RGB of motherboard.<br />
<br />
<br />Peter Joneshttp://www.blogger.com/profile/03192918305428815983noreply@blogger.com0tag:blogger.com,1999:blog-667520058465774437.post-45381228327288494262018-11-02T20:37:00.001+00:002019-01-16T15:58:02.243+00:00I moved to AMD Platform part 4<br />
Then I turned the computer and disconnected it physically from the main. I connected Blu ray and two of the hard disk drives.<br />
<br />
I did not attach all hard drives then, out of being cautious. I have seen things. We all are sleeping at night and when we wake up in the morning there are new realities and new idea in place without already being notified about the changes. We have to sign and accept at the bottom of small fonts without understanding what is going on and we like to be amused by toys we have bought from them.<br />
<br />
<h1 class="quoteText" style="-webkit-text-stroke-width: 0px; background-color: transparent; color: #181818; font-family: &quot; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 21px; margin-bottom: 15px; margin-left: 0px; margin-right: 0px; margin-top: 0px; orphans: 2; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;">
“For God’s sake, let us be men<br />not monkeys minding machines<br />or sitting with our tails curled<br />while the machine amuses us, the radio or film or gramophone.<br /><br />Monkeys with a bland grin on our faces.” </h1>
<h1 class="quoteText" style="-webkit-text-stroke-width: 0px; background-color: transparent; color: #181818; font-family: &quot; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 21px; margin-bottom: 15px; margin-left: 0px; margin-right: 0px; margin-top: 0px; orphans: 2; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;">
<span style="background-color: white; color: #181818; display: inline; float: none; font-family: "merriweather" , "georgia" , serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 21px; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;">―
</span><span class="authorOrTitle" style="color: #333333; font-family: "quot"; font-size: 14px; font-style: normal; font-variant: normal; font-weight: bold; letter-spacing: normal; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;">
D.H. Lawrence,
</span><span style="background-color: white; color: #181818; display: inline; float: none; font-family: "merriweather" , "georgia" , serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 21px; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;">
</span><span id="quote_book_link_459095" style="color: #181818; font-family: "quot"; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;">
<span style="color: #333333; font-family: "quot"; font-weight: bold; text-decoration: none;">Selected Letters</span></span><b></b><i></i><u></u><sub></sub><sup></sup><strike></strike></h1>
Hence, we might enter into the unchartered waters and some patience is always handy.<br />
<br />
I power up the computer and immediately right click on the start button and select the disk manager utility to open it.<br />
<br />
But lo and behold! Panic seized me: one of the most important partitions of newly attached disks was labelled as "Recovery healthy partition" a total of 1 TB. It contained all my codes, backup of my websites and many other goodies. It did not also appear on the "My Computer" Windows<br />
<br />
Many thoughts came to my mind. For instance I am used to label partitions with Greek alphabets instead of Latin and I load my costume made icons with them - such as lambda theta etc. The lost partition had a combined name "PsiPhi" to be pronounced as Sci-Fi. and its icon was also combined letters, ψφ. Perhaps this was the reason.<br />
<br />
I also change letters Windows uses for enumerating partitions. I do not like when Windows starts from the letter 'D' and then 'E', 'F', 'G' etc. I use X, Y, Z, U, V, W and so on. the lost partition was always labelled as X. As Windows installation has its own use of letter X and Z, I became suspicious that this could be the cause. (These letters are something related to the OS and are not engraved into the hard drives. so no worries about this)<br />
<br />
Well, happily it is a rule that when Windows become confused and label a partition, it is just a label and should be corrected.<br />
<br />
I opened a command prompt as administrator and typed "diskpart" (without quotation marks, of course - to the end of this article) to open the application for examining the partitions.<br />
<br />
On the diskpart prompt I typed "list disk" and tapped the "enter" key. A list of my drives (now two of them) came.<br />
<br />
Next I typed "select disk 1" and entered. Disk 1 is the disk that contains my <span style="background-color: white; color: black; display: inline; float: none; font-family: "times new roman"; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;">ψφ partition. </span><br />
<span style="background-color: white; color: black; display: inline; float: none; font-family: "times new roman"; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><br /></span>
<span style="background-color: white; color: black; display: inline; float: none; font-family: "times new roman"; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;">Then I typed "list partition" and entered. A list of partitions come on the command. Voila! here is my lost partition It is not primary as it should it is described as the "Recovery"</span><br />
<span style="background-color: white; color: black; display: inline; float: none; font-family: "times new roman"; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><br /></span>
<span style="background-color: white;">I select the "Recovery" partition to examine it by typing "select partition 1" and enter.</span><br />
<span style="background-color: white;"><br /></span>
<span style="background-color: white;">After selecting the desired partion I examine its properties by typing "determine partition", or briefly, "det par" and enter. You can see that a description of the lost partition comes in the next lines. </span><br />
<span style="background-color: white;"><br /></span>
<span style="background-color: white;">For the first time, the label of the partition is shown correctly as "psiphi." But there are differences between this and a primary partition first its type id is "27" instead of "07" second, there is no letter attributed to it and at last under the "info" column it is described as "hidden."</span><br />
<span style="background-color: white;"><br /></span>
<span style="background-color: white;">please note that you might find hexadecimal numbers for the recovery type <span style="background-color: white; color: #333333; display: inline; float: none; font-family: "open sans" , sans-serif , "arial" , "tahoma" , "calibri" , "geneva" , sans-serif; font-size: 16px; font-style: normal; font-variant: normal; letter-spacing: normal; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><b>de94bba4-06d1-4d40-a16a-bfd50179d6ac</b> that could be changed or set to the primary type <span style="background-color: white; color: #333333; display: inline; float: none; font-family: "open sans" , sans-serif , "arial" , "tahoma" , "calibri" , "geneva" , sans-serif; font-size: 16px; font-style: normal; font-variant: normal; letter-spacing: normal; overflow-wrap: break-word; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><b>ebd0a0a2-b9e5-4433-87c0-68b6b72699c7</b>. </span></span></span><br />
<span style="background-color: white;"><b></b><i></i><u></u><sub></sub><sup></sup><strike></strike><b></b><i></i><u></u><sub></sub><sup></sup><strike></strike><b></b><b></b><b></b><br /></span>
<br />
<div class="separator" style="border: 2px solid red; clear: both; text-align: left;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgDgkOEP2CVcjq2fI4TAz6MmKgTrVrJuzLY1Vutq58hzVEvSY7jx6GfMnTt5uoAd-pP_GUwrXSFZNysbe0xW9tSO5gBSu7HSWOvUvNE1lrW3HNzUPDVLvjHJGSyvpi78wD0zbvzio5CDKk/s1600/Diskpart001.PNG" imageanchor="1" style="margin-left: 0.2em; margin-right: 1em;"><img border="0" data-original-height="636" data-original-width="841" height="482" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgDgkOEP2CVcjq2fI4TAz6MmKgTrVrJuzLY1Vutq58hzVEvSY7jx6GfMnTt5uoAd-pP_GUwrXSFZNysbe0xW9tSO5gBSu7HSWOvUvNE1lrW3HNzUPDVLvjHJGSyvpi78wD0zbvzio5CDKk/s640/Diskpart001.PNG" width="615" /></a></div>
<span style="background-color: white;"><br /></span>
<span style="background-color: white;"><br /></span><span style="background-color: white;">(As I had to go back and forth between OS and BIOS and I was a bit in an uneasy state due to disappearance of the partition I did not take snapshots and used the camera on my mobile phone to take the pictures, so the previous picture is patched with the mobile phone pictures.)</span><br />
<span style="background-color: white;"><br /></span>
<span style="background-color: white;">I need to chang the "type : 27" id to "type : 07" id, everything then will be back to normal. Even if you delete a partition you can undelete it easily but you should not be tempted to fiddle with things on your own such as formatting the deleted partition or writing things on it that makes reversing the situation more difficult.</span><br />
<span style="background-color: white;"><br /></span>
<span style="background-color: white;">Now as the partition is already selected, I type "set id=07" and enter. To check if the partition is back to primary. Now, I type "det par" again and enter. I can see the changes have been done.</span><br />
<span style="background-color: white;"><br /></span>
<br />
<div class="separator" style="border: 2px solid red; clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiRZm0xxdbJXC532UGtZ7rZ5I4w1ZkyOOqSV3h6dHfvO4hESTrynYYSXe_bq48FdOGvXiKFNnDengeNNQznxHo3x4UMZO4xl6jDgi9xqJaXLrTL8_BnO9FN6BTJpPTRlvU6gqJ2Yc1g5S0/s1600/Diskpart002.PNG" imageanchor="1" style="margin-left: 0.1em; margin-right: 1em;"><img border="0" data-original-height="219" data-original-width="708" height="196" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiRZm0xxdbJXC532UGtZ7rZ5I4w1ZkyOOqSV3h6dHfvO4hESTrynYYSXe_bq48FdOGvXiKFNnDengeNNQznxHo3x4UMZO4xl6jDgi9xqJaXLrTL8_BnO9FN6BTJpPTRlvU6gqJ2Yc1g5S0/s640/Diskpart002.PNG" width="615" /></a></div>
<span style="background-color: white;"><br /></span>
<span style="background-color: white;">No letter is attributed, but the volume number is also has changed from "12" to "3". It does not appear in "My Computer" until you attribute a letter to it. I opened the "Disk Management" utility and find it as the "primary" partition with no letter. I select a letter for it (my favourite X) and see that now it appears in "My Computer" too.</span><br />
<span style="background-color: white;"></span><span style="background-color: white;"><br /></span>
<span style="background-color: white;"><br /></span>Peter Joneshttp://www.blogger.com/profile/03192918305428815983noreply@blogger.com0tag:blogger.com,1999:blog-667520058465774437.post-3203113831109834662018-10-25T13:15:00.002+01:002018-10-30T09:07:00.743+00:00I moved to AMD Platform part 3Besides other preparations I downloaded the latest driver for my graphic card (ASUS Strix). By Chance it had been released a few days before my download.<br />
<br />
Having everything prepared, I connected power and fans to the motherboard. I connect all SATAs before installing graphic card. It is possible to connect them after but it is a bit difficult with the big graphic cards on your way. I disconnected SATAs from all SATA devices.<br />
<br />
Also I disconnected Power from PSU to SATA's. I do not like to have power on the devices when they are not connected. I have this habit from the ancient time when we would not turn on HiFi devices when no speakers were connected to the audio outputs. It could be an obsession but sometimes gut feeling cautiousness is what one needs to follow rather than promises of other engineers.<br />
<br />
There is a new mistake regarding recent on board graphics output on AMD boards. One can use them when he has installed the right, graphic supporting AMD CPU's are installed. As far as I know none has come to the market yet. Some people on the idea that there is such a facility available do not attach any graphics card and voila: three beeps from the BIOS as the sign of "no graphic cards!"<br />
<br />
Even with those processors the video does not enjoy what you might love to have. Perhaps they are good for the organisations computers and workstations. They use a share part of your RAM's for graphic processing - some 2GB. Right now I have not any judgement about those builds and how far they are useful for Video editing or watching HD, 4K etc. For gaming definitely they do not satisfy those gamers who use two cards each with 11 GB DDR5.<br />
<br />
Then I connected graphic card, keyboard, and mouse, and broadband. I turned on the computer and entered BIOS by pressing "Delete" key. In BIOS I checked that CPU, memories, and above all the WD M2 SSD and mouse and broadband were fully recognised.<br />
<br />
In BIOS upgrade menu you can see the option to upgrade it through the internet but I prefer to use the memory stick for that job.<br />
<br />
I turned off the computer and connected the flash memory stick that contained the BIOS upgrade to its latest version. I turned it on again and followed the procedure for upgrade. Happily, BIOS had recognised the existence of the memory stick with upgrade and did it smoothly through it.<br />
<br />
I turned off the computer again removed the BIOS update memory stick and attached the Windows 10 memory stick and turned the computer again. I entered the BIOS and asked it to boot through the memory stick.<br />
<br />
Windows 10 installation software on the flash memory without any error recognised the WD Green M2 and completely installed Windows 10.<br />
<br />
This is the latest version of Windows 10 with all updates and everything. I can be sure that it dos not need any driver or software accompanied on the DVD of your motherboard. This is the new policy of Microsoft. No future version of Windows is promised. Windows 10 is the last version of Windows and Microsoft will only updates it constantly and all previous versions will become obsolete similar to DOS and Windows 3 and so on.<br />
<br />
Most people know how to follow from this point on. You can skip the activation key and password setting etc. But a new idea as the PIN has been introduced in expectation of uniformity with portable devices such as Surface, mobile phones, BYODs and such. You have to do that. Do not disturb smooth installation by trying to avoid this. Later after logging to your Windows and checking everything you can remove it if you like.<br />
<br />
After I opened my Windows for the first time, I ejected the memory stick and removed it from the USB. Immediately I connected the graphics card USB and installed "just drivers". I do not like that at this stage, to install software that later constantly ask me things or producing hurdles that I should search forums for their answers and solutions.<br />
<br />
I went to the activation in control panel and activated my Windows through the key that I had acquired from Microsoft.<br />
<br />
I restarted my Windows. I did a thorough clean up. and disk optimisation and again restart (after clean up some temp files will only be deleted through the restart at the reboot stage.<br />
<br />
Then I followed the procedure to create an image backup of the entire activated but yet untouched Windows. This job needs a 32GB memory stick which is now under £8.<br />
<br />
<br />
<br />
<br />
<br />Peter Joneshttp://www.blogger.com/profile/03192918305428815983noreply@blogger.com0tag:blogger.com,1999:blog-667520058465774437.post-81044248443041797282018-10-24T10:38:00.001+01:002019-05-02T13:49:35.909+01:00I moved to AMD Platform part 2<br />
<br />
In the new build I got rid of the Corsair H115i liquid cooler that I had and also all the decorating LED's etc. I did not need to cool down my Intel 2011 6 cores extreme with 150 watts TDP.<br />
<br />
I also removed my Sandisk 512 GB SSD. I noticed that maximum I use 140 GB on the main hard drive of my computer so 512 GB was always almost empty. I save everything on a set of HDD which are in excess of 10 TB and arranged for different tasks.<br />
<br />
I cannot put my pictures and documents next to operating system that always is subject to different issues. I also every now and then save my things on Blu rays. That I cannot find things on these things later is another issue that still has not been solved. I like other consumers of new technologies cannot hire a personal private IT person, and we know that even them are lost among the huge flood of data.<br />
<br />
The highest usage of my main drive is for LaTex that I use MikTex and I am used to complete install of their packegs. I also have some in-house apache webserver, a Microsoft office and such.<br />
<br />
I installed the Rayzen CPU, WD Green M2 SSD and the stock cooler that came with the processor on the bench. I used the antistatic bag of the motherboard as the anti static surface under the mother board during these installations.<br />
<br />
I also installed four pieces of Crucial DDR4 2666 MHz (4x8GB the most expensive item in this build) at this stage.<br />
<br />
Then I put the whole build in the case (Thermaltake suppressor F51). I already had attached the back plate. on doing the screws I noticed one screw was under the M2 SSD and left undone which was not important. Eight screws are enough. I paid attention on tightening the screws to prevent counter torques that can damage the motherboard.<br />
<br />
I liked a fresh install with all the sufferings that I experienced when tried to use images of pf Windows that I had on previous hardware builds. I did not connect any HDD. Windows should be installed on the WD Green alone both for cations and also ease of installation.<br />
<br />
Windows ISO on the DVD's these days won't go easily with the M2 SSD's. So from the official Microsoft Windows 10 I downloaded a flash memory stick version of the Windows 10. I used my laptop for that job. When the download software asked me if it should add some details of the laptop I un-checked the box. I did not need it for the laptop, obviously. I used an 8 GB memory stick for the Windows image.<br />
<br />
I also downloaded the latest version of the motherboards BIOS from the ASUS site. I have a separte dedicated marked memory stick just for updating BIOS.<br />
<br />
<br />
<br />Peter Joneshttp://www.blogger.com/profile/03192918305428815983noreply@blogger.com0tag:blogger.com,1999:blog-667520058465774437.post-39806152317182335852018-10-22T14:06:00.001+01:002019-01-16T17:01:32.598+00:00I moved to AMD Platform part 1Few years ago I decided to move to more powerful platforms at home to serve me longer and easily can be upgraded. Reason was that until that time I only used to use Intel motherboards. Well, before that I had IBM motherboards until IBM stopped to build those hardware and so I switched to Intel motherboards.<br />
<br />
Actually my story goes back to Z80 and 8080 and these things. From that time there were people who spontaneously had selected Motorola 6800 instead of 8080. IBM took 4004 and then next generations of Intel's and developed DOS instead of CP/M. IBM made these two the winners but itself gradually left the arena.<br />
<br />
When I noticed Intel would not build any motherboards of its own for non-server computers, still I could not use AMD. I was not familiar with their CPU's.<br />
<br />
Then I wondered which socket of Intel was more promising than the others. Intel vastly was promoting socket 1366, but suddenly announced that there was an error in creating that socket and no further development would be possible <br />
<br />
At the same time Intel marketed socket 2011. I found the idea of having 2011 pins on a microprocessor very stable and promising and also very exciting. I could remember there was a time, an ancient time, that we called a TTL with 24 pins a millipede.<br />
<br />
As Intel did not build any motherboard for this socket, after some search I decided to move to ASUS. Well, Gigabyte and MSI and others are also good enough, but ASUS has some reputation I liked to test. When I bought my (Intel chipset) X79 motherboard from ASUS, immediately I noticed that its accompanying CD was outdated in terms of Windows.<br />
True, they had all updates on the motherboard site. But, as I also sent an email to them, it was better if instead of that or on the side of that they put an updated ISO image. Then you can burn it and use it as the motherboard accompanying DVD. That could make me happy; having the latest ISO<br />
<br />
It is still advisable if they do that for their new boards with so many fuss that they have about their Republic of Gamers, etc., etc. They can put also an image of the sticker that you need to put on the DVD such that you download and print it make a DVD similar to what was with the motherboard.<br />
<br />
Immediately after I finished my build, Intel announced that they would discontinue socket 2011 and marketed a 2011 v3 instead, not compatible with 2011. So my new build fell in the blind end.<br />
<br />
I, like many other IT power users/enthusiasts who had chosen socket 2011, continued using my build. The important point was the front side speed; that was almost similar on all sockets. For example, my G.Skill 2400MHz memory cards worked on 1333MHz, not even nominal 1600 MHz of X79.<br />
<br />
From 2016, front side speed witnessed a new upgrade. DDR4 memories with new specs replaced DDR3 and we know that they create a new realm not compatible with DDR3 memories. They can push fsb further. Now they talk of 5000 MHz and above for memory (though most of the people who buy those high end memories cannot tune them and memories roll back to 2400 and so). Chipsets need to run faster fsb and these chipsets are still working around 2400-2666 MHz.<br />
<br />
With these in mind, and considering that Intel does not have a clear roadmap to be economically feasible for average users (who pays £1800 for a CPU and after a year found it obsolete), I suddenly decided to move to AMD platform. I focused on new low price low power consuming Rayzen platform completely unlocked for overclocking.<br />
<br />
I found two platform X370 and X470 accommodating these CPU's.<br />
First I bought an ASUS X370 with a Rayzen 1600 CPU. Unfortunately, with my 512 GB SSD the system randomly would go to the hibernate state and would not wake up, with freezing shut down and reset button. I had to turn off the PSU externally and turn it on back to reboot the system.<br />
<br />
Before it becomes late I returned them to seller and refunded my money (I paid £9 for shipping via Parcel Force).<br />
<br />
ASUS X370 was flimsy and cheapie and could not be compared with my ASUS Sabertooth I had<br />
<br />
X470 boards have a better promise for future upgrades of Rayzen. So I ordered one of them and a better specs Rayzen 2600. I also got a WD Green M2 240GB SSD.Peter Joneshttp://www.blogger.com/profile/03192918305428815983noreply@blogger.com0tag:blogger.com,1999:blog-667520058465774437.post-29546240787712482462017-01-06T12:12:00.001+00:002018-11-04T10:00:20.942+00:00NetBeans Gets a New Life—or Does It?<span style="color: red;">(For the latest PDF files Merger Software please have a look at the top of the left margin, inside the red box.)</span><br />
From the time that Sun Microsystem created Java Café and Java One for developing Java Applications and then acquired NetBeans first as parallel with those and later as consolidating and replacing them until it included further features to develop Fortran and C and C++ and other languages I was an avid user of this easy to use IDE. NetBeans evolved and evolved and for the goals that it had it was much better than Visual Studio, for instance being Intelligent Sense not only in showing the code but also showing the documentation with hyper texting to move around the documents.<br />
<br />
NetBeans was acquired by Oracle at the time that Sun Microsystem was acquired by Oracle. There were speculations that support for the NetBeans will be stopped and the IDE will be scrapped. Some people hastily switched to JDeveloper and Eclipse but most Java programmers kept the hope and Oracle also showed sensibility in continuing funding the NetBeans IDE as its own product and NetBeans improved to its present 8.2 Version. <br />
<br />
<br />
<div class="MsoNormal" style="margin: 0cm 0cm 8pt; mso-hyphenate: none; mso-pagination: none;">
In <b>November/December 2016 digital edition </b><span style="color: black;"><b>of <i>Java Magazine</i></b> editor gives some news that NetBeans has been moved from its Oracle home to Apache Foundation. I did not find this depressing as some might speculate. I know Apache a better place for such thing. Hence, I leave the whole story to the powerful pen of him.</span> </div>
<div style="border: 2px solid red; padding-left: 5px; padding-right: 5px;">
<span style="color: black;"></span><br />
<div class="MsoNormal" style="margin: 0cm 0cm 8pt; mso-hyphenate: none; mso-pagination: none;">
<span style="color: black;"><b><span style="font-family: Scout-Bold; font-size: 18pt; mso-bidi-font-family: Scout-Bold;">NetBeans
Gets a New Life—or Does It?<o:p></o:p></span></b></span></div>
<span style="color: black;">
</span>
<br />
<div class="MsoNormal" style="margin: 0cm 0cm 8pt; mso-hyphenate: none; mso-pagination: none;">
<span style="color: black;"><span style="font-family: Scout-Light; font-size: 16pt; mso-bidi-font-family: Scout-Light;">The transition
from Oracle to the Apache Software Foundation marks the beginning of an
uncertain new era for the Java IDE.<o:p></o:p></span></span></div>
<span style="color: black;">
</span>
<br />
<div class="MsoNormal" style="margin: 0cm 0cm 8pt; mso-hyphenate: none; mso-pagination: none;">
<span style="color: black;"><b><span style="font-family: "times new roman" , serif; font-size: 12pt; line-height: 107%;">A</span></b><span style="font-family: "times new roman" , serif; font-size: 12pt; line-height: 107%;">t
JavaOne this year, the NetBeans community announced that the project was moving
from its long-time home at Oracle to the Apache Software Foundation (ASF). In a
history that dates back some 20 years, this will be NetBeans’ </span><span style="font-family: "times new roman" , serif; font-size: 12pt; line-height: 107%;">fifth new home, showing the
product’s remark</span><span style="font-family: "times new roman" , serif; font-size: 12pt; line-height: 107%;">able power of endurance. An important
question is whether working under the aegis of the ASF </span><span style="font-family: "times new roman" , serif; font-size: 12pt; line-height: 107%;">will bring NetBeans new life
and new aficionados, or whether it signals the final chapter of a </span><span style="font-family: "times new roman" , serif; font-size: 12pt; line-height: 107%;">storied
lifeline. </span></span></div>
<span style="color: black;">
</span>
<br />
<div class="MsoNormal" style="margin: 0cm 0cm 8pt; mso-hyphenate: none; mso-pagination: none;">
<span style="color: black;"><span style="font-family: "times new roman" , serif; font-size: 12pt; line-height: 107%;">As
many readers know, NetBeans is one of the four principal Java IDEs. The others
are the open source Eclipse from the Eclipse Foundation, IntelliJ IDEA from
JetBrains (consisting of an open source version and a higher-end closed source version),
and JDeveloper (a free, closed source IDE from Oracle). What few readers might
know is </span><span style="font-family: "times new roman" , serif; font-size: 12pt; line-height: 107%;">that NetBeans was the first of
these products— </span><span style="font-family: "times new roman" , serif; font-size: 12pt; line-height: 107%;">beating Borland’s JBuilder by a year. (JDeveloper,
which was based on JBuilder, was next, followed years later by Eclipse and
IntelliJ.) </span></span></div>
<span style="color: black;">
</span>
<br />
<div class="MsoNormal" style="margin: 0cm 0cm 8pt; mso-hyphenate: none; mso-pagination: none;">
<span style="color: black;"><span style="font-family: "times new roman" , serif; font-size: 12pt; line-height: 107%;">NetBeans
became a popular Java IDE because of several features, most especially the
lightness of its use. While competing products had a long setup cycle for new
projects and a comparatively “heavy” feel, NetBeans was great for coding </span><span style="font-family: "times new roman" , serif; font-size: 12pt; line-height: 107%;">on the fly and always felt
light and responsive. </span><span style="font-family: "times new roman" , serif; font-size: 12pt; line-height: 107%;">While it lacked some of its competitors’ code</span><span style="font-family: "times new roman" , serif; font-size: 12pt; line-height: 107%;"> management features, it was
the first to offer a built-in execution profiler and, if I recall correctly, </span><span style="font-family: "times new roman" , serif; font-size: 12pt; line-height: 107%;">the
only one to include a small-scale J2EE server, OC4J, to quickly test web
projects locally. It was </span><span style="font-family: "times new roman" , serif; font-size: 12pt; line-height: 107%;">also
the first IDE to offer a top-quality Swing</span><span style="font-family: "times new roman" , serif; font-size: 12pt; line-height: 107%;"> based GUI-development
tool, called Matisse. </span></span></div>
<span style="color: black;">
</span>
<br />
<div class="MsoNormal" style="margin: 0cm 0cm 8pt; mso-hyphenate: none; mso-pagination: none;">
<span style="color: black;"><span style="font-family: "times new roman" , serif; font-size: 12pt; line-height: 107%;">That’s
a lot of quality to come from what was originally a student project at Charles University
in Prague. (The core development team for NetBeans has remained primarily based
in Prague, although marketing and other functions have been based at various
times in the United States and elsewhere.) </span></span></div>
<span style="color: black;">
</span>
<div class="MsoNormal" style="margin: 0cm 0cm 8pt; mso-hyphenate: none; mso-pagination: none;">
<span style="color: black;"><span style="font-family: "times new roman" , serif; font-size: 12pt; line-height: 107%;">Eventually,
NetBeans was acquired by Sun, where it was open sourced. And through the 2011
acquisition of Sun, NetBeans became part of Oracle. At that point, I was quite
surprised to read of Oracle’s commitment to continue developing NetBeans. After
all, the company already </span><span style="font-family: "times new roman" , serif; font-size: 12pt; line-height: 107%;">offered
JDeveloper for free and sponsored Oracle-specific pack</span><span style="font-family: "times new roman" , serif; font-size: 12pt; line-height: 107%;">ages
and extensions for Eclipse. But actually, Oracle did more than just commit to
supporting the platform’s development and promotion; it also began using portions
of NetBeans in its own </span><span style="font-family: "times new roman" , serif; font-size: 12pt; line-height: 107%;">products,
specifically JDeveloper </span><span style="font-family: "times new roman" , serif; font-size: 12pt; line-height: 107%;">and VisualVM, and eventually a variety of
other development tools. For this reason, even with the move to the ASF,
NetBeans has secured a commitment from Oracle to underwrite its development for
two more releases: the upcoming 8.x version and the 9.0 release. </span></span></div>
<span style="color: black;">
</span>
<div class="MsoNormal" style="margin: 0cm 0cm 8pt; mso-hyphenate: none; mso-pagination: none;">
<span style="color: black;"><span style="font-family: "times new roman" , serif; font-size: 12pt; line-height: 107%;">If
you were to view NetBeans purely as a programming environment, its fate after
Oracle’s commitment expires would be most uncertain. Although many projects
under the ASF aegis </span><span style="font-family: "times new roman" , serif; font-size: 12pt; line-height: 107%;">have
flourished (Maven, Hadoop, </span><span style="font-family: "times new roman" , serif; font-size: 12pt; line-height: 107%;">Spark, and others), more than a few
projects have migrated to the ASF only to die there. (See the Apache Attic for
a list of defunct </span><span style="font-family: "times new roman" , serif; font-size: 12pt; line-height: 107%;">projects.)
However, over the </span><span style="font-family: "times new roman" , serif; font-size: 12pt; line-height: 107%;">years, NetBeans evolved from an IDE into a
platform consisting of large-scale components that can </span><span style="font-family: "times new roman" , serif; font-size: 12pt; line-height: 107%;">be assembled in different ways
to </span><span style="font-family: "times new roman" , serif; font-size: 12pt; line-height: 107%;">form
desktop applications. This architecture uses a rather different approach than
Eclipse’s OSGi-based system of modules and bundles. (This page compares the
Eclipse and NetBeans archi</span><span style="font-family: "times new roman" , serif; font-size: 12pt; line-height: 107%;">tectures.)
Numerous companies— including Oracle—have exploited the benefits of NetBeans’
archi</span><span style="font-family: "times new roman" , serif; font-size: 12pt; line-height: 107%;">tecture
and built applications whose runtime includes the platform components. </span></span></div>
<span style="color: black;">
</span>
<div class="MsoNormal" style="margin: 0cm 0cm 8pt; mso-hyphenate: none; mso-pagination: none;">
<span style="color: black;"><span style="font-family: "times new roman" , serif; font-size: 12pt; line-height: 107%;">These
companies have an interest in continuing the forward direction of NetBeans, and
some have committed to work on NetBeans in its new home. </span><span style="font-family: "times new roman" , serif; font-size: 12pt; line-height: 107%;">I expect—but obviously I don’t
know—that they will contrib</span><span style="font-family: "times new roman" , serif; font-size: 12pt; line-height: 107%;">ute either directly or by engaging NetBeans’
current cohort of developers to continue developing the platform. In addition, the
community of users, many of whom are truly dedicated to NetBeans, might well
step up and </span><span style="font-family: "times new roman" , serif; font-size: 12pt; line-height: 107%;">begin
contributing. It’s difficult </span><span style="font-family: "times new roman" , serif; font-size: 12pt; line-height: 107%;">to project the extent of
participation because very few projects with so large a user base have been
migrated to the ASF, and so there is little history to provide guidance. </span></span></div>
<span style="color: black;">
<div class="MsoNormal" style="margin: 0cm 0cm 8pt; mso-hyphenate: none; mso-pagination: none;">
<span style="font-family: "times new roman" , serif; font-size: 12pt; line-height: 107%;">For
users of NetBeans, though, nothing need be done for now or in the near term. The
9.0 release is scheduled for August 2017 and will cover Java 9. By that time,
we will surely have more insight into the transition of NetBeans, the level of
activity, and the level of support from both commercial users and the developer
community. </span></div>
<div class="MsoNormal" style="margin: 0cm 0cm 8pt; mso-hyphenate: none; mso-pagination: none;">
<b><span style="font-family: "times new roman" , serif; font-size: 12pt; line-height: 107%;">Andrew
Binstock, Editor in Chief </span></b><span style="font-family: "times new roman" , serif; font-size: 12pt; line-height: 107%;">javamag_us@oracle.com
@platypusguy</span><span style="font-family: "times new roman" , serif; font-size: 12pt; line-height: 107%;"><span style="mso-spacerun: yes;"> </span><span style="mso-spacerun: yes;"> </span></span></div>
<div class="MsoNormal" style="margin: 0cm 0cm 8pt; mso-hyphenate: none; mso-pagination: none;">
<b><span style="color: black; font-family: "verdana" , sans-serif; font-size: 10pt; line-height: 107%;">November/December 2016</span></b><b><span style="color: white; font-family: "verdana" , sans-serif; font-size: 10pt; line-height: 107%;"> </span></b><b><span style="font-family: "verdana" , sans-serif; font-size: 10pt; line-height: 107%;">digital edition <span style="color: black;">of <i>Java Magazine</i></span></span></b></div>
</span></div>
<br />
<div style="border: 2px solid red; padding-left: 5px; padding-right: 5px;">
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;">
<b><span style="font-family: Scout-Bold; font-size: 16pt; mso-bidi-font-family: Scout-Bold;">Java:
Number One Development Platform:<o:p></o:p></span></b></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;">
<b><span style="font-family: Scout-Bold; font-size: 16pt; mso-bidi-font-family: Scout-Bold;">13
Billion Devices Run Java</span></b></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;">
<b><span style="font-size: 14pt; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><span style="font-family: "calibri";">ATMs,
Smartcards, POS Terminals, Blu-ray Players, Set Top Boxes, Multifunction Printers,
PCs, Servers, Routers, Switches, Parking Meters, Smart Meters, Lottery Systems,
Airplane Systems, IoT Gateways, Programmable Logic Controllers, Optical
Sensors, Wireless M2M Modules, Access Control Systems, Medical Devices, Building
Controls, Automobiles…</span></span></b><br />
</div>
</div>
<br />Peter Joneshttp://www.blogger.com/profile/03192918305428815983noreply@blogger.com0tag:blogger.com,1999:blog-667520058465774437.post-39829629485719530742015-10-08T12:47:00.000+01:002015-10-15T15:29:18.679+01:00Web Hosting at Your Home : PHP and Port Forwarding Conflicts<span style="color: red;">(For the latest PDF files Merger Software please have a look at the top of the left margin, inside the red box.)</span><br />
From the time that I wrote <a href="http://codesforus.blogspot.co.uk/2012/12/web-hosting-at-your-home-revisited.html">Web Hosting at Your Home (Revisited)</a> Apache httpd server has seen many revisions. Also people might like to have PHP installed on their web server to be able to load PHP pages.<br />
<br />
Assume your web serving computer is clean of any Apache httpd sever of previous versions such as Apache httpd server 2.2. The latest version for Windows operating system is not in the form of an exe file to be run by double clicking and automated install; it even is not compiled for Windows. It is a source file in C programming language that needs compilation.<br />
<br />
If you know how to use MinGw or NetBeans IDE or Visual Studio then you need to compile the source and then follow other steps, you even can build an automated EXE file for execution.<br />
<br />
The good news is that some people, <a href="http://www.apachelounge.com/download/">Apache Lounge</a>, already have done the compilation but still no executable GUI for installation exists. You do not need this far. You can get the compiled server, most likely a zip file, from those people and install it in your comfort.<br />
<br />
Create an Apache server folder as near as possible to the root; that is, C:\; for instance, C:\ApacheWeb.<br />
<br />
Then download the compiled folder. Mine is <span style="color: red;">httpd-2.4.16-x86-vc11.zip</span>. Note <span style="color: red;">vc11</span> inside the name of the file. It shows the Visual C distribution version. You need to have your PHP to be of the same flavour, which you can download from <a href="http://windows.php.net/download/">PHP download site</a>. Mine is <span style="color: red;">php-5.6.14-Win32-VC11-x86.zip</span>, the same <span style="color: red;">vc11</span> again. Note please that your PHP is the thread safe. Please, even if your Windows is x64 bits, do not use httpd server x64 or PHP x64 or non thread safe version if you do not like to struggle with forums and their moderators. Also use short names without dot, dash, space and such things for the folders. Behind the scene of software still we are in many aspects at 1999.<br />
<br />
Unzip these folders one by one. Bring two unzipped folders into C:\ApacheWeb. Cut Apache24 folder from inside the httpd-2.4.16-win32-VC11 folder nd paste it in C:\ApacheWeb Rename it as Apache. Rename php-5.6.14-Win32-VC11-x86 as just Php, such that now you have two folders as C:\ApacheWeb\Apache, and C:\ApacheWeb\Php. Create a notepad txt file as MyReminder.txt and write in it, "My Apache version is <span style="color: black;">httpd-2.4.16-x86-vc11.zip and my PHP is php-5.6.14-Win32-VC11-x86.zip (thread safe version)." This helps you to remember later what software you have used. Delete every other thing, but these three.</span><br />
<br />
Put your folders and files of your website into C:\ApacheWeb\Apache\htdocs such that your home page to be naked there; that is C:\ApacheWeb\Apache\htdocs\home.html. Change the existing index.htm that comes as default with the Apache httpd server to indexOld.html. Copy and paste your home.html as index.html there, such that now you have both of them.<br />
<br />
Now go to the C:\ApacheWeb\Apache\conf. Open httpd.conf file. Add three lines at the bottom<br />
<br />
<div style="border-radius: 5px; border: 1px solid purple; height: auto; margin-bottom: 5px; margin-top: 5px; padding: 5px;">
#Following 3 lines have been added by the webserver designer.<br />
LoadModule php5_module "C:/ApacheWeb/Php/php5apache2_4.dll"<br />
PHPIniDir "C:/ApacheWeb/Php"<br />
AddHandler application/x-httpd-php<span style="color: red;"> </span><strong>.</strong>php</div>
<br />
Please note that in the last line there is a space before<span style="color: red;"> <strong>.</strong>php</span><br />
<br />
Change line 37 of the file from ServerRoot "c:/Apache24" to ServerRoot "c:/ApacheWeb/Apache"<br />
Change line 242 of the file from DocumentRoot "c:/Apache24/htdocs" to DocumentRoot "c:/ApacheWeb/Apache/htdocs"<br />
Change line 243 of the file from <Directory "c:/ApacheWeb/Apache/htdocs"> to <Directory "c:/ApacheWeb/Apache/htdocs"><br />
<br />
Now you are ready to go. Open a command prompt "As Admin." Change directory to C:/ApacheWeb/Apache/bin and then type httpd.exe -t and run it, where in response you should get "syntax OK;" otherwise, correct the errors that are mentioned. If your config file becomes accepted in this way, then from the same command line run httpd.exe -k install that creates Windows service to run automatically your webserver every time that you turn on your computer. This service is named as Apache2.4 and can be checked for its properties and specifications inside the Windows management for Services. You can see that the "Description" of service comes as Apache/2.4.16 (Win32) PHP/5.6.14. This completes installation of Apache httpd server and PHP. <br />
<br />
As in the previous post ( <a href="http://codesforus.blogspot.co.uk/2012/12/web-hosting-at-your-home-revisited.html">Web Hosting at Your Home (Revisited)</a> ) mentioned you need to do port forwarding and inbound rule for firewall and other things mentioned in previous post.<br />
<h4>
Problem : Apache default port 80 may conflict with Skype.</h4>
Before running the install command, you might like to change the port that listens to inbound traffic. It is due to the fact that in Windows most of the people have Skype installed. Skype allows using default listening ports 80 which is also default for your Apache. Many believe that they should remove Skype to solve the conflict. This is not necessary.<br />
<br />
Change your httpd.conf file listening port wherever you find in the text to, say, 8085, or 9191 and such. Then log <span style="color: #1155cc;">i</span>nto your router and change the port forwarding to 8085; also rename this rule to something else from HTTP to, say, MyWeb in the router. Go to your Windows firewall rule, too, and check if you have configured it with port 80, then change it to the new figure.<br />
<br />
If you want to test your local host instead of http://localhost/ type it as http://localhost:8085/ .<br />
<br />
Additionally you need to change the free dynamic host IP forwarding from the IP of your home to the new assigned port; for example if your redirecting IP is 188.165.15.29 change it to 188.165.15.29:8085. All such hosts have certain helpful facility to implement this.<br />
<h4>
Problem : Visitor browser shows IP and does not show the domain name URL (IP address is shown in address bar instead of domain).</h4>
Regretfully, this shows your IP in the address bar of the visitors' browsers. For instance, you have acquired free dynamic mysite1.somefree.org and pointed it to 188.165.15.29:8085, then visitors' browsers never show mysite1.somefree.org; but shows 188.165.15.29:8085 and you do not like your IP becomes revealed for security reasons.<br />
<br />
<div style="border-radius: 5px; border: 1px solid purple; height: auto; margin-bottom: 5px; margin-top: 5px; padding: 5px;">
Most of the free dynamic dns providers, <a href="https://www.noip.com/">like the one I use, NoIP</a>, allow acquiring more than one free host name. If allowed you can solve the problem by getting a second name, e.g., mysite2.somefree.org. Now, go and configure your free domain names in the dashboard of free provider in the following way.<br />
<ul>
<li>redirect mysite1.somefree.org to mysite2.somefree.org:8085</li>
<li>redirect mysite2.somefree.org to your dynamic IP, say, to 188.165.15.29</li>
</ul>
</div>
Now visitor's browser shows mysite2.somefree.org:8085 which is secure.<br />
<br />
<div style="border-radius: 5px; border: 1px solid purple; height: auto; margin-bottom: 5px; margin-top: 5px; padding: 5px;">
Please click on <a href="http://messiah1.ddns.net/">my first free domain name</a>, and notice that you'll be redirected to <a href="http://messiah2.ddns.net:8085/">my second domain</a> name on port 8085.
<br />
Please note: this is my hobby home server and might be shut down or under my constant tweaking. Mostly it is up between 7.00 AM to 10.00PM (GMT)</div>
<br />Peter Joneshttp://www.blogger.com/profile/03192918305428815983noreply@blogger.com0tag:blogger.com,1999:blog-667520058465774437.post-6811135053638742122014-02-24T11:36:00.000+00:002014-03-11T12:26:45.363+00:00How to Create a Contact Form for Your Website in an Easy Way : A Set of Step by Step Tutorials Using HTML5, CSS3 and PHP (10)<br />
<span style="color: red;">(For the latest PDF files Merger Software please have a look at the top of the left margin, inside the red box.)</span><br />
Continues From <a href="http://codesforus.blogspot.co.uk/2014/02/how-to-create-contact-form-for-your.html" target="_blank"><span style="color: #448888;">Part 9</span></a><br />
In the <a href="http://codesforus.blogspot.co.uk/2014/02/how-to-create-contact-form-for-your.html" target="_blank">previous post</a> I got the <strong><em>IP</em></strong> of the visitor and displayed it on the bottom of the contact page as a courtesy. I also put it inside the messages they might send for me. To keep the <strong><em>IP</em></strong> of any visitor who might send a message or just click on my page, I keep a record of <strong><em>IP</em></strong>'s of all the visitors. Allow me to advance further and add more elaborations to my contact form. <br />
Remember that I am not addressing any security issue such as preventing <strong><em>SQL</em></strong> Injection or making <strong><em>PHP</em></strong> codes more accomplished by using advanced functions. Sometimes they are controversial even among the <strong><em>PHP</em></strong> experts. I have done many computer codes from Assembly and machine codes, Fortran, dos to Eifel. Now I only do assembly, C, and Java and sometimes Windows C++. I do not like to become engaged in <strong><em>PHP</em></strong>. See, it is advised to change <span style="color: #783f04;">$Name</span> = <span style="color: #783f04;">$_POST[</span><span style="color: #f6b26b;">'Name'</span><span style="color: #783f04;">]</span> to $Name = filter_input(INPUT_POST, <span style="color: #f6b26b;">'Name'</span>). This works. but a similar trick, filter_input(INPUT_SERVER, <span style="color: #f6b26b;">"REMOTE_ADDR"</span>) in place of <span style="color: #783f04;">$_SERVER[</span><span style="color: #f6b26b;">"REMOTE_ADDR"</span><span style="color: #783f04;">]</span> does not work, uniformly (might work intermittently; mostly dispatches <em>Server Error</em>). It is due to the fact that as you might notice, parameters and references are not uniform. Hence, the interested readers might like to study manuals deeper.<br />
<h3>
How to make a simple basic database of visitors' <em>IP</em>'s?</h3>
<h4>
How to collect (put) visitors' <em>IP</em> records in a text file?</h4>
It is usual that web servers use MySQL to gather information in a systematic manner. I make a simple text to keep records of visitors <strong><em>IP</em></strong>. Please remember line (<strong>217</strong>) of contact form in <a href="http://codesforus.blogspot.co.uk/2014/02/how-to-create-contact-form-for-your.html" target="_blank">previous post</a>. This is where the visitors get their <strong><em>IP</em></strong>'s upon landing on the page and the best time to catch a record of the visit. Therefore, add the following snippet after this line and before line (<strong>218</strong>). Hence Line (<strong>218</strong>) will become Line (<strong>228</strong>) <!-- HTML generated using hilite.me --><br />
<!-- HTML generated using hilite.me --><br />
<div style="background: rgb(255, 255, 255); border-radius: 7px; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<table><tbody>
<tr><td><pre style="line-height: 125%; margin: 0px;"> 218
219
220
221
222
223
224
225
226
227</pre>
</td><td><pre style="line-height: 125%; margin: 0px;"> <span style="color: #996633;">$ip_file</span> <span style="color: #333333;">=</span> <span style="background-color: #fff0f0;">'save_ip.txt'</span>;
<span style="color: #996633;">$date_ti</span> <span style="color: #333333;">=</span> <span style="color: #007020;">date</span>(<span style="background-color: #fff0f0;">'Y-m-d H:i:s'</span>);
<span style="color: #008800; font-weight: bold;">if</span>(<span style="color: #007020;">file_exists</span>(<span style="color: #996633;">$ip_file</span>)){
<span style="color: #996633;">$file_content</span> <span style="color: #333333;">=</span> <span style="color: #007020;">file_get_contents</span>(<span style="color: #996633;">$ip_file</span>);
<span style="color: #007020;">file_put_contents</span>(<span style="color: #996633;">$ip_file</span>, <span style="color: #996633;">$file_content</span> <span style="color: #333333;">.</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\r\n</span><span style="background-color: #fff0f0;">"</span> <span style="color: #333333;">.</span> <span style="color: #996633;">$date_ti</span> <span style="color: #333333;">.</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\t</span><span style="background-color: #fff0f0;">||</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\t</span><span style="background-color: #fff0f0;">"</span> <span style="color: #333333;">.</span> <span style="color: #996633;">$visitor_ip</span>);
}
<span style="color: #008800; font-weight: bold;">else</span>{<span style="color: #888888;">//create text file and put header for the table</span>
<span style="color: #007020;">file_put_contents</span>(<span style="color: #996633;">$ip_file</span>, <span style="background-color: #fff0f0;">"Date and Time"</span> <span style="color: #333333;">.</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\t</span><span style="background-color: #fff0f0;">||</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\t</span><span style="background-color: #fff0f0;">"</span> <span style="color: #333333;">.</span> <span style="background-color: #fff0f0;">"Visitors IPs"</span>
<span style="color: #333333;">.</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\r\n</span><span style="background-color: #fff0f0;">"</span> <span style="color: #333333;">.</span> <span style="color: #996633;">$date_ti</span> <span style="color: #333333;">.</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\t</span><span style="background-color: #fff0f0;">||</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\t</span><span style="background-color: #fff0f0;">"</span> <span style="color: #333333;">.</span> <span style="color: #996633;">$visitor_ip</span>);
}
</pre>
</td></tr>
</tbody></table>
</div>
<br />
(Download <strong><em>PHP</em></strong> code in Zip format <a href="http://messiahpsychoanalyst.org/Codesforus/demoFinalIP3.zip" target="_blank"><span style="color: #448888;">here</span></a> or open the code in text format <a href="http://messiahpsychoanalyst.org/Codesforus/demoFinalIP3.txt" target="_blank"><span style="color: #448888;">here</span></a>). <!-- HTML generated using hilite.me -->On each landing, the code snippet checks if the text file <span style="background-color: #fff0f0;">'save_ip.txt'</span> is already created and exists. If it is the first ever reference to this file it creates the file and puts a simple header for its columns. Then goes to the next line and puts the date, time and IP of the first visitor in the second row. However, if the text file already exists code snippet gets contents of the text, rewrites it. Then goes to the next line and adds one new record to previous records. I tried to add some formatting and vertical bars to separate columns, nevertheless, readers might like to impose their own ways of doing that. Remember that, at the end, one needs to use MySQL to accumulate these information or to invoke third party tools and subscribed services.<br />
Also, it is worth mentioning that one needs to become familiar with <em><strong>PHP</strong></em> tabs, new line, carriage-return, end-of-line and so on. I used the familiar "\t", "\r", "\n" for purposes of this article, but frequently, they do not behave in such a simple way as they should.<br />
You can learn about <strong><em>PHP</em></strong> date and time formats, too, from their wikis. <br />
After two visits you can open the text file in your browser to watch records of visitors IP's or you can download and read them with a text editor, or other ways that your web server allows.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhgWkuyYhVM5btc9u4BMq8sr7NhNNL8mKzZ5OBxbrrJJSKQpu3XLOKgxv28bCB_p62yYOm_LURssvKN8EpZ9mCvf-h1uyv8PNDJw3UXmmyDFp3JvJBUpp496KEveHc9C8R0Whsb2dYMXkY/s1600/CodesForUS_100.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhgWkuyYhVM5btc9u4BMq8sr7NhNNL8mKzZ5OBxbrrJJSKQpu3XLOKgxv28bCB_p62yYOm_LURssvKN8EpZ9mCvf-h1uyv8PNDJw3UXmmyDFp3JvJBUpp496KEveHc9C8R0Whsb2dYMXkY/s1600/CodesForUS_100.PNG" height="147" width="400" /></a></div>
<br />
Please check permissions (three digits numbers such as <strong>644</strong>) for the created file not to be accessible to unwanted visitors. (In the last snap-shot <strong><em>IP</em></strong>'s painted with wrong numbers for privacy of visitors.)<br />
Please <a href="http://messiahpsychoanalyst.org/Codesforus/demoFinalIP3.php" target="_blank">click here</a> to open the contact form and then open the <a href="http://messiahpsychoanalyst.org/Codesforus/save_ip.txt" target="_blank">saved text</a> to see that your own IP has been added (many times a day I renew the text to keep privacy of previous visitors).<br />
<br />
Download <strong><em>this tutorial as PDF</em></strong> format <a href="http://messiahpsychoanalyst.org/Codesforus/ContactForm_10.pdf" target="_blank"><span style="color: #448888;">here</span></a> <br />
Download <strong><em>part 1 to part 10 as PDF</em></strong> format <a href="http://messiahpsychoanalyst.org/Codesforus/ContactForm1_10.pdf" target="_blank"><span style="color: #448888;">here</span></a> Peter Joneshttp://www.blogger.com/profile/03192918305428815983noreply@blogger.com1tag:blogger.com,1999:blog-667520058465774437.post-85391484242925391632014-02-10T21:27:00.004+00:002014-06-18T10:04:32.498+01:00How to Create a Contact Form for Your Website in an Easy Way : A Set of Step by Step Tutorials Using HTML5, CSS3 and PHP (9)<span style="color: red;">(For the latest PDF files Merger Software please have a look at the top of the left margin, inside the red box.)</span> <br />
Continues
From <a href="http://codesforus.blogspot.co.uk/2013/12/how-to-create-contact-form-for-your.html" target="_blank">Part 8</a><br />
<h3>
How to get IP addresses of visitors. </h3>
As promised, in this refinement I'll get the IP address of the visitor and show inside a formatted division to visitors who come to the contact page. You can use the code inside any other page of your choice. First let me put the final code here for your consideration (download <strong><em>PHP</em></strong> code in Zip format <a href="http://messiahpsychoanalyst.org/Codesforus/demoFinalIP.zip" target="_blank"><span style="color: #448888;">here</span></a> or open the code in text format <a href="http://messiahpsychoanalyst.org/Codesforus/demoFinalIP.txt" target="_blank"><span style="color: #448888;">here</span></a>).<br />
<!-- HTML generated using hilite.me --><br />
<div style="background: rgb(255, 255, 255); border-radius: 10px; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<table><tbody>
<tr><td><pre style="line-height: 125%; margin: 0px;"> 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274</pre>
</td><td><pre style="line-height: 125%; margin: 0px;"><span style="color: #557799;"><!DOCTYPE html></span>
<span style="color: #888888;"><!--</span>
<span style="color: #888888;">Created by Peter Jones 10 February, 2014</span>
<span style="color: #888888;">www.codesforus.blogspot.com </span>
<span style="color: #888888;">copyrights</span>
<span style="color: #888888;">--></span>
<span style="color: #007700;"><html></span>
<span style="color: #007700;"><head></span>
<span style="color: #007700;"><title></span> Demo-Final: Dysprosium Contact Form, Get IP<span style="color: #007700;"></title></span>
<span style="color: #007700;"><meta</span> <span style="color: #0000cc;">charset=</span><span style="background-color: #fff0f0;">"UTF-8"</span><span style="color: #007700;">></span>
<span style="color: #007700;"><meta</span> <span style="color: #0000cc;">name=</span><span style="background-color: #fff0f0;">"viewport"</span> <span style="color: #0000cc;">content=</span><span style="background-color: #fff0f0;">"width=device-width"</span><span style="color: #007700;">></span>
<span style="color: #007700;"><script </span><span style="color: #0000cc;">type=</span><span style="background-color: #ffaaaa; color: red;"> </span><span style="background-color: #fff0f0;">"text/javascript"</span><span style="color: #007700;">></span>
<span style="color: #008800; font-weight: bold;">var</span> RecaptchaOptions <span style="color: #333333;">=</span> {
theme<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">'white'</span>
};
<span style="color: #007700;"></script></span>
<span style="color: #007700;"><style></span>
<span style="color: #0066bb; font-weight: bold;">#contact-wrapper</span> {
<span style="color: #008800; font-weight: bold;">margin</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">20px</span> <span style="color: #008800; font-weight: bold;">auto</span>;
<span style="color: #008800; font-weight: bold;">border</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">2px</span> <span style="color: #008800; font-weight: bold;">solid</span> <span style="color: #6600ee; font-weight: bold;">#ccc</span>;
<span style="color: #008800; font-weight: bold;">border</span><span style="color: #333333;">-</span>radius<span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">5px</span>;
<span style="color: #008800; font-weight: bold;">padding</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">20px</span> <span style="color: #6600ee; font-weight: bold;">50px</span> <span style="color: #6600ee; font-weight: bold;">20px</span> <span style="color: #6600ee; font-weight: bold;">50px</span>;
<span style="color: #008800; font-weight: bold;">background</span><span style="color: #333333;">:</span> <span style="color: #008800; font-weight: bold;">transparent</span>;
<span style="color: #008800; font-weight: bold;">width</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">600px</span>;
}
<span style="color: #0066bb; font-weight: bold;">#contact-area</span> {
<span style="color: #008800; font-weight: bold;">width</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">600px</span>;
<span style="color: #008800; font-weight: bold;">margin-top</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">25px</span>;
}
<span style="color: #0066bb; font-weight: bold;">#contact-area</span> <span style="color: #007700;">label</span> {
<span style="color: #008800; font-weight: bold;">float</span><span style="color: #333333;">:</span> <span style="color: #008800; font-weight: bold;">left</span>;
<span style="color: #008800; font-weight: bold;">margin-right</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">15px</span>;
<span style="color: #008800; font-weight: bold;">padding-top</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">5px</span>;
<span style="color: #008800; font-weight: bold;">width</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">100px</span>;
<span style="color: #008800; font-weight: bold;">text-align</span><span style="color: #333333;">:</span> <span style="color: #008800; font-weight: bold;">right</span>;
<span style="color: #008800; font-weight: bold;">font-size</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">100</span><span style="color: #333333;">%</span>;
}
<span style="color: #0066bb; font-weight: bold;">#contact-area</span> <span style="color: #007700;">input</span><span style="color: #333333;">,</span> <span style="color: #0066bb; font-weight: bold;">#contact-area</span> <span style="color: #007700;">textarea</span> {
<span style="color: #008800; font-weight: bold;">margin</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">0px</span> <span style="color: #6600ee; font-weight: bold;">0px</span> <span style="color: #6600ee; font-weight: bold;">10px</span> <span style="color: #6600ee; font-weight: bold;">0px</span>;
<span style="color: #008800; font-weight: bold;">border</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">2px</span> <span style="color: #008800; font-weight: bold;">solid</span> <span style="color: #6600ee; font-weight: bold;">#ccc</span>;
<span style="color: #008800; font-weight: bold;">border</span><span style="color: #333333;">-</span>radius<span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">5px</span>;
<span style="color: #008800; font-weight: bold;">padding</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">5px</span>;
<span style="color: #008800; font-weight: bold;">width</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">471px</span>;
<span style="color: #008800; font-weight: bold;">font-family</span><span style="color: #333333;">:</span> Helvetica<span style="color: #333333;">,</span> <span style="color: #008800; font-weight: bold;">sans-serif</span>;
<span style="color: #008800; font-weight: bold;">font-size</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">110</span><span style="color: #333333;">%</span>;
}
<span style="color: #0066bb; font-weight: bold;">#contact-area</span> <span style="color: #007700;">textarea</span> {
<span style="color: #008800; font-weight: bold;">height</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">90px</span>;
}
<span style="color: #0066bb; font-weight: bold;">#contact-area</span> <span style="color: #007700;">textarea</span><span style="color: #555555; font-weight: bold;">:focus</span><span style="color: #333333;">,</span> <span style="color: #0066bb; font-weight: bold;">#contact-area</span> <span style="color: #007700;">input</span><span style="color: #555555; font-weight: bold;">:focus</span> {
<span style="color: #008800; font-weight: bold;">border</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">2px</span> <span style="color: #008800; font-weight: bold;">solid</span> <span style="color: #6600ee; font-weight: bold;">#900</span>;
}
<span style="color: #0066bb; font-weight: bold;">#contact-area</span> <span style="color: #007700;">input</span><span style="color: #bb0066; font-weight: bold;">.submit-button</span> {
<span style="color: #008800; font-weight: bold;">float</span><span style="color: #333333;">:</span> <span style="color: #008800; font-weight: bold;">left</span>;
<span style="color: #008800; font-weight: bold;">cursor</span><span style="color: #333333;">:</span> <span style="color: #008800; font-weight: bold;">pointer</span>;
<span style="color: #008800; font-weight: bold;">margin-top</span><span style="color: #333333;">:</span><span style="color: #6600ee; font-weight: bold;">10px</span>;
<span style="color: #008800; font-weight: bold;">margin-left</span><span style="color: #333333;">:</span><span style="color: #6600ee; font-weight: bold;">112px</span>;
<span style="color: #008800; font-weight: bold;">background</span><span style="color: #333333;">:</span> <span style="color: #008800; font-weight: bold;">transparent</span>;
<span style="color: #008800; font-weight: bold;">width</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">100px</span>;
<span style="color: #008800; font-weight: bold;">font-size</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">100</span><span style="color: #333333;">%</span>;
<span style="color: #008800; font-weight: bold;">color</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">#024d8e</span>
}
<span style="color: #0066bb; font-weight: bold;">#contact-area</span> <span style="color: #007700;">input</span><span style="color: #333333;">[</span><span style="color: #007700;">type</span><span style="color: #333333;">=</span><span style="background-color: #fff0f0;">"submit"</span><span style="color: #333333;">]</span><span style="color: #555555; font-weight: bold;">:hover</span>{
<span style="color: #008800; font-weight: bold;">border</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">2px</span> <span style="color: #008800; font-weight: bold;">solid</span> <span style="color: #6600ee; font-weight: bold;">#900</span>;
}
<span style="color: #0066bb; font-weight: bold;">#recaptcha_widget_div</span> {
<span style="color: #008800; font-weight: bold;">margin-top</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">20px</span>;
<span style="color: #008800; font-weight: bold;">margin-bottom</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">10px</span>;
<span style="color: #008800; font-weight: bold;">margin-left</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">112px</span>;
}
<span style="color: #0066bb; font-weight: bold;">#recaptcha_fail_div</span> {
<span style="color: #008800; font-weight: bold;">margin-top</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">20px</span>;
<span style="color: #008800; font-weight: bold;">margin-bottom</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">10px</span>;
<span style="color: #008800; font-weight: bold;">margin-left</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">112px</span>;
<span style="color: #008800; font-weight: bold;">border</span><span style="color: #333333;">:</span><span style="color: #008800; font-weight: bold;">medium</span> <span style="color: #008800; font-weight: bold;">groove</span> <span style="color: #6600ee; font-weight: bold;">#A00</span>;
<span style="color: #008800; font-weight: bold;">border</span><span style="color: #333333;">-</span>radius<span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">5px</span>;
<span style="color: #008800; font-weight: bold;">border</span><span style="color: #333333;">:</span><span style="color: #008800; font-weight: bold;">medium</span> <span style="color: #008800; font-weight: bold;">groove</span> <span style="color: #6600ee; font-weight: bold;">#A00</span>;
<span style="color: #008800; font-weight: bold;">padding</span><span style="color: #333333;">:</span><span style="color: #6600ee; font-weight: bold;">3px</span>;
<span style="color: #008800; font-weight: bold;">background-color</span><span style="color: #333333;">:</span><span style="color: #008800; font-weight: bold;">transparent</span>;
<span style="color: #008800; font-weight: bold;">width</span><span style="color: #333333;">:</span><span style="color: #6600ee; font-weight: bold;">350px</span>;
<span style="color: #008800; font-weight: bold;">color</span><span style="color: #333333;">:</span><span style="color: #6600ee; font-weight: bold;">#900</span>;
<span style="color: #008800; font-weight: bold;">font-weight</span><span style="color: #333333;">:</span><span style="color: #008800; font-weight: bold;">bold</span>;
<span style="color: #008800; font-weight: bold;">font-size</span><span style="color: #333333;">:</span><span style="color: #6600ee; font-weight: bold;">80</span><span style="color: #333333;">%</span>;
}
<span style="color: #007700;"></style></span>
<span style="color: #007700;"></head></span>
<span style="color: #007700;"><body></span>
<span style="color: #007700;"><div</span> <span style="color: #0000cc;">id=</span><span style="background-color: #fff0f0;">"contact-wrapper"</span><span style="color: #007700;">></span>
<span style="color: #007700;"><div</span> <span style="color: #0000cc;">id=</span><span style="background-color: #fff0f0;">"contact-area"</span><span style="color: #007700;">></span>
<span style="color: #007700;"><form</span> <span style="color: #0000cc;">method=</span><span style="background-color: #fff0f0;">"post"</span> <span style="color: #0000cc;">action=</span><span style="background-color: #fff0f0;">""</span><span style="color: #007700;">></span>
<span style="color: #007700;"><label</span> <span style="color: #0000cc;">for=</span><span style="background-color: #fff0f0;">"Name"</span><span style="color: #007700;">><span</span> <span style="color: #0000cc;">style=</span><span style="background-color: #fff0f0;">"color: red; font-size: 100%"</span><span style="color: #007700;">></span>*<span style="color: #880000; font-weight: bold;">&nbsp;</span><span style="color: #007700;"></span></span>Name:<span style="color: #007700;"></label></span>
<span style="color: #007700;"><input</span> <span style="color: #0000cc;">type=</span><span style="background-color: #fff0f0;">"text"</span> <span style="color: #0000cc;">name=</span><span style="background-color: #fff0f0;">"Name"</span> <span style="color: #0000cc;">id=</span><span style="background-color: #fff0f0;">"Name"</span> <span style="color: #0000cc;">value=</span><span style="background-color: #fff0f0;">"</span><span style="color: #557799;"><?php</span> <span style="color: #008800; font-weight: bold;">echo</span> <span style="color: #007020;">isset</span>(<span style="color: #996633;">$_POST</span>[<span style="background-color: #fff0f0;">'Name'</span>]) <span style="color: #333333;">?</span> <span style="color: #996633;">$_POST</span>[<span style="background-color: #fff0f0;">'Name'</span>] <span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">''</span> <span style="color: #557799;">?></span><span style="background-color: #fff0f0;">"</span> <span style="color: #007700;">/></span>
<span style="color: #007700;"><label</span> <span style="color: #0000cc;">for=</span><span style="background-color: #fff0f0;">"City"</span><span style="color: #007700;">></span>City:<span style="color: #007700;"></label></span>
<span style="color: #007700;"><input</span> <span style="color: #0000cc;">type=</span><span style="background-color: #fff0f0;">"text"</span> <span style="color: #0000cc;">name=</span><span style="background-color: #fff0f0;">"City"</span> <span style="color: #0000cc;">id=</span><span style="background-color: #fff0f0;">"City"</span> <span style="color: #0000cc;">value=</span><span style="background-color: #fff0f0;">"</span><span style="color: #557799;"><?php</span> <span style="color: #008800; font-weight: bold;">echo</span> <span style="color: #007020;">isset</span>(<span style="color: #996633;">$_POST</span>[<span style="background-color: #fff0f0;">'City'</span>]) <span style="color: #333333;">?</span> <span style="color: #996633;">$_POST</span>[<span style="background-color: #fff0f0;">'City'</span>] <span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">''</span> <span style="color: #557799;">?></span><span style="background-color: #fff0f0;">"</span> <span style="color: #007700;">/></span>
<span style="color: #007700;"><label</span> <span style="color: #0000cc;">for=</span><span style="background-color: #fff0f0;">"Email"</span><span style="color: #007700;">><span</span> <span style="color: #0000cc;">style=</span><span style="background-color: #fff0f0;">"color: red; font-size: 100%"</span><span style="color: #007700;">></span>*<span style="color: #880000; font-weight: bold;">&nbsp;</span><span style="color: #007700;"></span></span>Email:<span style="color: #007700;"></label></span>
<span style="color: #007700;"><input</span> <span style="color: #0000cc;">type=</span><span style="background-color: #fff0f0;">"text"</span> <span style="color: #0000cc;">name=</span><span style="background-color: #fff0f0;">"Email"</span> <span style="color: #0000cc;">id=</span><span style="background-color: #fff0f0;">"Email"</span> <span style="color: #0000cc;">value=</span><span style="background-color: #fff0f0;">"</span><span style="color: #557799;"><?php</span> <span style="color: #008800; font-weight: bold;">echo</span> <span style="color: #007020;">isset</span>(<span style="color: #996633;">$_POST</span>[<span style="background-color: #fff0f0;">'Email'</span>]) <span style="color: #333333;">?</span> <span style="color: #996633;">$_POST</span>[<span style="background-color: #fff0f0;">'Email'</span>] <span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">''</span> <span style="color: #557799;">?></span><span style="background-color: #fff0f0;">"</span> <span style="color: #007700;">/></span>
<span style="color: #007700;"><label</span> <span style="color: #0000cc;">for=</span><span style="background-color: #fff0f0;">"Subject"</span><span style="color: #007700;">></span>Subject:<span style="color: #007700;"></label></span>
<span style="color: #007700;"><input</span> <span style="color: #0000cc;">type=</span><span style="background-color: #fff0f0;">"text"</span> <span style="color: #0000cc;">name=</span><span style="background-color: #fff0f0;">"Subject"</span> <span style="color: #0000cc;">id=</span><span style="background-color: #fff0f0;">"Subject"</span> <span style="color: #0000cc;">value=</span><span style="background-color: #fff0f0;">"</span><span style="color: #557799;"><?php</span> <span style="color: #008800; font-weight: bold;">echo</span> <span style="color: #007020;">isset</span>(<span style="color: #996633;">$_POST</span>[<span style="background-color: #fff0f0;">'Subject'</span>]) <span style="color: #333333;">?</span> <span style="color: #996633;">$_POST</span>[<span style="background-color: #fff0f0;">'Subject'</span>] <span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">''</span> <span style="color: #557799;">?></span><span style="background-color: #fff0f0;">"</span> <span style="color: #007700;">/></span>
<span style="color: #007700;"><label</span> <span style="color: #0000cc;">for=</span><span style="background-color: #fff0f0;">"Message"</span><span style="color: #007700;">><span</span> <span style="color: #0000cc;">style=</span><span style="background-color: #fff0f0;">"color: red; font-size: 100%"</span><span style="color: #007700;">></span>*<span style="color: #880000; font-weight: bold;">&nbsp;</span><span style="color: #007700;"></span></span>Message:<span style="color: #007700;"></label></span>
<span style="color: #007700;"><textarea</span> <span style="color: #0000cc;">name=</span><span style="background-color: #fff0f0;">"Message"</span> <span style="color: #0000cc;">rows=</span><span style="background-color: #fff0f0;">"20"</span> <span style="color: #0000cc;">cols=</span><span style="background-color: #fff0f0;">"20"</span> <span style="color: #0000cc;">id=</span><span style="background-color: #fff0f0;">"Message"</span><span style="color: #007700;">></span><span style="color: #557799;"><?php</span> <span style="color: #008800; font-weight: bold;">echo</span> <span style="color: #007020;">isset</span>(<span style="color: #996633;">$_POST</span>[<span style="background-color: #fff0f0;">'Message'</span>]) <span style="color: #333333;">?</span> <span style="color: #996633;">$_POST</span>[<span style="background-color: #fff0f0;">'Message'</span>] <span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">''</span> <span style="color: #557799;">?></span><span style="color: #007700;"></textarea></span>
<span style="color: #007700;"><p</span> <span style="color: #0000cc;">style=</span><span style="background-color: #fff0f0;">"margin:20px auto 10px 112px;"</span><span style="color: #007700;">></span>Fields shown by <span style="color: #007700;"><span</span> <span style="color: #0000cc;">style=</span><span style="background-color: #fff0f0;">"color: red; font-size: 100%"</span><span style="color: #007700;">></span>*<span style="color: #880000; font-weight: bold;">&nbsp;</span><span style="color: #007700;"></span></span> are required.<span style="color: #007700;"></p></span>
<span style="color: #007700;"><div</span> <span style="color: #0000cc;">id=</span><span style="background-color: #fff0f0;">"recaptcha_widget_div"</span><span style="color: #007700;">></span>
<span style="color: #557799;"><?php</span>
<span style="color: #008800; font-weight: bold;">require_once</span>(<span style="background-color: #fff0f0;">'recaptchalib.php'</span>);
<span style="color: #996633;">$publickey</span> <span style="color: #333333;">=</span> <span style="background-color: #fff0f0;">"6LcJA-sSAAAAAPVPHLiHjGTlkhuWhLX2Luj3hS85"</span>; <span style="color: #888888;">// you got this from the signup page</span>
<span style="color: #008800; font-weight: bold;">echo</span> recaptcha_get_html(<span style="color: #996633;">$publickey</span>);
<span style="color: #557799;">?></span>
<span style="color: #007700;"></div></span>
<span style="color: #007700;"><input</span> <span style="color: #0000cc;">type=</span><span style="background-color: #fff0f0;">"submit"</span> <span style="color: #0000cc;">name=</span><span style="background-color: #fff0f0;">"submit"</span> <span style="color: #0000cc;">value=</span><span style="background-color: #fff0f0;">"Submit"</span> <span style="color: #0000cc;">class=</span><span style="background-color: #fff0f0;">"submit-button"</span> <span style="color: #007700;">/></span>
<span style="color: #007700;"></form></span>
<span style="color: #007700;"><div</span> <span style="color: #0000cc;">style=</span><span style="background-color: #fff0f0;">"clear: both;"</span><span style="color: #007700;">></span>
<span style="color: #007700;"></div></span>
<span style="color: #557799;"><?php</span>
<span style="color: #996633;">$visitor_ip</span> <span style="color: #333333;">=</span> getVisitorIP();
<span style="color: #996633;">$hdshake</span> <span style="color: #333333;">=</span><span style="color: #008800; font-weight: bold;">null</span>;
<span style="color: #008800; font-weight: bold;">if</span>( <span style="color: #007020;">isset</span>(<span style="color: #996633;">$_POST</span>[<span style="background-color: #fff0f0;">'submit'</span>]) ) {
<span style="color: #996633;">$error</span> <span style="color: #333333;">=</span> <span style="color: #008800; font-weight: bold;">null</span>;
<span style="color: #008800; font-weight: bold;">require_once</span>(<span style="background-color: #fff0f0;">'recaptchalib.php'</span>);
<span style="color: #996633;">$privatekey</span> <span style="color: #333333;">=</span> <span style="background-color: #fff0f0;">"6LcJA-sSAAAAABCEyOe_wqfheVwfxfu4L9idhqhv"</span>;
<span style="color: #996633;">$Name</span> <span style="color: #333333;">=</span> Trim(<span style="color: #007020;">stripslashes</span>(<span style="color: #996633;">$_POST</span>[<span style="background-color: #fff0f0;">'Name'</span>]));
<span style="color: #996633;">$City</span> <span style="color: #333333;">=</span> Trim(<span style="color: #007020;">stripslashes</span>(<span style="color: #996633;">$_POST</span>[<span style="background-color: #fff0f0;">'City'</span>]));
<span style="color: #996633;">$Email</span> <span style="color: #333333;">=</span> Trim(<span style="color: #007020;">stripslashes</span>(<span style="color: #996633;">$_POST</span>[<span style="background-color: #fff0f0;">'Email'</span>]));
<span style="color: #996633;">$Subject</span> <span style="color: #333333;">=</span> Trim(<span style="color: #007020;">stripslashes</span>(<span style="color: #996633;">$_POST</span>[<span style="background-color: #fff0f0;">'Subject'</span>]));
<span style="color: #996633;">$Message</span> <span style="color: #333333;">=</span> Trim(<span style="color: #007020;">stripslashes</span>(<span style="color: #996633;">$_POST</span>[<span style="background-color: #fff0f0;">'Message'</span>]));
<span style="color: #996633;">$hdshake</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">'<li>Your IP :&nbsp;'</span><span style="color: #333333;">.</span> <span style="color: #996633;">$visitor_ip</span> <span style="color: #333333;">.</span><span style="background-color: #fff0f0;">'</li>'</span>;
<span style="color: #996633;">$hdshake</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">'<li>Your eMail :&nbsp;'</span><span style="color: #333333;">.</span><span style="color: #996633;">$Email</span><span style="color: #333333;">.</span><span style="background-color: #fff0f0;">'</li>'</span>;
<span style="color: #008800; font-weight: bold;">echo</span> <span style="background-color: #fff0f0;">'<div id="recaptcha_fail_div"><ul>'</span><span style="color: #333333;">.</span> <span style="color: #996633;">$hdshake</span> <span style="color: #333333;">.</span><span style="background-color: #fff0f0;">'</ul></div>'</span>;
<span style="color: #008800; font-weight: bold;">if</span>( <span style="color: #333333;">!</span><span style="color: #008800; font-weight: bold;">empty</span>(<span style="color: #996633;">$Email</span>) ){
<span style="color: #008800; font-weight: bold;">list</span>(<span style="color: #996633;">$emailPart</span>, <span style="color: #996633;">$domainPart</span>) <span style="color: #333333;">=</span> <span style="color: #007020;">explode</span>(<span style="background-color: #fff0f0;">'@'</span>, <span style="color: #996633;">$Email</span>);
<span style="color: #996633;">$one</span><span style="color: #333333;">=</span><span style="color: #007020;">filter_var</span>(<span style="color: #996633;">$Email</span>, FILTER_VALIDATE_EMAIL);
<span style="color: #996633;">$two</span><span style="color: #333333;">=</span>MailIPAddress(<span style="color: #996633;">$domainPart</span>);
<span style="color: #008800; font-weight: bold;">if</span> (<span style="color: #333333;">!</span>((<span style="color: #996633;">$one</span>) <span style="color: #333333;">&&</span> (<span style="color: #996633;">$two</span>))) {
<span style="color: #996633;">$error</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">'<li>Email is invalid .</li>'</span>;
<span style="color: #008800; font-weight: bold;">echo</span> <span style="background-color: #fff0f0;">'<div id="recaptcha_fail_div"> <ul>'</span><span style="color: #333333;">.</span> <span style="color: #996633;">$error</span> <span style="color: #333333;">.</span><span style="background-color: #fff0f0;">'</ul></div>'</span>;
<span style="color: #008800; font-weight: bold;">exit</span>();
}
}
<span style="color: #996633;">$error</span> <span style="color: #333333;">.=</span> ( <span style="color: #008800; font-weight: bold;">empty</span>(<span style="color: #996633;">$Name</span>) ) <span style="color: #333333;">?</span> <span style="background-color: #fff0f0;">'<li>Please enter your name.</li>'</span> <span style="color: #333333;">:</span> <span style="color: #008800; font-weight: bold;">null</span>;
<span style="color: #996633;">$error</span> <span style="color: #333333;">.=</span> ( <span style="color: #008800; font-weight: bold;">empty</span>(<span style="color: #996633;">$Email</span>) ) <span style="color: #333333;">?</span> <span style="background-color: #fff0f0;">'<li>Blank Email is not accepted.</li>'</span> <span style="color: #333333;">:</span> <span style="color: #008800; font-weight: bold;">null</span>;
<span style="color: #996633;">$error</span> <span style="color: #333333;">.=</span> ( <span style="color: #008800; font-weight: bold;">empty</span>(<span style="color: #996633;">$Message</span>) ) <span style="color: #333333;">?</span> <span style="background-color: #fff0f0;">'<li>Please enter some comments or questions.</li>'</span> <span style="color: #333333;">:</span> <span style="color: #008800; font-weight: bold;">null</span>;
<span style="color: #996633;">$resp</span> <span style="color: #333333;">=</span> recaptcha_check_answer (<span style="color: #996633;">$privatekey</span>,
<span style="color: #996633;">$_SERVER</span>[<span style="background-color: #fff0f0;">"REMOTE_ADDR"</span>],
<span style="color: #996633;">$_POST</span>[<span style="background-color: #fff0f0;">"recaptcha_challenge_field"</span>],
<span style="color: #996633;">$_POST</span>[<span style="background-color: #fff0f0;">"recaptcha_response_field"</span>]);
<span style="color: #996633;">$error</span> <span style="color: #333333;">.=</span> ( <span style="color: #333333;">!</span>(<span style="color: #996633;">$resp</span><span style="color: #333333;">-></span><span style="color: #0000cc;">is_valid</span>) ) <span style="color: #333333;">?</span> <span style="background-color: #fff0f0;">'<li>The captcha code entered is incorrect .</li>'</span> <span style="color: #333333;">:</span> <span style="color: #008800; font-weight: bold;">null</span>;
<span style="color: #008800; font-weight: bold;">if</span> (<span style="color: #333333;">!</span><span style="color: #008800; font-weight: bold;">empty</span>(<span style="color: #996633;">$error</span>)) {
<span style="color: #888888;">// What happens when the CAPTCHA was entered incorrectly</span>
<span style="color: #008800; font-weight: bold;">echo</span> <span style="background-color: #fff0f0;">'<div id="recaptcha_fail_div"> <ul>'</span><span style="color: #333333;">.</span> <span style="color: #996633;">$error</span> <span style="color: #333333;">.</span><span style="background-color: #fff0f0;">'</ul></div>'</span>;
<span style="color: #008800; font-weight: bold;">exit</span>();
}
<span style="color: #888888;">//Next send contact to website admin.</span>
<span style="color: #996633;">$EmailToAdmin</span> <span style="color: #333333;">=</span> <span style="background-color: #fff0f0;">"carlo.dj@messiahpsychoanalyst.org"</span>; <span style="color: #888888;">//Put your website admin email here. Don't forget quotes. </span>
<span style="color: #888888;">// body of the email your own admin receives</span>
<span style="color: #996633;">$Body</span> <span style="color: #333333;">=</span> <span style="background-color: #fff0f0;">"RE: Contact from visitors"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"Name: "</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="color: #996633;">$Name</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"City: "</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="color: #996633;">$City</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"Subject: "</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="color: #996633;">$Subject</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"Email: "</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="color: #996633;">$Email</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"Visitor's IP: "</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="color: #996633;">$visitor_ip</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"Message: "</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="color: #996633;">$Message</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #888888;">// send email to admin</span>
<span style="color: #996633;">$posted</span> <span style="color: #333333;">=</span> <span style="color: #007020;">mail</span>(<span style="color: #996633;">$EmailToAdmin</span>, <span style="color: #996633;">$Subject</span>, <span style="color: #996633;">$Body</span>, <span style="background-color: #fff0f0;">"From: <</span><span style="background-color: #eeeeee;">$Email</span><span style="background-color: #fff0f0;">>"</span>);
<span style="color: #888888;">// redirect to thanks page </span>
<span style="color: #008800; font-weight: bold;">if</span> (<span style="color: #996633;">$posted</span>){
<span style="color: #008800; font-weight: bold;">echo</span> <span style="background-color: #fff0f0;">'<div style=\'margin-top: 20px; margin-left:112px; border: 2px groove blue; border=radius:5px; padding-left: 10px; width:400px;\'></span>
<span style="background-color: #fff0f0;"> <p>Thanks By <a href="http://messiahpsychoanalyst.org">Dysprosium</a></p></span>
<span style="background-color: #fff0f0;"> <hr style=\'margin: 1px auto 1px auto; height: 1px; color: #fefefe; width: 82%;\'/> </span>
<span style="background-color: #fff0f0;"> <h1>Your message has been sent! Thanks for Your Message!</h1></span>
<span style="background-color: #fff0f0;"> <p><a href="Default.html">Click to go to Home page!</a></p></span>
<span style="background-color: #fff0f0;"> </div>'</span>;
<span style="color: #888888;">//After thank you send an email containing his message to the visitor</span>
<span style="color: #888888;">// prepare email body text</span>
<span style="color: #996633;">$Body</span> <span style="color: #333333;">=</span> <span style="background-color: #fff0f0;">" Madam/Sir,</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;"> Thank you for your message.</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;"> Dysprosium.</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">" ======================================================</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"Name: "</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="color: #996633;">$Name</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">", Esq."</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"From: "</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="color: #996633;">$City</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"Email: "</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="color: #996633;">$Email</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"Subject: "</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="color: #996633;">$Subject</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"Message: "</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="color: #996633;">$Message</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #888888;">// send email </span>
<span style="color: #007020;">mail</span>(<span style="color: #996633;">$Email</span>, <span style="color: #996633;">$Subject</span>, <span style="color: #996633;">$Body</span>, <span style="background-color: #fff0f0;">"From: <</span><span style="background-color: #eeeeee;">$EmailToAdmin</span><span style="background-color: #fff0f0;">>"</span>);
}
}
<span style="color: #008800; font-weight: bold;">else</span>{
<span style="color: #008800; font-weight: bold;">echo</span> <span style="background-color: #fff0f0;">'<div id="recaptcha_fail_div">&nbsp;&nbsp;Your IP :&nbsp;'</span><span style="color: #333333;">.</span> <span style="color: #996633;">$visitor_ip</span> <span style="color: #333333;">.</span><span style="background-color: #fff0f0;">'</div>'</span>;
}
<span style="color: #557799;">?></span>
<span style="color: #007700;"></div></span>
<span style="color: #007700;"></div></span>
<span style="color: #557799;"><?Php</span>
<span style="color: #dd4422;">/**</span>
<span style="color: #dd4422;"> * http://www.electrictoolbox.com/php-get-mail-server-ip-address/</span>
<span style="color: #dd4422;"> * Get a mail server's IP address with PHP</span>
<span style="color: #dd4422;"> * Posted November 9th, 2012 in PHP by Chris Hope</span>
<span style="color: #dd4422;"> * Returns an IP address that mail can be delivered to for the passed in domain.</span>
<span style="color: #dd4422;"> *</span>
<span style="color: #dd4422;"> **/</span>
<span style="color: #008800; font-weight: bold;">function</span> <span style="color: #0066bb; font-weight: bold;">MailIPAddress</span>(<span style="color: #996633;">$domain</span>) {
<span style="color: #996633;">$ip</span> <span style="color: #333333;">=</span> <span style="color: #008800; font-weight: bold;">false</span>;
<span style="color: #996633;">$records</span> <span style="color: #333333;">=</span> <span style="color: #007020;">dns_get_record</span>(<span style="color: #996633;">$domain</span>, DNS_MX);
<span style="color: #996633;">$priority</span> <span style="color: #333333;">=</span> <span style="color: #008800; font-weight: bold;">null</span>;
<span style="color: #008800; font-weight: bold;">foreach</span> (<span style="color: #996633;">$records</span> <span style="color: #008800; font-weight: bold;">as</span> <span style="color: #996633;">$record</span>) {
<span style="color: #008800; font-weight: bold;">if</span> (<span style="color: #996633;">$priority</span> <span style="color: #333333;">==</span> <span style="color: #008800; font-weight: bold;">null</span> <span style="color: #333333;">||</span> <span style="color: #996633;">$record</span>[<span style="background-color: #fff0f0;">'pri'</span>] <span style="color: #333333;"><</span> <span style="color: #996633;">$priority</span>) {
<span style="color: #996633;">$myip</span> <span style="color: #333333;">=</span> <span style="color: #007020;">gethostbyname</span>(<span style="color: #996633;">$record</span>[<span style="background-color: #fff0f0;">'target'</span>]);
<span style="color: #888888;">// if the value returned is the same, then the lookup failed</span>
<span style="color: #008800; font-weight: bold;">if</span> (<span style="color: #996633;">$myip</span> <span style="color: #333333;">!=</span> <span style="color: #996633;">$record</span>[<span style="background-color: #fff0f0;">'target'</span>]) {
<span style="color: #996633;">$ip</span> <span style="color: #333333;">=</span> <span style="color: #996633;">$myip</span>;
<span style="color: #996633;">$priority</span> <span style="color: #333333;">=</span> <span style="color: #996633;">$record</span>[<span style="background-color: #fff0f0;">'pri'</span>];
}
}
}
<span style="color: #008800; font-weight: bold;">if</span> (<span style="color: #333333;">!</span><span style="color: #996633;">$ip</span>) {
<span style="color: #996633;">$ip</span> <span style="color: #333333;">=</span> <span style="color: #007020;">gethostbyname</span>(<span style="color: #996633;">$domain</span>);
<span style="color: #888888;">// if the value returned is the same, then the lookup failed</span>
<span style="color: #008800; font-weight: bold;">if</span> (<span style="color: #996633;">$ip</span> <span style="color: #333333;">==</span> <span style="color: #996633;">$domain</span>) {
<span style="color: #996633;">$ip</span> <span style="color: #333333;">=</span> <span style="color: #008800; font-weight: bold;">false</span>;
}
}
<span style="color: #008800; font-weight: bold;">return</span> <span style="color: #996633;">$ip</span>;
}
<span style="color: #557799;">?></span>
<span style="color: #557799;"><?php</span>
<span style="color: #008800; font-weight: bold;">function</span> <span style="color: #0066bb; font-weight: bold;">getVisitorIP</span>() {
<span style="color: #996633;">$client</span> <span style="color: #333333;">=</span> <span style="color: #333333;">@</span><span style="color: #996633;">$_SERVER</span>[<span style="background-color: #fff0f0;">'HTTP_CLIENT_IP'</span>];
<span style="color: #996633;">$forward</span> <span style="color: #333333;">=</span> <span style="color: #333333;">@</span><span style="color: #996633;">$_SERVER</span>[<span style="background-color: #fff0f0;">'HTTP_X_FORWARDED_FOR'</span>];
<span style="color: #996633;">$remote</span> <span style="color: #333333;">=</span> <span style="color: #996633;">$_SERVER</span>[<span style="background-color: #fff0f0;">'REMOTE_ADDR'</span>];
<span style="color: #008800; font-weight: bold;">if</span> (<span style="color: #007020;">filter_var</span>(<span style="color: #996633;">$client</span>, FILTER_VALIDATE_IP)) {
<span style="color: #996633;">$ip</span> <span style="color: #333333;">=</span> <span style="color: #996633;">$client</span>;
}
<span style="color: #008800; font-weight: bold;">else</span> {
<span style="color: #008800; font-weight: bold;">if</span> (<span style="color: #007020;">filter_var</span>(<span style="color: #996633;">$forward</span>, FILTER_VALIDATE_IP)) {
<span style="color: #996633;">$ip</span> <span style="color: #333333;">=</span> <span style="color: #996633;">$forward</span>;
}
<span style="color: #008800; font-weight: bold;">else</span> {
<span style="color: #996633;">$ip</span> <span style="color: #333333;">=</span> <span style="color: #996633;">$remote</span>;
}
}
<span style="color: #008800; font-weight: bold;">return</span> <span style="color: #996633;">$ip</span>;
}
<span style="color: #557799;">?></span>
<span style="color: #007700;"></body></span>
<span style="color: #007700;"></html></span>
</pre>
</td></tr>
</tbody></table>
</div>
<br />
Look at lines (<strong>254</strong>) to (<strong>272</strong>). A function has been added that returns <strong><em>IP</em></strong> address using <strong><em>PHP</em></strong> standard methods. This is very crude implementation of <strong><em>PHP</em></strong> and those methods should be guarded, in principle, against access to any global. Nevertheless it works for now and interested individual can do better by gaining deeper knowledge of <strong><em>PHP</em></strong>. <br />
At line (<strong>130</strong>) visitor's <em><strong>IP</strong></em> has filled variable <span style="color: #996633;">$visitor_ip</span> to be displayed later with an <strong><span style="color: #008800;">echo</span></strong> command. Line (<strong>131</strong>) defines a <span style="color: #996633;">$hdshake </span>variable to show a formatted phrase for <span style="color: #996633;">$visitor_ip</span> and <span style="color: #996633;">$Email</span> of the visitor.<br />
<!-- HTML generated using hilite.me --><br />
<div style="background: rgb(255, 255, 255); border-radius: 3px; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<table><tbody>
<tr><td><pre style="line-height: 125%; margin: 0px;">130
131</pre>
</td><td><pre style="line-height: 125%; margin: 0px;"> <span style="color: #996633;">$visitor_ip</span> <span style="color: #333333;">=</span> getVisitorIP();
<span style="color: #996633;">$hdshake</span> <span style="color: #333333;">=</span><span style="color: #008800; font-weight: bold;">null</span>;
</pre>
</td></tr>
</tbody></table>
</div>
<br />
If the visitor has attempted the contact form, then lines (<strong>141</strong>) to (<strong>143</strong>) display their <em><strong>IP</strong></em> and email. <br />
<!-- HTML generated using hilite.me --><br />
<div style="background: rgb(255, 255, 255); border-radius: 5px; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<table><tbody>
<tr><td><pre style="line-height: 125%; margin: 0px;">141
142
143</pre>
</td><td><pre style="line-height: 125%; margin: 0px;"> <span style="color: #996633;">$hdshake</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">'<li>Your IP :&nbsp;'</span><span style="color: #333333;">.</span> <span style="color: #996633;">$visitor_ip</span> <span style="color: #333333;">.</span><span style="background-color: #fff0f0;">'</li>'</span>;
<span style="color: #996633;">$hdshake</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">'<li>Your eMail :&nbsp;'</span><span style="color: #333333;">.</span><span style="color: #996633;">$Email</span><span style="color: #333333;">.</span><span style="background-color: #fff0f0;">'</li>'</span>;
<span style="color: #008800; font-weight: bold;">echo</span> <span style="background-color: #fff0f0;">'<div id="recaptcha_fail_div"><ul>'</span><span style="color: #333333;">.</span> <span style="color: #996633;">$hdshake</span> <span style="color: #333333;">.</span><span style="background-color: #fff0f0;">'</ul></div>'</span>;
</pre>
</td></tr>
</tbody></table>
</div>
<br />
Otherwise, if the visitor has just landed on the contact form page, then the page only displays his IP. This is reflected in the <strong><span style="color: #008800;">else</span></strong> phrase in lines (<strong>216</strong>) to (<strong>218</strong>).<br />
<!-- HTML generated using hilite.me --><br />
<div style="background: rgb(255, 255, 255); border-radius: 5px; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<table><tbody>
<tr><td><pre style="line-height: 125%; margin: 0px;">216
217
218</pre>
</td><td><pre style="line-height: 125%; margin: 0px;"> <span style="color: #008800; font-weight: bold;">else</span>{
<span style="color: #008800; font-weight: bold;">echo</span> <span style="background-color: #fff0f0;">'<div id="recaptcha_fail_div">&nbsp;&nbsp;Your IP :&nbsp;'</span><span style="color: #333333;">.</span> <span style="color: #996633;">$visitor_ip</span> <span style="color: #333333;">.</span><span style="background-color: #fff0f0;">'</div>'</span>;
}
</pre>
</td></tr>
</tbody></table>
</div>
<br />
Meanwhile note that lines (<strong>174</strong>) to (<strong>176</strong>), where you have sent the visitor's <strong><em>IP</em></strong> back for yourself for having further information to keep in your own database.<br />
<!-- HTML generated using hilite.me --><br />
<div style="background: rgb(255, 255, 255); border-radius: 5px; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<table><tbody>
<tr><td><pre style="line-height: 125%; margin: 0px;">174
175
176</pre>
</td><td><pre style="line-height: 125%; margin: 0px;"> <span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"Visitor's IP: "</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="color: #996633;">$visitor_ip</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
</pre>
</td></tr>
</tbody></table>
</div>
<br />
This is the snap-shot of page when visitor lands on page.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjaxwQjIo9MKB5yzWnmFn9FqVhTdZ3YXo78kdRw3jicTjxLhoSWaXhfo5w6w05pR2KCfVUZv8GocjUv9AzImSd4FmLo5xDucMUaRysA91xvrrP4ZkQGJhpvII9hZCtk6pV9eti6O9mqzks/s1600/demofinalIP.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjaxwQjIo9MKB5yzWnmFn9FqVhTdZ3YXo78kdRw3jicTjxLhoSWaXhfo5w6w05pR2KCfVUZv8GocjUv9AzImSd4FmLo5xDucMUaRysA91xvrrP4ZkQGJhpvII9hZCtk6pV9eti6O9mqzks/s1600/demofinalIP.PNG" height="612" width="640" /></a></div>
Above <strong><em>IP</em></strong> has been painted to a wrong number to avoid coincidence with some people's real <strong><em>IP</em></strong>. You can check yours by <a href="http://www.messiahpsychoanalyst.org/demoFinalIP.php" target="_blank">clicking here</a>, please. In the <a href="http://codesforus.blogspot.co.uk/2014/02/how-to-create-contact-form-for-your_427.html" target="_blank">next article</a> we collect IP's of every visit in a text file.<br />
<br />
Download <strong><em>this tutorial as PDF</em></strong> format <a href="http://messiahpsychoanalyst.org/Codesforus/ContactForm_9.pdf" target="_blank"><span style="color: #448888;">here</span></a> <br />
Download <strong><em>part 1 to part 9 as PDF</em></strong> format <a href="http://messiahpsychoanalyst.org/Codesforus/ContactForm1_9.pdf" target="_blank"><span style="color: #448888;">here</span></a> Peter Joneshttp://www.blogger.com/profile/03192918305428815983noreply@blogger.com0tag:blogger.com,1999:blog-667520058465774437.post-66377162483950451242013-12-14T16:19:00.002+00:002014-03-24T09:58:21.733+00:00How to Create a Contact Form for Your Website in an Easy Way : A Set of Step by Step Tutorials Using HTML5, CSS3 and PHP (8)<span style="color: red;">(For the latest PDF files Merger Software please have a look at the top of the left margin, inside the red box.) </span><br />
Continues From <a href="http://codesforus.blogspot.co.uk/2013/12/how-to-create-contact-form-for-your_13.html" target="_blank">Part 7</a><br />
Section 1. Failure message.<br />
Section 2. Success message.<br />
We finished the entire code (download <strong><em>PHP</em></strong> code in Zip format <a href="http://messiahpsychoanalyst.org/Codesforus/demoFinal.zip" target="_blank"><span style="color: #448888;">here</span></a> or open the code in text format <a href="http://messiahpsychoanalyst.org/Codesforus/demoFinal.txt" target="_blank"><span style="color: #448888;">here</span></a>) we needed in <a href="http://codesforus.blogspot.co.uk/2013/12/how-to-create-contact-form-for-your_13.html" target="_blank">Part (<strong>7</strong>)</a>. Now we start to understand each line. My first task is to keep the values entered into all fields as they are. That is possible by keeping "Form <em>inputs</em>" of <em><strong>HTML</strong></em> parts valid and alive using <em><strong>PHP</strong></em> built-in functions.<br />
<h4>
Section 1 : How to receive contact form failure message in the same page?</h4>
First note that the form tag action is empty and won't dispatch any action to a server-side scripting page. <br />
<!-- HTML generated using hilite.me --><br />
<div style="background: rgb(255, 255, 255); border-radius: 3px; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<pre style="line-height: 125%; margin: 0px;"><span style="color: #007700;"><span style="color: black;">101 </span><form</span> <span style="color: #0000cc;">method=</span><span style="background-color: #fff0f0;">"post"</span> <span style="color: #0000cc;">action=</span><span style="background-color: #fff0f0;">""</span><span style="color: #007700;">></span>
</pre>
</div>
<br />
Next, please look at line (<strong>103</strong>) to see how <em><strong>PHP</strong></em> puts value in an <em><strong>HTML</strong></em> tag.<br />
<!-- HTML generated using hilite.me --><br />
<div style="background: rgb(255, 255, 255); border-radius: 3px; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<pre style="line-height: 125%; margin: 0px;"><span style="color: #007700;"><span style="color: black;">103 </span><input</span> <span style="color: #0000cc;">type=</span><span style="background-color: #fff0f0;">"text"</span> <span style="color: #0000cc;">name=</span><span style="background-color: #fff0f0;">"Name"</span> <span style="color: #0000cc;">id=</span><span style="background-color: #fff0f0;">"Name"</span> <span style="color: #0000cc;">value=</span><span style="background-color: #fff0f0;">"</span><span style="color: #557799;"><?php</span> <span style="color: #008800; font-weight: bold;">echo</span> <span style="color: #007020;">isset</span>(<span style="color: #996633;">$_POST</span>[<span style="background-color: #fff0f0;">'Name'</span>]) <span style="color: #333333;">?</span> <span style="color: #996633;">$_POST</span>[<span style="background-color: #fff0f0;">'Name'</span>] <span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">''</span> <span style="color: #557799;">?></span><span style="background-color: #fff0f0;">"</span> <span style="color: #007700;">/></span>
</pre>
</div>
<br />
"<em>echo</em>" is the PHP print command. Then, you can see the C language <em>if-else</em> style, common in many programming languages. You can put <em>if-else</em> if you prefer the longer style. Hence, <br />
<!-- HTML generated using hilite.me --><br />
<div style="background: rgb(255, 255, 255); border-radius: 5px; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<table><tbody>
<tr><td><pre style="line-height: 125%; margin: 0px;">1
2
3
4
5
6</pre>
</td><td><pre style="line-height: 125%; margin: 0px;"><span style="color: #008800; font-weight: bold;">if</span> (some_thing){
do_some_job;
}
<span style="color: #008800; font-weight: bold;">else</span>{
do_else;
}
</pre>
</td></tr>
</tbody></table>
</div>
<br />
can be written in shorter form as, <br />
<!-- HTML generated using hilite.me --><br />
<div style="background: rgb(255, 255, 255); border-radius: 3px; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<pre style="line-height: 125%; margin: 0px;">some_thing <span style="color: #333333;">?</span> do_some_job <span style="color: #333333;">:</span> do_else<span style="color: #333333;">;</span>
</pre>
</div>
<br />
<strong><em>PHP, </em></strong>used at that position, won't need the finishing semi-colon. Therefore, if the field is empty, e.g., when you first open the page, keeps it empty; otherwise, if it has some value keeps them as they are. Also there are warning and cautions accessing super-global such as <em><strong>$_POST['Name']</strong></em> in carefully written <strong><em>PHP</em></strong> files. They need filtering functions such as using <em><strong>filter_input ( INPUT_POST, 'Name' )</strong></em> . I avoided those details for enthusiasts in learning <em><strong>PHP</strong></em>, as I found them beyond a simple contact form. You also might like to guard fields of your form with <strong><em>PHP</em></strong> function <strong><em>htmlentities </em>( )</strong>. <br />
<br />
Please note the difference of <em>textarea</em> tag. <em>textarea</em> is a legacy of ancient computing (I mean 1990's) and has its own specification. It accepts <em>carriage-return</em>, <em>new-line</em>, <em>carriage-return and new-line</em>, <em>new paragraph</em>, <em>tab</em>, <em>Home</em>, <em>End</em>, <em>Page-Down</em>, and <em>Page-Up</em> as it <em>scrolls</em>. These are not settled issues adding internationalisation problems to them ever increasingly. Anyway difference is not much. Value cannot be <em>attribute</em>d inside the tag, similar to other inputs. We put <em><strong>PHP</strong></em> code outside the tag.<br />
<!-- HTML generated using hilite.me --><br />
<div style="background: rgb(255, 255, 255); border-radius: 3px; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<pre style="line-height: 125%; margin: 0px;"><span style="color: #007700;"><span style="color: black;">115 </span><span style="color: #008800; font-weight: bold;"></span><textarea</span> <span style="color: #0000cc;">name=</span><span style="background-color: #fff0f0;">"Message"</span> <span style="color: #0000cc;">rows=</span><span style="background-color: #fff0f0;">"20"</span> <span style="color: #0000cc;">cols=</span><span style="background-color: #fff0f0;">"20"</span> <span style="color: #0000cc;">id=</span><span style="background-color: #fff0f0;">"Message"</span><span style="color: #007700;">></span><span style="color: #557799;"><?php</span> <span style="color: #008800; font-weight: bold;">echo</span> <span style="color: #007020;">isset</span>(<span style="color: #996633;">$_POST</span>[<span style="background-color: #fff0f0;">'Message'</span>]) <span style="color: #333333;">?</span> <span style="color: #996633;">$_POST</span>[<span style="background-color: #fff0f0;">'Message'</span>] <span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">''</span> <span style="color: #557799;">?></span><span style="color: #007700;"></textarea></span>
</pre>
</div>
<br />
Now bring your server-side <em>demoPoster.php</em> file into your <em><strong>HTML</strong></em> contact form. Remember that you have saved your contact form as a <em><strong>PHP</strong></em> file with .php extension. Here I have called it <em>demoFinal.php.</em><br />
<br />
You may notice some changes from previous <em>demoPoster.php</em>. All the code becomes active on the condition that you "<em>submit</em>" the form. Otherwise when a user opens the page for the first time it will dispatch errors regarding empty fields and wrong reCaptcha. This is line <strong>(130),</strong><br />
<!-- HTML generated using hilite.me --><br />
<div style="background: rgb(255, 255, 255); border-radius: 3px; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<pre style="line-height: 125%; margin: 0px;"><span style="color: black;">130</span> <span style="color: #008800; font-weight: bold;">if</span>( <span style="color: #007020;">isset</span>(<span style="color: #996633;">$_POST</span>[<span style="background-color: #fff0f0;">'submit'</span>]) ) {
</pre>
</div>
<br />
and ends at line <strong>(223).</strong> <br />
<br />
In the next line <strong>(131)</strong> we have identified and initialised a place holder for errors of the visitor. <br />
<!-- HTML generated using hilite.me --><br />
<div style="background: rgb(255, 255, 255); border-radius: 3px; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<table><tbody>
<tr><td><pre style="line-height: 125%; margin: 0px;">130</pre>
</td><td><pre style="line-height: 125%; margin: 0px;"> <span style="color: #996633;">$error</span> <span style="color: #333333;">=</span> <span style="color: #008800; font-weight: bold;">null</span>;
</pre>
</td></tr>
</tbody></table>
</div>
<br />
Call to <em>recaptchlib.php</em> library and introducing the "private key" is done in next two lines (<strong>132</strong>) and (<strong>133</strong>).<br />
<!-- HTML generated using hilite.me --><br />
<div style="background: rgb(255, 255, 255); border-radius: 3px; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<table><tbody>
<tr><td><pre style="line-height: 125%; margin: 0px;">132
133</pre>
</td><td><pre style="line-height: 125%; margin: 0px;"><span style="color: #557799;"> </span> <span style="color: #008800; font-weight: bold;">require_once</span>(<span style="background-color: #fff0f0;">'recaptchalib.php'</span>);
<span style="color: #996633;">$privatekey</span> <span style="color: #333333;">=</span> <span style="background-color: #fff0f0;">"xxxxx-xxxxxxxxxxxxx_xxxxxxxxxxxxxxxxxxxx"</span>;
</pre>
</td></tr>
</tbody></table>
</div>
<br />
Logical flow here has been improved. At first stage we test if the "<em>email</em>" field is not empty then we test it to follow the correct format of email and we check that it originates from a really existing domain. In future, we test if the email account bounces or is notorious for spamming, then IP of the sender becomes blacklisted for our website. For now, those available tests have been moved to lines (<strong>139</strong>) to (<strong>148</strong>).<br />
<!-- HTML generated using hilite.me --><br />
<div style="background: rgb(255, 255, 255); border-radius: 7px; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<table><tbody>
<tr><td><pre style="line-height: 125%; margin: 0px;"> 139
140
141
142
143
144
145
146
147
148</pre>
</td><td><pre style="line-height: 125%; margin: 0px;"> <span style="color: #008800; font-weight: bold;">if</span>( <span style="color: #333333;">!</span><span style="color: #008800; font-weight: bold;">empty</span>(<span style="color: #996633;">$Email</span>) ){
<span style="color: #008800; font-weight: bold;">list</span>(<span style="color: #996633;">$emailPart</span>, <span style="color: #996633;">$domainPart</span>) <span style="color: #333333;">=</span> <span style="color: #007020;">explode</span>(<span style="background-color: #fff0f0;">'@'</span>, <span style="color: #996633;">$Email</span>);
<span style="color: #996633;">$one</span><span style="color: #333333;">=</span><span style="color: #007020;">filter_var</span>(<span style="color: #996633;">$Email</span>, FILTER_VALIDATE_EMAIL);
<span style="color: #996633;">$two</span><span style="color: #333333;">=</span>MailIPAddress(<span style="color: #996633;">$domainPart</span>);
<span style="color: #008800; font-weight: bold;">if</span> (<span style="color: #333333;">!</span>((<span style="color: #996633;">$one</span>) <span style="color: #333333;">&&</span> (<span style="color: #996633;">$two</span>))) {
<span style="color: #996633;">$error</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">'<li>Email is invalid .</li>'</span>;
<span style="color: #008800; font-weight: bold;">echo</span> <span style="background-color: #fff0f0;">'<div id="recaptcha_fail_div"> <ul>'</span><span style="color: #333333;">.</span> <span style="color: #996633;">$error</span> <span style="color: #333333;">.</span><span style="background-color: #fff0f0;">'</ul></div>'</span>;
<span style="color: #008800; font-weight: bold;">exit</span>();
}
}
</pre>
</td></tr>
</tbody></table>
</div>
<br />
For the first time, in line (<strong>144</strong>) our variable <span style="color: #996633;">$error</span> becomes filled, should the visitor's email not complying our criteria. Pay attention to <em><strong>PHP</strong></em> operator <strong>.=</strong> which adds the new error to previous value of <span style="color: #996633;">$error</span> (it was already <strong><span style="color: #008800;">null </span></strong>). This error will be reflected in a formatted box. I have itemised it to be unified with the format of other occurring errors. Here, contact form dispatches the error and exits since it cannot accept the other fields without a valid email. Error box becomes activated by the <strong><span style="color: #008800;">echo </span></strong>command of <em><strong>PHP</strong></em>. That happens in the line (<strong>145</strong>). Please have a look at this image.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhDhHRF6t06IKhVBfBpCuLalhCZTpW4ZUg2xw6A8pLLojPpYR4yPeqw6L8rgnf2cCq7nwhFIoaLd3eImzuVSnPCd5V1-N4wg-EZ3rpjgK-puZivQ730_XZaFC1I3745zMD-UWmRWSVvtZA/s1600/cfusemailerro.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhDhHRF6t06IKhVBfBpCuLalhCZTpW4ZUg2xw6A8pLLojPpYR4yPeqw6L8rgnf2cCq7nwhFIoaLd3eImzuVSnPCd5V1-N4wg-EZ3rpjgK-puZivQ730_XZaFC1I3745zMD-UWmRWSVvtZA/s640/cfusemailerro.PNG" height="633" width="640" /></a></div>
<br />
Flow of the "<em>if </em>" test terminates the job by <strong><span style="color: #008800;">exit</span></strong>() command in the line (<strong>146</strong>); therefore, it does not need any <em>"else"</em> phrase.<br />
<br />
If the users email looks all right, then flow of the program continues to check other errors (<span style="color: #996633;">$error</span> at this point still is <strong><span style="color: #008800;">null</span></strong> ) for the required fields, through lines (<strong>149</strong>) to (<strong>151</strong>). Each line tests for an empty required field (remember that email already had <strong><em>not</em></strong> been checked for being empty) and in case will add one item to error box in an itemised format.<br />
<!-- HTML generated using hilite.me --><br />
<div style="background: rgb(255, 255, 255); border-radius: 5px; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<table><tbody>
<tr><td><pre style="line-height: 125%; margin: 0px;">149
150
151</pre>
</td><td><pre style="line-height: 125%; margin: 0px;"><span style="color: #557799;"> </span> <span style="color: #996633;">$error</span> <span style="color: #333333;">.=</span> ( <span style="color: #008800; font-weight: bold;">empty</span>(<span style="color: #996633;">$Name</span>) ) <span style="color: #333333;">?</span> <span style="background-color: #fff0f0;">'<li>Please enter your name.</li>'</span> <span style="color: #333333;">:</span> <span style="color: #008800; font-weight: bold;">null</span>;
<span style="color: #996633;">$error</span> <span style="color: #333333;">.=</span> ( <span style="color: #008800; font-weight: bold;">empty</span>(<span style="color: #996633;">$Email</span>) ) <span style="color: #333333;">?</span> <span style="background-color: #fff0f0;">'<li>Blank Email is not accepted.</li>'</span> <span style="color: #333333;">:</span> <span style="color: #008800; font-weight: bold;">null</span>;
<span style="color: #996633;">$error</span> <span style="color: #333333;">.=</span> ( <span style="color: #008800; font-weight: bold;">empty</span>(<span style="color: #996633;">$Message</span>) ) <span style="color: #333333;">?</span> <span style="background-color: #fff0f0;">'<li>Please enter some comments or questions.</li>'</span> <span style="color: #333333;">:</span> <span style="color: #008800; font-weight: bold;">null</span>;
</pre>
</td></tr>
</tbody></table>
</div>
<br />
Lines (<strong>153</strong>) to (<strong>157</strong>) get error of reCaptcha field. (It is believed reCaptcha solutions help improve artificial intelligence software that digitise scanned books and documents.) Should reCaptcha field not entered correctly then an error would be added to potential errors.<br />
<!-- HTML generated using hilite.me --><br />
<div style="background: rgb(255, 255, 255); border-radius: 6px; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<table><tbody>
<tr><td><pre style="line-height: 125%; margin: 0px;">153
154
155
156
157</pre>
</td><td><pre style="line-height: 125%; margin: 0px;"> <span style="color: #996633;">$resp</span> <span style="color: #333333;">=</span> recaptcha_check_answer (<span style="color: #996633;">$privatekey</span>,
<span style="color: #996633;">$_SERVER</span>[<span style="background-color: #fff0f0;">"REMOTE_ADDR"</span>],
<span style="color: #996633;">$_POST</span>[<span style="background-color: #fff0f0;">"recaptcha_challenge_field"</span>],
<span style="color: #996633;">$_POST</span>[<span style="background-color: #fff0f0;">"recaptcha_response_field"</span>]);
<span style="color: #996633;">$error</span> <span style="color: #333333;">.=</span> ( <span style="color: #333333;">!</span>(<span style="color: #996633;">$resp</span><span style="color: #333333;">-></span><span style="color: #0000cc;">is_valid</span>) ) <span style="color: #333333;">?</span> <span style="background-color: #fff0f0;">'<li>The captcha code entered is incorrect .</li>'</span> <span style="color: #333333;">:</span> <span style="color: #008800; font-weight: bold;">null</span>;
</pre>
</td></tr>
</tbody></table>
</div>
<br />
Then we do check whether <span style="color: #996633;">$error</span> is <strong><span style="color: #008800;">null </span></strong>( is empty) or not. Look at lines (<strong>158</strong>) to (<strong>162</strong>), please,<br />
<!-- HTML generated using hilite.me --><br />
<div style="background: rgb(255, 255, 255); border-radius: 6px; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<table><tbody>
<tr><td><pre style="line-height: 125%; margin: 0px;">158
159
160
161
162</pre>
</td><td><pre style="line-height: 125%; margin: 0px;"><span style="color: #008800; font-weight: bold;">if</span> (<span style="color: #333333;">!</span><span style="color: #008800; font-weight: bold;">empty</span>(<span style="color: #996633;">$error</span>)) {
<span style="color: #888888;">// What happens when the CAPTCHA was entered incorrectly</span>
<span style="color: #008800; font-weight: bold;">echo</span> <span style="background-color: #fff0f0;">'<div id="recaptcha_fail_div"> <ul>'</span><span style="color: #333333;">.</span> <span style="color: #996633;">$error</span> <span style="color: #333333;">.</span><span style="background-color: #fff0f0;">'</ul></div>'</span>;
<span style="color: #008800; font-weight: bold;">exit</span>();
}
</pre>
</td></tr>
</tbody></table>
</div>
<br />
At this stage again we do not need "<em>else</em>" for "<em>if</em>" since any error terminates flow of the job. Remaining lines are already explained. Result of errors are shown in the following snapshot.<br />
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiRTAUln5z0oDWO85n71jOcKQQPBLgucFvQgadpDAtFTUlhWp9CiH2D_6Afkq8HlbcHsAQa7EbiqGfqGjgaNgDEwWftUcz7ULHYQPo_C7-tQ0Eh-kLyZSGykSoAmC8nbJ3oEY9eN05kkt4/s1600/cfuseothererrors2.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiRTAUln5z0oDWO85n71jOcKQQPBLgucFvQgadpDAtFTUlhWp9CiH2D_6Afkq8HlbcHsAQa7EbiqGfqGjgaNgDEwWftUcz7ULHYQPo_C7-tQ0Eh-kLyZSGykSoAmC8nbJ3oEY9eN05kkt4/s1600/cfuseothererrors2.PNG" height="640" width="627" /></a></div>
<h4>
Section 2 : How to receive contact form success message in the same page?</h4>
<div class="separator" style="clear: both; text-align: left;">
What happens if the form and reCaptcha all filled correctly? Then you receive your "thank you" message in the same page. Line (<strong>188</strong>) to line (<strong>193</strong>) guarantee the print of "thanks" message in a desired format.</div>
<!-- HTML generated using hilite.me --><br />
<div style="background: rgb(255, 255, 255); border-radius: 7px; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<table><tbody>
<tr><td><pre style="line-height: 125%; margin: 0px;">188
189
190
191
192
193
</pre>
</td><td><pre style="line-height: 125%; margin: 0px;"><span style="color: #008800; font-weight: bold;">echo</span> <span style="background-color: #fff0f0;">'<div style=\'margin-top: 20px; margin-left:112px; border: 2px groove blue; border-radius:5px; padding-left: 10px; width:400px;\'></span>
<span style="background-color: #fff0f0;"> <p>Thanks By <a href="http://messiahpsychoanalyst.org">Dysprosium</a></p></span>
<span style="background-color: #fff0f0;"> <hr style=\'margin: 1px auto 1px auto; height: 1px; color: #fefefe; width: 82%;\'/> </span>
<span style="background-color: #fff0f0;"> <h1>Your message has been sent! Thanks for Your Message!</h1></span>
<span style="background-color: #fff0f0;"> <p><a href="Default.html">Click to go to Home page!</a></p></span>
<span style="background-color: #fff0f0;"> </div>'</span>;
</pre>
</td></tr>
</tbody></table>
</div>
<br />
Please look at the result.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhBbYW6DnymuJstzQrv08KIvnCnfN4QhnpbTykfWGJqDsUfUlPfhUDkLakdkXznIvYcJeb1Ci4MguXENWE6fQhY2Z2tzJxgwm8SJMOf3xroGFAIimsBwLTSZUthD7tPDI5QejEK6SNQWz8/s1600/Tutorial8_2.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhBbYW6DnymuJstzQrv08KIvnCnfN4QhnpbTykfWGJqDsUfUlPfhUDkLakdkXznIvYcJeb1Ci4MguXENWE6fQhY2Z2tzJxgwm8SJMOf3xroGFAIimsBwLTSZUthD7tPDI5QejEK6SNQWz8/s1600/Tutorial8_2.PNG" height="640" width="540" /></a></div>
Please watch this contact form by <a href="http://messiahpsychoanalyst.org/Codesforus/demoFinal.php" target="_blank">clicking this link</a>. In the <a href="http://codesforus.blogspot.co.uk/2014/02/how-to-create-contact-form-for-your.html" target="_blank">next post</a> I add code to get IP of the visitors and display it on the contact form.<br />
<br />
Download <strong><em>this tutorial as PDF</em></strong> format <a href="http://messiahpsychoanalyst.org/Codesforus/ContactForm_8.pdf" target="_blank"><span style="color: #448888;">here</span></a> <br />
Download <strong><em>part 1 to part 8 as PDF</em></strong> format <a href="http://messiahpsychoanalyst.org/Codesforus/ContactForm1_8.pdf" target="_blank"><span style="color: #448888;">here</span></a>
Peter Joneshttp://www.blogger.com/profile/03192918305428815983noreply@blogger.com0tag:blogger.com,1999:blog-667520058465774437.post-22345075492912860092013-12-13T14:32:00.000+00:002014-06-18T10:03:25.228+01:00How to Create a Contact Form for Your Website in an Easy Way : A Set of Step by Step Tutorials Using HTML5, CSS3 and PHP (7)<span style="color: red;">(For the latest PDF files Merger Software please have a look at the top of the left margin, inside the red box.)</span> <br />
Continues From <a href="http://codesforus.blogspot.co.uk/2013/12/making-contact-form-for-your-website-6_8.html" target="_blank">Part 6</a>.<br />
Perhaps noticed<span style="color: red;"> </span><span style="color: black;">that in the demoError page it requests to use browser back button to return to the half filled page; other wise, that page would be refreshed upon revisiting and loses edits of users. Hence, values of the contact form field should remain maintained as they already have been half filled and the visitor might become disappointed and frustrated filling them again. If this visitor be a potential customer you might lose them for good.</span><br />
<br />
My goal is to reflect the "Thanks" message or any other error message including reCaptcha error in the same page, without leaving the page or without losing half filled forms. <br />
<br />
I move everything to the single demoFinal.php<br />
<br />
First, let's have a look at the final code (download <strong><em>PHP</em></strong> code in Zip format <a href="http://messiahpsychoanalyst.org/Codesforus/demoFinal.zip" target="_blank"><span style="color: #448888;">here</span></a> or open the code in text format <a href="http://messiahpsychoanalyst.org/Codesforus/demoFinal.txt" target="_blank"><span style="color: #448888;">here</span></a>).<br />
<!-- HTML generated using hilite.me --><br />
<div style="background: rgb(255, 255, 255); border-radius: 8px; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<table><tbody>
<tr><td><pre style="line-height: 125%; margin: 0px;"> 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255</pre>
</td><td><pre style="line-height: 125%; margin: 0px;"><span style="color: #557799;"><!DOCTYPE html></span>
<span style="color: #888888;"><!--</span>
<span style="color: #888888;"><span style="color: #888888;">Created by Peter Jones 13 December, 2013</span></span>
<span style="color: #888888;">codesforus.blogspot.com</span>
<span style="color: #888888;">copyrights</span>
<span style="color: #888888;">--></span>
<span style="color: #007700;"><html></span>
<span style="color: #007700;"><head></span>
<span style="color: #007700;"><title></span> Demo-Final: Dysprosium Contact Form<span style="color: #007700;"></title></span>
<span style="color: #007700;"><meta</span> <span style="color: #0000cc;">charset=</span><span style="background-color: #fff0f0;">"UTF-8"</span><span style="color: #007700;">></span>
<span style="color: #007700;"><meta</span> <span style="color: #0000cc;">name=</span><span style="background-color: #fff0f0;">"viewport"</span> <span style="color: #0000cc;">content=</span><span style="background-color: #fff0f0;">"width=device-width"</span><span style="color: #007700;">></span>
<span style="color: #007700;"><script </span><span style="color: #0000cc;">type=</span><span style="background-color: #ffaaaa; color: red;"> </span><span style="background-color: #fff0f0;">"text/javascript"</span><span style="color: #007700;">></span>
<span style="color: #008800; font-weight: bold;">var</span> RecaptchaOptions <span style="color: #333333;">=</span> {
theme<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">'white'</span>
};
<span style="color: #007700;"></script></span>
<span style="color: #007700;"><style></span>
<span style="color: #0066bb; font-weight: bold;">#contact-wrapper</span> {
<span style="color: #008800; font-weight: bold;">margin</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">20px</span> <span style="color: #008800; font-weight: bold;">auto</span>;
<span style="color: #008800; font-weight: bold;">border</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">2px</span> <span style="color: #008800; font-weight: bold;">solid</span> <span style="color: #6600ee; font-weight: bold;">#ccc</span>;
<span style="color: #008800; font-weight: bold;">border</span><span style="color: #333333;">-</span>radius<span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">5px</span>;
<span style="color: #008800; font-weight: bold;">padding</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">20px</span> <span style="color: #6600ee; font-weight: bold;">50px</span> <span style="color: #6600ee; font-weight: bold;">20px</span> <span style="color: #6600ee; font-weight: bold;">50px</span>;
<span style="color: #008800; font-weight: bold;">background</span><span style="color: #333333;">:</span> <span style="color: #008800; font-weight: bold;">transparent</span>;
<span style="color: #008800; font-weight: bold;">width</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">600px</span>;
}
<span style="color: #0066bb; font-weight: bold;">#contact-area</span> {
<span style="color: #008800; font-weight: bold;">width</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">600px</span>;
<span style="color: #008800; font-weight: bold;">margin-top</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">25px</span>;
}
<span style="color: #0066bb; font-weight: bold;">#contact-area</span> <span style="color: #007700;">label</span> {
<span style="color: #008800; font-weight: bold;">float</span><span style="color: #333333;">:</span> <span style="color: #008800; font-weight: bold;">left</span>;
<span style="color: #008800; font-weight: bold;">margin-right</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">15px</span>;
<span style="color: #008800; font-weight: bold;">padding-top</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">5px</span>;
<span style="color: #008800; font-weight: bold;">width</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">100px</span>;
<span style="color: #008800; font-weight: bold;">text-align</span><span style="color: #333333;">:</span> <span style="color: #008800; font-weight: bold;">right</span>;
<span style="color: #008800; font-weight: bold;">font-size</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">100</span><span style="color: #333333;">%</span>;
}
<span style="color: #0066bb; font-weight: bold;">#contact-area</span> <span style="color: #007700;">input</span><span style="color: #333333;">,</span> <span style="color: #0066bb; font-weight: bold;">#contact-area</span> <span style="color: #007700;">textarea</span> {
<span style="color: #008800; font-weight: bold;">margin</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">0px</span> <span style="color: #6600ee; font-weight: bold;">0px</span> <span style="color: #6600ee; font-weight: bold;">10px</span> <span style="color: #6600ee; font-weight: bold;">0px</span>;
<span style="color: #008800; font-weight: bold;">border</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">2px</span> <span style="color: #008800; font-weight: bold;">solid</span> <span style="color: #6600ee; font-weight: bold;">#ccc</span>;
<span style="color: #008800; font-weight: bold;">border</span><span style="color: #333333;">-</span>radius<span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">5px</span>;
<span style="color: #008800; font-weight: bold;">padding</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">5px</span>;
<span style="color: #008800; font-weight: bold;">width</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">471px</span>;
<span style="color: #008800; font-weight: bold;">font-family</span><span style="color: #333333;">:</span> Helvetica<span style="color: #333333;">,</span> <span style="color: #008800; font-weight: bold;">sans-serif</span>;
<span style="color: #008800; font-weight: bold;">font-size</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">110</span><span style="color: #333333;">%</span>;
}
<span style="color: #0066bb; font-weight: bold;">#contact-area</span> <span style="color: #007700;">textarea</span> {
<span style="color: #008800; font-weight: bold;">height</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">90px</span>;
}
<span style="color: #0066bb; font-weight: bold;">#contact-area</span> <span style="color: #007700;">textarea</span><span style="color: #555555; font-weight: bold;">:focus</span><span style="color: #333333;">,</span> <span style="color: #0066bb; font-weight: bold;">#contact-area</span> <span style="color: #007700;">input</span><span style="color: #555555; font-weight: bold;">:focus</span> {
<span style="color: #008800; font-weight: bold;">border</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">2px</span> <span style="color: #008800; font-weight: bold;">solid</span> <span style="color: #6600ee; font-weight: bold;">#900</span>;
}
<span style="color: #0066bb; font-weight: bold;">#contact-area</span> <span style="color: #007700;">input</span><span style="color: #bb0066; font-weight: bold;">.submit-button</span> {
<span style="color: #008800; font-weight: bold;">float</span><span style="color: #333333;">:</span> <span style="color: #008800; font-weight: bold;">left</span>;
<span style="color: #008800; font-weight: bold;">cursor</span><span style="color: #333333;">:</span> <span style="color: #008800; font-weight: bold;">pointer</span>;
<span style="color: #008800; font-weight: bold;">margin-top</span><span style="color: #333333;">:</span><span style="color: #6600ee; font-weight: bold;">10px</span>;
<span style="color: #008800; font-weight: bold;">margin-left</span><span style="color: #333333;">:</span><span style="color: #6600ee; font-weight: bold;">112px</span>;
<span style="color: #008800; font-weight: bold;">background</span><span style="color: #333333;">:</span> <span style="color: #008800; font-weight: bold;">transparent</span>;
<span style="color: #008800; font-weight: bold;">width</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">100px</span>;
<span style="color: #008800; font-weight: bold;">font-size</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">100</span><span style="color: #333333;">%</span>;
<span style="color: #008800; font-weight: bold;">color</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">#024d8e</span>
}
<span style="color: #0066bb; font-weight: bold;">#contact-area</span> <span style="color: #007700;">input</span><span style="color: #333333;">[</span><span style="color: #007700;">type</span><span style="color: #333333;">=</span><span style="background-color: #fff0f0;">"submit"</span><span style="color: #333333;">]</span><span style="color: #555555; font-weight: bold;">:hover</span>{
<span style="color: #008800; font-weight: bold;">border</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">2px</span> <span style="color: #008800; font-weight: bold;">solid</span> <span style="color: #6600ee; font-weight: bold;">#900</span>;
}
<span style="color: #0066bb; font-weight: bold;">#recaptcha_widget_div</span> {
<span style="color: #008800; font-weight: bold;">margin-top</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">20px</span>;
<span style="color: #008800; font-weight: bold;">margin-bottom</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">10px</span>;
<span style="color: #008800; font-weight: bold;">margin-left</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">112px</span>;
}
<span style="color: #0066bb; font-weight: bold;">#recaptcha_fail_div</span> {
<span style="color: #008800; font-weight: bold;">margin-top</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">20px</span>;
<span style="color: #008800; font-weight: bold;">margin-bottom</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">10px</span>;
<span style="color: #008800; font-weight: bold;">margin-left</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">112px</span>;
<span style="color: #008800; font-weight: bold;">border</span><span style="color: #333333;">:</span><span style="color: #008800; font-weight: bold;">medium</span> <span style="color: #008800; font-weight: bold;">groove</span> <span style="color: #6600ee; font-weight: bold;">#A00</span>;
<span style="color: #008800; font-weight: bold;">border</span><span style="color: #333333;">-</span>radius<span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">5px</span>;
<span style="color: #008800; font-weight: bold;">border</span><span style="color: #333333;">:</span><span style="color: #008800; font-weight: bold;">medium</span> <span style="color: #008800; font-weight: bold;">groove</span> <span style="color: #6600ee; font-weight: bold;">#A00</span>;
<span style="color: #008800; font-weight: bold;">padding</span><span style="color: #333333;">:</span><span style="color: #6600ee; font-weight: bold;">3px</span>;
<span style="color: #008800; font-weight: bold;">background-color</span><span style="color: #333333;">:</span><span style="color: #008800; font-weight: bold;">transparent</span>;
<span style="color: #008800; font-weight: bold;">width</span><span style="color: #333333;">:</span><span style="color: #6600ee; font-weight: bold;">350px</span>;
<span style="color: #008800; font-weight: bold;">color</span><span style="color: #333333;">:</span><span style="color: #6600ee; font-weight: bold;">#900</span>;
<span style="color: #008800; font-weight: bold;">font-weight</span><span style="color: #333333;">:</span><span style="color: #008800; font-weight: bold;">bold</span>;
<span style="color: #008800; font-weight: bold;">font-size</span><span style="color: #333333;">:</span><span style="color: #6600ee; font-weight: bold;">80</span><span style="color: #333333;">%</span>;
}
<span style="color: #007700;"></style></span>
<span style="color: #007700;"></head></span>
<span style="color: #007700;"><body></span>
<span style="color: #007700;"><div</span> <span style="color: #0000cc;">id=</span><span style="background-color: #fff0f0;">"contact-wrapper"</span><span style="color: #007700;">></span>
<span style="color: #007700;"><div</span> <span style="color: #0000cc;">id=</span><span style="background-color: #fff0f0;">"contact-area"</span><span style="color: #007700;">></span>
<span style="color: #007700;"><form</span> <span style="color: #0000cc;">method=</span><span style="background-color: #fff0f0;">"post"</span> <span style="color: #0000cc;">action=</span><span style="background-color: #fff0f0;">""</span><span style="color: #007700;">></span>
<span style="color: #007700;"><label</span> <span style="color: #0000cc;">for=</span><span style="background-color: #fff0f0;">"Name"</span><span style="color: #007700;">><span</span> <span style="color: #0000cc;">style=</span><span style="background-color: #fff0f0;">"color: red; font-size: 100%"</span><span style="color: #007700;">></span>*<span style="color: #880000; font-weight: bold;">&nbsp;</span><span style="color: #007700;"></span></span>Name:<span style="color: #007700;"></label></span>
<span style="color: #007700;"><input</span> <span style="color: #0000cc;">type=</span><span style="background-color: #fff0f0;">"text"</span> <span style="color: #0000cc;">name=</span><span style="background-color: #fff0f0;">"Name"</span> <span style="color: #0000cc;">id=</span><span style="background-color: #fff0f0;">"Name"</span> <span style="color: #0000cc;">value=</span><span style="background-color: #fff0f0;">"</span><span style="color: #557799;"><?php</span> <span style="color: #008800; font-weight: bold;">echo</span> <span style="color: #007020;">isset</span>(<span style="color: #996633;">$_POST</span>[<span style="background-color: #fff0f0;">'Name'</span>]) <span style="color: #333333;">?</span> <span style="color: #996633;">$_POST</span>[<span style="background-color: #fff0f0;">'Name'</span>] <span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">''</span> <span style="color: #557799;">?></span><span style="background-color: #fff0f0;">"</span> <span style="color: #007700;">/></span>
<span style="color: #007700;"><label</span> <span style="color: #0000cc;">for=</span><span style="background-color: #fff0f0;">"City"</span><span style="color: #007700;">></span>City:<span style="color: #007700;"></label></span>
<span style="color: #007700;"><input</span> <span style="color: #0000cc;">type=</span><span style="background-color: #fff0f0;">"text"</span> <span style="color: #0000cc;">name=</span><span style="background-color: #fff0f0;">"City"</span> <span style="color: #0000cc;">id=</span><span style="background-color: #fff0f0;">"City"</span> <span style="color: #0000cc;">value=</span><span style="background-color: #fff0f0;">"</span><span style="color: #557799;"><?php</span> <span style="color: #008800; font-weight: bold;">echo</span> <span style="color: #007020;">isset</span>(<span style="color: #996633;">$_POST</span>[<span style="background-color: #fff0f0;">'City'</span>]) <span style="color: #333333;">?</span> <span style="color: #996633;">$_POST</span>[<span style="background-color: #fff0f0;">'City'</span>] <span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">''</span> <span style="color: #557799;">?></span><span style="background-color: #fff0f0;">"</span> <span style="color: #007700;">/></span>
<span style="color: #007700;"><label</span> <span style="color: #0000cc;">for=</span><span style="background-color: #fff0f0;">"Email"</span><span style="color: #007700;">><span</span> <span style="color: #0000cc;">style=</span><span style="background-color: #fff0f0;">"color: red; font-size: 100%"</span><span style="color: #007700;">></span>*<span style="color: #880000; font-weight: bold;">&nbsp;</span><span style="color: #007700;"></span></span>Email:<span style="color: #007700;"></label></span>
<span style="color: #007700;"><input</span> <span style="color: #0000cc;">type=</span><span style="background-color: #fff0f0;">"text"</span> <span style="color: #0000cc;">name=</span><span style="background-color: #fff0f0;">"Email"</span> <span style="color: #0000cc;">id=</span><span style="background-color: #fff0f0;">"Email"</span> <span style="color: #0000cc;">value=</span><span style="background-color: #fff0f0;">"</span><span style="color: #557799;"><?php</span> <span style="color: #008800; font-weight: bold;">echo</span> <span style="color: #007020;">isset</span>(<span style="color: #996633;">$_POST</span>[<span style="background-color: #fff0f0;">'Email'</span>]) <span style="color: #333333;">?</span> <span style="color: #996633;">$_POST</span>[<span style="background-color: #fff0f0;">'Email'</span>] <span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">''</span> <span style="color: #557799;">?></span><span style="background-color: #fff0f0;">"</span> <span style="color: #007700;">/></span>
<span style="color: #007700;"><label</span> <span style="color: #0000cc;">for=</span><span style="background-color: #fff0f0;">"Subject"</span><span style="color: #007700;">></span>Subject:<span style="color: #007700;"></label></span>
<span style="color: #007700;"><input</span> <span style="color: #0000cc;">type=</span><span style="background-color: #fff0f0;">"text"</span> <span style="color: #0000cc;">name=</span><span style="background-color: #fff0f0;">"Subject"</span> <span style="color: #0000cc;">id=</span><span style="background-color: #fff0f0;">"Subject"</span> <span style="color: #0000cc;">value=</span><span style="background-color: #fff0f0;">"</span><span style="color: #557799;"><?php</span> <span style="color: #008800; font-weight: bold;">echo</span> <span style="color: #007020;">isset</span>(<span style="color: #996633;">$_POST</span>[<span style="background-color: #fff0f0;">'Subject'</span>]) <span style="color: #333333;">?</span> <span style="color: #996633;">$_POST</span>[<span style="background-color: #fff0f0;">'Subject'</span>] <span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">''</span> <span style="color: #557799;">?></span><span style="background-color: #fff0f0;">"</span> <span style="color: #007700;">/></span>
<span style="color: #007700;"><label</span> <span style="color: #0000cc;">for=</span><span style="background-color: #fff0f0;">"Message"</span><span style="color: #007700;">><span</span> <span style="color: #0000cc;">style=</span><span style="background-color: #fff0f0;">"color: red; font-size: 100%"</span><span style="color: #007700;">></span>*<span style="color: #880000; font-weight: bold;">&nbsp;</span><span style="color: #007700;"></span></span>Message:<span style="color: #007700;"></label></span>
<span style="color: #007700;"><textarea</span> <span style="color: #0000cc;">name=</span><span style="background-color: #fff0f0;">"Message"</span> <span style="color: #0000cc;">rows=</span><span style="background-color: #fff0f0;">"20"</span> <span style="color: #0000cc;">cols=</span><span style="background-color: #fff0f0;">"20"</span> <span style="color: #0000cc;">id=</span><span style="background-color: #fff0f0;">"Message"</span><span style="color: #007700;">></span><span style="color: #557799;"><?php</span> <span style="color: #008800; font-weight: bold;">echo</span> <span style="color: #007020;">isset</span>(<span style="color: #996633;">$_POST</span>[<span style="background-color: #fff0f0;">'Message'</span>]) <span style="color: #333333;">?</span> <span style="color: #996633;">$_POST</span>[<span style="background-color: #fff0f0;">'Message'</span>] <span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">''</span> <span style="color: #557799;">?></span><span style="color: #007700;"></textarea></span>
<span style="color: #007700;"><p</span> <span style="color: #0000cc;">style=</span><span style="background-color: #fff0f0;">"margin:20px auto 10px 112px;"</span><span style="color: #007700;">></span>Fields shown by <span style="color: #007700;"><span</span> <span style="color: #0000cc;">style=</span><span style="background-color: #fff0f0;">"color: red; font-size: 100%"</span><span style="color: #007700;">></span>*<span style="color: #880000; font-weight: bold;">&nbsp;</span><span style="color: #007700;"></span></span> are required.<span style="color: #007700;"></p></span>
<span style="color: #007700;"><div</span> <span style="color: #0000cc;">id=</span><span style="background-color: #fff0f0;">"recaptcha_widget_div"</span><span style="color: #007700;">></span>
<span style="color: #557799;"><?php</span>
<span style="color: #008800; font-weight: bold;">require_once</span>(<span style="background-color: #fff0f0;">'recaptchalib.php'</span>);
<span style="color: #996633;">$publickey</span> <span style="color: #333333;">=</span> <span style="background-color: #fff0f0;">"xxxxx-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"</span>; <span style="color: #888888;">// you got this from the signup page</span>
<span style="color: #008800; font-weight: bold;">echo</span> recaptcha_get_html(<span style="color: #996633;">$publickey</span>);
<span style="color: #557799;">?></span>
<span style="color: #007700;"></div></span>
<span style="color: #007700;"><input</span> <span style="color: #0000cc;">type=</span><span style="background-color: #fff0f0;">"submit"</span> <span style="color: #0000cc;">name=</span><span style="background-color: #fff0f0;">"submit"</span> <span style="color: #0000cc;">value=</span><span style="background-color: #fff0f0;">"Submit"</span> <span style="color: #0000cc;">class=</span><span style="background-color: #fff0f0;">"submit-button"</span> <span style="color: #007700;">/></span>
<span style="color: #007700;"></form></span>
<span style="color: #007700;"><div</span> <span style="color: #0000cc;">style=</span><span style="background-color: #fff0f0;">"clear: both;"</span><span style="color: #007700;">></span>
<span style="color: #007700;"></div></span>
<span style="color: #557799;"><?php</span>
<span style="color: #008800; font-weight: bold;">if</span>( <span style="color: #007020;">isset</span>(<span style="color: #996633;">$_POST</span>[<span style="background-color: #fff0f0;">'submit'</span>]) ) {
<span style="color: #996633;">$error</span> <span style="color: #333333;">=</span> <span style="color: #008800; font-weight: bold;">null</span>;
<span style="color: #008800; font-weight: bold;">require_once</span>(<span style="background-color: #fff0f0;">'recaptchalib.php'</span>);
<span style="color: #996633;">$privatekey</span> <span style="color: #333333;">=</span> <span style="background-color: #fff0f0;">"xxxxx-xxxxxxxxxxxxx_xxxxxxxxxxxxxxxxxxxx"</span>;
<span style="color: #996633;">$Name</span> <span style="color: #333333;">=</span> Trim(<span style="color: #007020;">stripslashes</span>(<span style="color: #996633;">$_POST</span>[<span style="background-color: #fff0f0;">'Name'</span>]));
<span style="color: #996633;">$City</span> <span style="color: #333333;">=</span> Trim(<span style="color: #007020;">stripslashes</span>(<span style="color: #996633;">$_POST</span>[<span style="background-color: #fff0f0;">'City'</span>]));
<span style="color: #996633;">$Email</span> <span style="color: #333333;">=</span> Trim(<span style="color: #007020;">stripslashes</span>(<span style="color: #996633;">$_POST</span>[<span style="background-color: #fff0f0;">'Email'</span>]));
<span style="color: #996633;">$Subject</span> <span style="color: #333333;">=</span> Trim(<span style="color: #007020;">stripslashes</span>(<span style="color: #996633;">$_POST</span>[<span style="background-color: #fff0f0;">'Subject'</span>]));
<span style="color: #996633;">$Message</span> <span style="color: #333333;">=</span> Trim(<span style="color: #007020;">stripslashes</span>(<span style="color: #996633;">$_POST</span>[<span style="background-color: #fff0f0;">'Message'</span>]));
<span style="color: #008800; font-weight: bold;">if</span>( <span style="color: #333333;">!</span><span style="color: #008800; font-weight: bold;">empty</span>(<span style="color: #996633;">$Email</span>) ){
<span style="color: #008800; font-weight: bold;">list</span>(<span style="color: #996633;">$emailPart</span>, <span style="color: #996633;">$domainPart</span>) <span style="color: #333333;">=</span> <span style="color: #007020;">explode</span>(<span style="background-color: #fff0f0;">'@'</span>, <span style="color: #996633;">$Email</span>);
<span style="color: #996633;">$one</span><span style="color: #333333;">=</span><span style="color: #007020;">filter_var</span>(<span style="color: #996633;">$Email</span>, FILTER_VALIDATE_EMAIL);
<span style="color: #996633;">$two</span><span style="color: #333333;">=</span>MailIPAddress(<span style="color: #996633;">$domainPart</span>);
<span style="color: #008800; font-weight: bold;">if</span> (<span style="color: #333333;">!</span>((<span style="color: #996633;">$one</span>) <span style="color: #333333;">&&</span> (<span style="color: #996633;">$two</span>))) {
<span style="color: #996633;">$error</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">'<li>Email is invalid .</li>'</span>;
<span style="color: #008800; font-weight: bold;">echo</span> <span style="background-color: #fff0f0;">'<div id="recaptcha_fail_div"> <ul>'</span><span style="color: #333333;">.</span> <span style="color: #996633;">$error</span> <span style="color: #333333;">.</span><span style="background-color: #fff0f0;">'</ul></div>'</span>;
<span style="color: #008800; font-weight: bold;">exit</span>();
}
}
<span style="color: #996633;">$error</span> <span style="color: #333333;">.=</span> ( <span style="color: #008800; font-weight: bold;">empty</span>(<span style="color: #996633;">$Name</span>) ) <span style="color: #333333;">?</span> <span style="background-color: #fff0f0;">'<li>You must enter a name.</li>'</span> <span style="color: #333333;">:</span> <span style="color: #008800; font-weight: bold;">null</span>;
<span style="color: #996633;">$error</span> <span style="color: #333333;">.=</span> ( <span style="color: #008800; font-weight: bold;">empty</span>(<span style="color: #996633;">$Email</span>) ) <span style="color: #333333;">?</span> <span style="background-color: #fff0f0;">'<li>Email is blank.</li>'</span> <span style="color: #333333;">:</span> <span style="color: #008800; font-weight: bold;">null</span>;
<span style="color: #996633;">$error</span> <span style="color: #333333;">.=</span> ( <span style="color: #008800; font-weight: bold;">empty</span>(<span style="color: #996633;">$Message</span>) ) <span style="color: #333333;">?</span> <span style="background-color: #fff0f0;">'<li>You must enter some comments or questions.</li>'</span> <span style="color: #333333;">:</span> <span style="color: #008800; font-weight: bold;">null</span>;
<span style="color: #996633;">$resp</span> <span style="color: #333333;">=</span> recaptcha_check_answer (<span style="color: #996633;">$privatekey</span>,
<span style="color: #996633;">$_SERVER</span>[<span style="background-color: #fff0f0;">"REMOTE_ADDR"</span>],
<span style="color: #996633;">$_POST</span>[<span style="background-color: #fff0f0;">"recaptcha_challenge_field"</span>],
<span style="color: #996633;">$_POST</span>[<span style="background-color: #fff0f0;">"recaptcha_response_field"</span>]);
<span style="color: #996633;">$error</span> <span style="color: #333333;">.=</span> ( <span style="color: #333333;">!</span>(<span style="color: #996633;">$resp</span><span style="color: #333333;">-></span><span style="color: #0000cc;">is_valid</span>) ) <span style="color: #333333;">?</span> <span style="background-color: #fff0f0;">'<li>The captcha code entered is incorrect .</li>'</span> <span style="color: #333333;">:</span> <span style="color: #008800; font-weight: bold;">null</span>;
<span style="color: #008800; font-weight: bold;">if</span> (<span style="color: #333333;">!</span><span style="color: #008800; font-weight: bold;">empty</span>(<span style="color: #996633;">$error</span>)) {
<span style="color: #888888;">// What happens when the CAPTCHA was entered incorrectly</span>
<span style="color: #008800; font-weight: bold;">echo</span> <span style="background-color: #fff0f0;">'<div id="recaptcha_fail_div"> <ul>'</span><span style="color: #333333;">.</span> <span style="color: #996633;">$error</span> <span style="color: #333333;">.</span><span style="background-color: #fff0f0;">'</ul></div>'</span>;
<span style="color: #008800; font-weight: bold;">exit</span>();
}
<span style="color: #888888;">//Next send contact to website admin.</span>
<span style="color: #996633;">$EmailToAdmin</span> <span style="color: #333333;">=</span> <span style="background-color: #fff0f0;">"carlo.dj@messiahpsychoanalyst.org"</span>; <span style="color: #888888;">//Put your website admin email here. Don't forget quotes. </span>
<span style="color: #888888;">// body of the email your own admin receives</span>
<span style="color: #996633;">$Body</span> <span style="color: #333333;">=</span> <span style="background-color: #fff0f0;">"RE: Contact from visitors"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"Name: "</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="color: #996633;">$Name</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"City: "</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="color: #996633;">$City</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"Subject: "</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="color: #996633;">$Subject</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"Email: "</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="color: #996633;">$Email</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"Message: "</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="color: #996633;">$Message</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #888888;">// send email to admin</span>
<span style="color: #996633;">$posted</span> <span style="color: #333333;">=</span> <span style="color: #007020;">mail</span>(<span style="color: #996633;">$EmailToAdmin</span>, <span style="color: #996633;">$Subject</span>, <span style="color: #996633;">$Body</span>, <span style="background-color: #fff0f0;">"From: <</span><span style="background-color: #eeeeee;">$Email</span><span style="background-color: #fff0f0;">>"</span>);
<span style="color: #888888;">// dispatch thanks message using Boolean $posted</span>
<span style="color: #008800; font-weight: bold;">if</span> (<span style="color: #996633;">$posted</span>){
<span style="color: #008800; font-weight: bold;">echo</span> <span style="background-color: #fff0f0;">'<div style=\'margin-top: 20px; margin-left:112px; border: 2px groove blue; border-radius:5px; padding-left: 10px; width:400px;\'></span>
<span style="background-color: #fff0f0;"> <p>Thanks By <a href="http://messiahpsychoanalyst.org">Dysprosium</a></p></span>
<span style="background-color: #fff0f0;"> <hr style=\'margin: 1px auto 1px auto; height: 1px; color: #fefefe; width: 82%;\'/> </span>
<span style="background-color: #fff0f0;"> <h1>Your message has been sent! Thanks for Your Message!</h1></span>
<span style="background-color: #fff0f0;"> <p><a href="Default.html">Click to go to Home page!</a></p></span>
<span style="background-color: #fff0f0;"> </div>'</span>;
<span style="color: #888888;">//After thank you send an email containing his message to the visitor</span>
<span style="color: #888888;">// prepare email body text</span>
<span style="color: #996633;">$Body</span> <span style="color: #333333;">=</span> <span style="background-color: #fff0f0;">" Madam/Sir,</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;"> Thank you for your message.</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;"> Dysprosium.</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">" ======================================================</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"Name: "</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="color: #996633;">$Name</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">", Esq."</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"From: "</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="color: #996633;">$City</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"Email: "</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="color: #996633;">$Email</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"Subject: "</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="color: #996633;">$Subject</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"Message: "</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="color: #996633;">$Message</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #888888;">// send email </span>
<span style="color: #007020;">mail</span>(<span style="color: #996633;">$Email</span>, <span style="color: #996633;">$Subject</span>, <span style="color: #996633;">$Body</span>, <span style="background-color: #fff0f0;">"From: <</span><span style="background-color: #eeeeee;">$EmailToAdmin</span><span style="background-color: #fff0f0;">>"</span>);
}
}
<span style="color: #557799;">?></span>
<span style="color: #007700;"></div></span>
<span style="color: #007700;"></div></span>
<span style="color: #557799;"><?Php</span>
<span style="color: #dd4422;">/**</span>
<span style="color: #dd4422;"> * http://www.electrictoolbox.com/php-get-mail-server-ip-address/</span>
<span style="color: #dd4422;"> * Get a mail server's IP address with PHP</span>
<span style="color: #dd4422;"> * Posted November 9th, 2012 in PHP by Chris Hope</span>
<span style="color: #dd4422;"> * Returns an IP address that mail can be delivered to for the passed in domain.</span>
<span style="color: #dd4422;"> *</span>
<span style="color: #dd4422;"> **/</span>
<span style="color: #008800; font-weight: bold;">function</span> <span style="color: #0066bb; font-weight: bold;">MailIPAddress</span>(<span style="color: #996633;">$domain</span>) {
<span style="color: #996633;">$ip</span> <span style="color: #333333;">=</span> <span style="color: #008800; font-weight: bold;">false</span>;
<span style="color: #996633;">$records</span> <span style="color: #333333;">=</span> <span style="color: #007020;">dns_get_record</span>(<span style="color: #996633;">$domain</span>, DNS_MX);
<span style="color: #996633;">$priority</span> <span style="color: #333333;">=</span> <span style="color: #008800; font-weight: bold;">null</span>;
<span style="color: #008800; font-weight: bold;">foreach</span> (<span style="color: #996633;">$records</span> <span style="color: #008800; font-weight: bold;">as</span> <span style="color: #996633;">$record</span>) {
<span style="color: #008800; font-weight: bold;">if</span> (<span style="color: #996633;">$priority</span> <span style="color: #333333;">==</span> <span style="color: #008800; font-weight: bold;">null</span> <span style="color: #333333;">||</span> <span style="color: #996633;">$record</span>[<span style="background-color: #fff0f0;">'pri'</span>] <span style="color: #333333;"><</span> <span style="color: #996633;">$priority</span>) {
<span style="color: #996633;">$myip</span> <span style="color: #333333;">=</span> <span style="color: #007020;">gethostbyname</span>(<span style="color: #996633;">$record</span>[<span style="background-color: #fff0f0;">'target'</span>]);
<span style="color: #888888;">// if the value returned is the same, then the lookup failed</span>
<span style="color: #008800; font-weight: bold;">if</span> (<span style="color: #996633;">$myip</span> <span style="color: #333333;">!=</span> <span style="color: #996633;">$record</span>[<span style="background-color: #fff0f0;">'target'</span>]) {
<span style="color: #996633;">$ip</span> <span style="color: #333333;">=</span> <span style="color: #996633;">$myip</span>;
<span style="color: #996633;">$priority</span> <span style="color: #333333;">=</span> <span style="color: #996633;">$record</span>[<span style="background-color: #fff0f0;">'pri'</span>];
}
}
}
<span style="color: #008800; font-weight: bold;">if</span> (<span style="color: #333333;">!</span><span style="color: #996633;">$ip</span>) {
<span style="color: #996633;">$ip</span> <span style="color: #333333;">=</span> <span style="color: #007020;">gethostbyname</span>(<span style="color: #996633;">$domain</span>);
<span style="color: #888888;">// if the value returned is the same, then the lookup failed</span>
<span style="color: #008800; font-weight: bold;">if</span> (<span style="color: #996633;">$ip</span> <span style="color: #333333;">==</span> <span style="color: #996633;">$domain</span>) {
<span style="color: #996633;">$ip</span> <span style="color: #333333;">=</span> <span style="color: #008800; font-weight: bold;">false</span>;
}
}
<span style="color: #008800; font-weight: bold;">return</span> <span style="color: #996633;">$ip</span>;
}
<span style="color: #557799;">?></span>
<span style="color: #007700;"></body></span>
<span style="color: #007700;"></html></span>
</pre>
</td></tr>
</tbody></table>
</div>
<br />
As this is a long piece of codes, I explain its detail in the next post. <a href="http://codesforus.blogspot.co.uk/2013/12/how-to-create-contact-form-for-your.html" target="_blank">Please click here</a>.<br />
<br />
Download <strong><em>this tutorial as PDF</em></strong> format <a href="http://messiahpsychoanalyst.org/Codesforus/ContactForm_7.pdf" target="_blank"><span style="color: #448888;">here</span></a> <br />
Download <strong><em>part 1 to part 7 as PDF</em></strong> format <a href="http://messiahpsychoanalyst.org/Codesforus/ContactForm1_7.pdf" target="_blank"><span style="color: #448888;">here</span></a> Peter Joneshttp://www.blogger.com/profile/03192918305428815983noreply@blogger.com0tag:blogger.com,1999:blog-667520058465774437.post-35711053436018847812013-12-08T15:45:00.004+00:002014-03-11T12:24:07.010+00:00How to Create a Contact Form for Your Website in an Easy Way : A Set of Step by Step Tutorials Using HTML5, CSS3 and PHP (6)<span style="color: red;">(For the latest PDF files Merger Software please have a look at the top of the left margin, inside the red box.)</span> <br />
Continues From <a href="http://codesforus.blogspot.co.uk/2013/12/making-contact-form-for-your-website-5.html" target="_blank">Part 5</a>.<br />
<h4>
How to add reCaptch to the Contact Form to prevent spam and bots? </h4>
My next goal is adding a captcha to recognise spammer bots from human interacting individuals. First you need to get one. I used the free reCapatch from <a href="http://www.google.com/recaptcha" target="_blank">here</a>. reCapatch gives you a pair of keys, one private key for the server-side inside the demoPoster.php, and one public key for the client-side inside your demoMain.php.<br />
<!-- HTML generated using hilite.me --><br />
<div style="background: rgb(255, 255, 255); border-radius: 5px; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<table><tbody>
<tr><td><pre style="line-height: 125%; margin: 0px;"> 1
2
3
4
5
6
7
8
9
10
11
12</pre>
</td><td><pre style="line-height: 125%; margin: 0px;"> <span style="color: #008800; font-weight: bold;">require_once</span>(<span style="background-color: #fff0f0;">'recaptchalib.php'</span>);
<span style="color: #996633;">$privatekey</span> <span style="color: #333333;">=</span> <span style="background-color: #fff0f0;">"xxxxx-xxxxxxxxxxxxx_xxxxxxxxxxxxxxxxxxxx"</span>;
<span style="color: #996633;">$resp</span> <span style="color: #333333;">=</span> recaptcha_check_answer (<span style="color: #996633;">$privatekey</span>,
<span style="color: #996633;">$_SERVER</span>[<span style="background-color: #fff0f0;">"REMOTE_ADDR"</span>],
<span style="color: #996633;">$_POST</span>[<span style="background-color: #fff0f0;">"recaptcha_challenge_field"</span>],
<span style="color: #996633;">$_POST</span>[<span style="background-color: #fff0f0;">"recaptcha_response_field"</span>]);
<span style="color: #008800; font-weight: bold;">if</span> (<span style="color: #333333;">!</span><span style="color: #996633;">$resp</span><span style="color: #333333;">-></span><span style="color: #0000cc;">is_valid</span>) {
<span style="color: #888888;">// What happens when the CAPTCHA was entered incorrectly</span>
<span style="color: #008800; font-weight: bold;">exit</span> (<span style="background-color: #fff0f0;">"The reCAPTCHA wasn't entered correctly. Go back and try it again."</span> <span style="color: #333333;">.</span>
<span style="background-color: #fff0f0;">"(reCAPTCHA said: "</span> <span style="color: #333333;">.</span> <span style="color: #996633;">$resp</span><span style="color: #333333;">-></span><span style="color: #0000cc;">error</span> <span style="color: #333333;">.</span> <span style="background-color: #fff0f0;">")"</span>);
}
</pre>
</td></tr>
</tbody></table>
</div>
<br />
Therefore your demoPoster.php file would be something like this.I moved lines (<strong>1</strong>) and (<strong>2</strong>) of the previous codes, respectively, to the lines (<strong>2</strong>) and (<strong>3</strong>) of following PHP file (download <strong><em>PHP</em></strong> code in Zip format <a href="http://messiahpsychoanalyst.org/Codesforus/demoPoster.zip" target="_blank">here</a> or open the code in text format <a href="http://messiahpsychoanalyst.org/Codesforus/demoPoster.txt" target="_blank">here</a>).<br />
<!-- HTML generated using hilite.me --><br />
<div style="background: rgb(255, 255, 255); border-radius: 5px; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<table><tbody>
<tr><td><pre style="line-height: 125%; margin: 0px;"> 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117</pre>
</td><td><pre style="line-height: 125%; margin: 0px;"><span style="color: #557799;"><?php</span>
<span style="color: #008800; font-weight: bold;">require_once</span>(<span style="background-color: #fff0f0;">'recaptchalib.php'</span>);
<span style="color: #996633;">$privatekey</span> <span style="color: #333333;">=</span> <span style="background-color: #fff0f0;">"xxxxx-xxxxxxxxxxxxx_xxxxxxxxxxxxxxxxxxxx"</span>;
<span style="color: #996633;">$Name</span> <span style="color: #333333;">=</span> Trim(<span style="color: #007020;">stripslashes</span>(<span style="color: #996633;">$_POST</span>[<span style="background-color: #fff0f0;">'Name'</span>]));
<span style="color: #996633;">$City</span> <span style="color: #333333;">=</span> Trim(<span style="color: #007020;">stripslashes</span>(<span style="color: #996633;">$_POST</span>[<span style="background-color: #fff0f0;">'City'</span>]));
<span style="color: #996633;">$Email</span> <span style="color: #333333;">=</span> Trim(<span style="color: #007020;">stripslashes</span>(<span style="color: #996633;">$_POST</span>[<span style="background-color: #fff0f0;">'Email'</span>]));
<span style="color: #996633;">$Subject</span> <span style="color: #333333;">=</span> Trim(<span style="color: #007020;">stripslashes</span>(<span style="color: #996633;">$_POST</span>[<span style="background-color: #fff0f0;">'Subject'</span>]));
<span style="color: #996633;">$Message</span> <span style="color: #333333;">=</span> Trim(<span style="color: #007020;">stripslashes</span>(<span style="color: #996633;">$_POST</span>[<span style="background-color: #fff0f0;">'Message'</span>]));
<span style="color: #008800; font-weight: bold;">if</span> ((<span style="color: #008800; font-weight: bold;">empty</span>(<span style="color: #996633;">$Name</span>))<span style="color: #333333;">||</span>(<span style="color: #008800; font-weight: bold;">empty</span>(<span style="color: #996633;">$Email</span> ))<span style="color: #333333;">||</span>(<span style="color: #008800; font-weight: bold;">empty</span>(<span style="color: #996633;">$Message</span>))) {
<span style="color: #008800; font-weight: bold;">print</span> <span style="background-color: #fff0f0;">"<meta http-equiv=</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\"</span><span style="background-color: #fff0f0;">refresh</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\"</span><span style="background-color: #fff0f0;"> content=</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\"</span><span style="background-color: #fff0f0;">0;URL=demoError.html</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\"</span><span style="background-color: #fff0f0;">>"</span>;
<span style="color: #008800; font-weight: bold;">exit</span>();
}
<span style="color: #008800; font-weight: bold;">else</span>{
<span style="color: #008800; font-weight: bold;">list</span>(<span style="color: #996633;">$emailPart</span>, <span style="color: #996633;">$domainPart</span>) <span style="color: #333333;">=</span> <span style="color: #007020;">explode</span>(<span style="background-color: #fff0f0;">'@'</span>, <span style="color: #996633;">$Email</span>);
<span style="color: #996633;">$one</span><span style="color: #333333;">=</span><span style="color: #007020;">filter_var</span>(<span style="color: #996633;">$Email</span>, FILTER_VALIDATE_EMAIL);
<span style="color: #996633;">$two</span><span style="color: #333333;">=</span>MailIPAddress(<span style="color: #996633;">$domainPart</span>);
<span style="color: #008800; font-weight: bold;">if</span> (<span style="color: #333333;">!</span>((<span style="color: #996633;">$one</span>) <span style="color: #333333;">&&</span> (<span style="color: #996633;">$two</span>))) {
<span style="color: #008800; font-weight: bold;">print</span> <span style="background-color: #fff0f0;">"<meta http-equiv=</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\"</span><span style="background-color: #fff0f0;">refresh</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\"</span><span style="background-color: #fff0f0;"> content=</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\"</span><span style="background-color: #fff0f0;">0;URL=demoError.html</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\"</span><span style="background-color: #fff0f0;">>"</span>;
<span style="color: #008800; font-weight: bold;">exit</span>();
}
<span style="color: #996633;">$resp</span> <span style="color: #333333;">=</span> recaptcha_check_answer (<span style="color: #996633;">$privatekey</span>,
<span style="color: #996633;">$_SERVER</span>[<span style="background-color: #fff0f0;">"REMOTE_ADDR"</span>],
<span style="color: #996633;">$_POST</span>[<span style="background-color: #fff0f0;">"recaptcha_challenge_field"</span>],
<span style="color: #996633;">$_POST</span>[<span style="background-color: #fff0f0;">"recaptcha_response_field"</span>]);
<span style="color: #008800; font-weight: bold;">if</span> (<span style="color: #333333;">!</span><span style="color: #996633;">$resp</span><span style="color: #333333;">-></span><span style="color: #0000cc;">is_valid</span>) {
<span style="color: #888888;">// What happens when the CAPTCHA was entered incorrectly</span>
<span style="color: #008800; font-weight: bold;">exit</span>(<span style="background-color: #fff0f0;">"The reCAPTCHA wasn't entered correctly. Go back and try it again."</span> <span style="color: #333333;">.</span>
<span style="background-color: #fff0f0;">"(reCAPTCHA said: "</span> <span style="color: #333333;">.</span> <span style="color: #996633;">$resp</span><span style="color: #333333;">-></span><span style="color: #0000cc;">error</span> <span style="color: #333333;">.</span> <span style="background-color: #fff0f0;">")"</span>);
}
<span style="color: #888888;">//Next send contact to website admin.</span>
<span style="color: #996633;">$EmailToAdmin</span> <span style="color: #333333;">=</span> <span style="background-color: #fff0f0;">"carlo.dj@messiahpsychoanalyst.org"</span>; <span style="color: #888888;">//Put your website admin email here. Don't forget quotes. </span>
<span style="color: #888888;">// body of the email your own admin receives</span>
<span style="color: #996633;">$Body</span> <span style="color: #333333;">=</span> <span style="background-color: #fff0f0;">"RE: Contact from visitors"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"Name: "</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="color: #996633;">$Name</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"City: "</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="color: #996633;">$City</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"Subject: "</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="color: #996633;">$Subject</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"Email: "</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="color: #996633;">$Email</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"Message: "</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="color: #996633;">$Message</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #888888;">// send email to admin</span>
<span style="color: #996633;">$posted</span> <span style="color: #333333;">=</span> <span style="color: #007020;">mail</span>(<span style="color: #996633;">$EmailToAdmin</span>, <span style="color: #996633;">$Subject</span>, <span style="color: #996633;">$Body</span>, <span style="background-color: #fff0f0;">"From: <</span><span style="background-color: #eeeeee;">$Email</span><span style="background-color: #fff0f0;">>"</span>);
<span style="color: #888888;">// redirect to thanks page </span>
<span style="color: #008800; font-weight: bold;">if</span> (<span style="color: #996633;">$posted</span>){
<span style="color: #008800; font-weight: bold;">print</span> <span style="background-color: #fff0f0;">"<meta http-equiv=</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\"</span><span style="background-color: #fff0f0;">refresh</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\"</span><span style="background-color: #fff0f0;"> content=</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\"</span><span style="background-color: #fff0f0;">0;URL=demoThanks.php</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\"</span><span style="background-color: #fff0f0;">>"</span>;
<span style="color: #888888;">//After thank you send an email containing his message to the visitor</span>
<span style="color: #888888;">// prepare email body text</span>
<span style="color: #996633;">$Body</span> <span style="color: #333333;">=</span> <span style="background-color: #fff0f0;">" Madam/Sir,</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;"> Thank you for your message.</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;"> Dysprosium.</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">" ======================================================</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"Name: "</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="color: #996633;">$Name</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">", Esq."</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"From: "</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="color: #996633;">$City</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"Email: "</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="color: #996633;">$Email</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"Subject: "</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="color: #996633;">$Subject</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"Message: "</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="color: #996633;">$Message</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #888888;">// send email </span>
<span style="color: #007020;">mail</span>(<span style="color: #996633;">$Email</span>, <span style="color: #996633;">$Subject</span>, <span style="color: #996633;">$Body</span>, <span style="background-color: #fff0f0;">"From: <</span><span style="background-color: #eeeeee;">$EmailToAdmin</span><span style="background-color: #fff0f0;">>"</span>);
}
<span style="color: #008800; font-weight: bold;">else</span>{
<span style="color: #888888;">//do nothing for now</span>
}
}
<span style="color: #557799;">?></span>
<span style="color: #557799;"><?Php</span>
<span style="color: #dd4422;">/**</span>
<span style="color: #dd4422;"> * http://www.electrictoolbox.com/php-get-mail-server-ip-address/</span>
<span style="color: #dd4422;"> * Get a mail server's IP address with PHP</span>
<span style="color: #dd4422;"> * Posted November 9th, 2012 in PHP by Chris Hope</span>
<span style="color: #dd4422;"> * Returns an IP address that mail can be delivered to for the passed in domain.</span>
<span style="color: #dd4422;"> *</span>
<span style="color: #dd4422;"> **/</span>
<span style="color: #008800; font-weight: bold;">function</span> <span style="color: #0066bb; font-weight: bold;">MailIPAddress</span>(<span style="color: #996633;">$domain</span>) {
<span style="color: #996633;">$ip</span> <span style="color: #333333;">=</span> <span style="color: #008800; font-weight: bold;">false</span>;
<span style="color: #996633;">$records</span> <span style="color: #333333;">=</span> <span style="color: #007020;">dns_get_record</span>(<span style="color: #996633;">$domain</span>, DNS_MX);
<span style="color: #996633;">$priority</span> <span style="color: #333333;">=</span> <span style="color: #008800; font-weight: bold;">null</span>;
<span style="color: #008800; font-weight: bold;">foreach</span> (<span style="color: #996633;">$records</span> <span style="color: #008800; font-weight: bold;">as</span> <span style="color: #996633;">$record</span>) {
<span style="color: #008800; font-weight: bold;">if</span> (<span style="color: #996633;">$priority</span> <span style="color: #333333;">==</span> <span style="color: #008800; font-weight: bold;">null</span> <span style="color: #333333;">||</span> <span style="color: #996633;">$record</span>[<span style="background-color: #fff0f0;">'pri'</span>] <span style="color: #333333;"><</span> <span style="color: #996633;">$priority</span>) {
<span style="color: #996633;">$myip</span> <span style="color: #333333;">=</span> <span style="color: #007020;">gethostbyname</span>(<span style="color: #996633;">$record</span>[<span style="background-color: #fff0f0;">'target'</span>]);
<span style="color: #888888;">// if the value returned is the same, then the lookup failed</span>
<span style="color: #008800; font-weight: bold;">if</span> (<span style="color: #996633;">$myip</span> <span style="color: #333333;">!=</span> <span style="color: #996633;">$record</span>[<span style="background-color: #fff0f0;">'target'</span>]) {
<span style="color: #996633;">$ip</span> <span style="color: #333333;">=</span> <span style="color: #996633;">$myip</span>;
<span style="color: #996633;">$priority</span> <span style="color: #333333;">=</span> <span style="color: #996633;">$record</span>[<span style="background-color: #fff0f0;">'pri'</span>];
}
}
}
<span style="color: #008800; font-weight: bold;">if</span> (<span style="color: #333333;">!</span><span style="color: #996633;">$ip</span>) {
<span style="color: #996633;">$ip</span> <span style="color: #333333;">=</span> <span style="color: #007020;">gethostbyname</span>(<span style="color: #996633;">$domain</span>);
<span style="color: #888888;">// if the value returned is the same, then the lookup failed</span>
<span style="color: #008800; font-weight: bold;">if</span> (<span style="color: #996633;">$ip</span> <span style="color: #333333;">==</span> <span style="color: #996633;">$domain</span>) {
<span style="color: #996633;">$ip</span> <span style="color: #333333;">=</span> <span style="color: #008800; font-weight: bold;">false</span>;
}
}
<span style="color: #008800; font-weight: bold;">return</span> <span style="color: #996633;">$ip</span>;
}
<span style="color: #557799;">?></span>
</pre>
</td></tr>
</tbody></table>
</div>
<br />
Inside line (<strong>28</strong>), instead of <br />
<!-- HTML generated using hilite.me --><br />
<div style="background: rgb(255, 255, 255); border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<pre style="line-height: 125%; margin: 0px;"><span style="color: #008800; font-weight: bold;">exit</span>(<span style="background-color: #fff0f0;">"The reCAPTCHA wasn't entered correctly. Go back and try it again."</span> <span style="color: #333333;">.</span>
<span style="background-color: #fff0f0;">"(reCAPTCHA said: "</span> <span style="color: #333333;">.</span> <span style="color: #996633;">$resp</span><span style="color: #333333;">-></span><span style="color: #0000cc;">error</span> <span style="color: #333333;">.</span> <span style="background-color: #fff0f0;">")"</span>);
</pre>
</div>
you can use a PHP print and redirect error response to a designed HTML page; similar to line <strong>(18).</strong><br />
<br />
Please insert the following snippet of client-side reCaptcha into the Contact Form page.<br />
<!-- HTML generated using hilite.me --><br />
<div style="background: rgb(255, 255, 255); border-radius: 5px; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<table><tbody>
<tr><td><pre style="line-height: 125%; margin: 0px;">1
2
3
4
5</pre>
</td><td><pre style="line-height: 125%; margin: 0px;"><span style="color: #557799;"><?php</span>
<span style="color: #008800; font-weight: bold;"> require_once</span>(<span style="background-color: #fff0f0;">'recaptchalib.php'</span>);
<span style="color: #996633;"> $publickey</span> <span style="color: #333333;">=</span> <span style="background-color: #fff0f0;">"xxxxx-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"</span>; <span style="color: #888888;">// you got this from the signup page</span>
<span style="color: #008800; font-weight: bold;"> echo</span> recaptcha_get_html(<span style="color: #996633;">$publickey</span>);
<span style="color: #557799;">?></span>
</pre>
</td></tr>
</tbody></table>
</div>
<br />
Alternatively, you can use a JavaScript snippet, instead of PHP, for the reCaptcha.<br />
<!-- HTML generated using hilite.me --><br />
<div style="background: rgb(255, 255, 255); border-radius: 3px; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<pre style="line-height: 125%; margin: 0px;"><span style="color: #333333;"><</span>script type<span style="color: #333333;">=</span><span style="background-color: #fff0f0;">"text/javascript"</span> src<span style="color: #333333;">=</span><span style="background-color: #fff0f0;">"http://www.google.com/recaptcha/api/challenge?k=xxxxx-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"</span><span style="color: #333333;">><</span><span style="background-color: #ffaaaa; color: red;">/script></span>
</pre>
</div>
<br />
To be able to position and style the reCaptcha, you need to put that embraced in a division HTML div tag. <br />
<!-- HTML generated using hilite.me --><br />
<div style="background: rgb(255, 255, 255); border-radius: 5px; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<table><tbody>
<tr><td><pre style="line-height: 125%; margin: 0px;">1
2
3
4
5
6
7</pre>
</td><td><pre style="line-height: 125%; margin: 0px;"><span style="color: #007700;"><div</span> <span style="color: #0000cc;">id=</span><span style="background-color: #fff0f0;">"recaptcha_widget_div"</span><span style="color: #007700;">></span>
<span style="color: #557799;"> <?php</span>
<span style="color: #008800; font-weight: bold;">require_once</span>(<span style="background-color: #fff0f0;">'recaptchalib.php'</span>);
<span style="color: #996633;">$publickey</span> <span style="color: #333333;">=</span> <span style="background-color: #fff0f0;">"xxxxx-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"</span>; <span style="color: #888888;">// you got this from the signup page</span>
<span style="color: #008800; font-weight: bold;">echo</span> recaptcha_get_html(<span style="color: #996633;">$publickey</span>);
<span style="color: #557799;">?></span>
<span style="color: #007700;"></div></span>
</pre>
</td></tr>
</tbody></table>
</div>
<br />
CSS codes for the division goes at the top inside the style.<br />
<!-- HTML generated using hilite.me --><br />
<div style="background: rgb(255, 255, 255); border-radius: 5px; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<table><tbody>
<tr><td><pre style="line-height: 125%; margin: 0px;">1
2
3
4
5</pre>
</td><td><pre style="line-height: 125%; margin: 0px;"><span style="color: #0066bb; font-weight: bold;">#recaptcha_widget_div</span> {
<span style="color: #008800; font-weight: bold;"> margin-top</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">20px</span>;
<span style="color: #008800; font-weight: bold;">margin-bottom</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">10px</span>;
<span style="color: #008800; font-weight: bold;">margin-left</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">112px</span>;
}
</pre>
</td></tr>
</tbody></table>
</div>
<br />
You need to add a JavaScript snippet provided by reCaptcha to select your favourite theme.<br />
<!-- HTML generated using hilite.me --><br />
<div style="background: rgb(255, 255, 255); border-radius: 5px; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<table><tbody>
<tr><td><pre style="line-height: 125%; margin: 0px;">1
2
3
4
5</pre>
</td><td><pre style="line-height: 125%; margin: 0px;"><span style="color: #333333;"><</span>script type<span style="color: #333333;">=</span> <span style="background-color: #fff0f0;">"text/javascript"</span><span style="color: #333333;">></span>
<span style="color: #008800; font-weight: bold;"> var</span> RecaptchaOptions <span style="color: #333333;">=</span> {
theme<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">'white'</span>
};
<span style="color: #333333;"><</span><span style="background-color: #ffaaaa; color: red;">/script></span>
</pre>
</td></tr>
</tbody></table>
</div>
<br />
You have a choice of different themes, glass, white and so on that you can learn from reCaptch site and put in place of 'white' in above snippet . You have noticed one line <br />
<!-- HTML generated using hilite.me --><br />
<div style="background: rgb(255, 255, 255); border-radius: 3px; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<pre style="line-height: 125%; margin: 0px;"><span style="color: #008800; font-weight: bold;">require_once</span>(<span style="background-color: #fff0f0;">'recaptchalib.php'</span>);
</pre>
</div>
<br />
For that you need to take the recaptchlib.php from their website and upload it to the same directory as of your contact form in your web-server hosting. Then your contact form page should be something like the next snippet (download <strong><em>PHP</em></strong> code in Zip format <a href="http://messiahpsychoanalyst.org/Codesforus/demoMain3.zip" target="_blank">here</a> or open the code in text format <a href="http://messiahpsychoanalyst.org/Codesforus/demoMain3.txt" target="_blank">here</a>),<br />
<!-- HTML generated using hilite.me --><br />
<div style="background: rgb(255, 255, 255); border-radius: 10px; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<table><tbody>
<tr><td><pre style="line-height: 125%; margin: 0px;"> 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112</pre>
</td><td><pre style="line-height: 125%; margin: 0px;"><span style="color: #557799;"><!DOCTYPE html></span>
<span style="color: #888888;"><!--</span>
<span style="color: #888888;">Created on 08-December-2013, 15:45:51.</span>
<span style="color: #888888;">Peter Jones codesforus.blogspot.com</span>
<span style="color: #888888;">Copyrights.</span>
<span style="color: #888888;">--></span>
<span style="color: #007700;"><html></span>
<span style="color: #007700;"><head></span>
<span style="color: #007700;"><title></span> Dysprosium Contact Form<span style="color: #007700;"></title></span>
<span style="color: #007700;"><meta</span> <span style="color: #0000cc;">charset=</span><span style="background-color: #fff0f0;">"UTF-8"</span><span style="color: #007700;">></span>
<span style="color: #007700;"><meta</span> <span style="color: #0000cc;">name=</span><span style="background-color: #fff0f0;">"viewport"</span> <span style="color: #0000cc;">content=</span><span style="background-color: #fff0f0;">"width=device-width"</span><span style="color: #007700;">></span>
<span style="color: #007700;"><script </span><span style="color: #0000cc;">type=</span><span style="background-color: #ffaaaa; color: red;"> </span><span style="background-color: #fff0f0;">"text/javascript"</span><span style="color: #007700;">></span>
<span style="color: #008800; font-weight: bold;">var</span> RecaptchaOptions <span style="color: #333333;">=</span> {
theme<span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">'white'</span>
};
<span style="color: #007700;"></script></span>
<span style="color: #007700;"><style></span>
<span style="color: #0066bb; font-weight: bold;">#contact-wrapper</span> {
<span style="color: #008800; font-weight: bold;">margin</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">20px</span> <span style="color: #008800; font-weight: bold;">auto</span>;
<span style="color: #008800; font-weight: bold;">border</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">2px</span> <span style="color: #008800; font-weight: bold;">solid</span> <span style="color: #6600ee; font-weight: bold;">#ccc</span>;
<span style="color: #008800; font-weight: bold;">border</span><span style="color: #333333;">-</span>radius<span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">7px</span>;
<span style="color: #008800; font-weight: bold;">padding</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">20px</span> <span style="color: #6600ee; font-weight: bold;">50px</span> <span style="color: #6600ee; font-weight: bold;">20px</span> <span style="color: #6600ee; font-weight: bold;">50px</span>;
<span style="color: #008800; font-weight: bold;">background</span><span style="color: #333333;">:</span> <span style="color: #008800; font-weight: bold;">transparent</span>;
<span style="color: #008800; font-weight: bold;">width</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">600px</span>;
}
<span style="color: #0066bb; font-weight: bold;">#contact-area</span> {
<span style="color: #008800; font-weight: bold;">width</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">600px</span>;
<span style="color: #008800; font-weight: bold;">margin-top</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">25px</span>;
}
<span style="color: #0066bb; font-weight: bold;">#contact-area</span> <span style="color: #007700;">label</span> {
<span style="color: #008800; font-weight: bold;">float</span><span style="color: #333333;">:</span> <span style="color: #008800; font-weight: bold;">left</span>;
<span style="color: #008800; font-weight: bold;">margin-right</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">15px</span>;
<span style="color: #008800; font-weight: bold;">padding-top</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">5px</span>;
<span style="color: #008800; font-weight: bold;">width</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">100px</span>;
<span style="color: #008800; font-weight: bold;">text-align</span><span style="color: #333333;">:</span> <span style="color: #008800; font-weight: bold;">right</span>;
<span style="color: #008800; font-weight: bold;">font-size</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">100</span><span style="color: #333333;">%</span>;
}
<span style="color: #0066bb; font-weight: bold;">#contact-area</span> <span style="color: #007700;">input</span><span style="color: #333333;">,</span> <span style="color: #0066bb; font-weight: bold;">#contact-area</span> <span style="color: #007700;">textarea</span> {
<span style="color: #008800; font-weight: bold;">margin</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">0px</span> <span style="color: #6600ee; font-weight: bold;">0px</span> <span style="color: #6600ee; font-weight: bold;">10px</span> <span style="color: #6600ee; font-weight: bold;">0px</span>;
<span style="color: #008800; font-weight: bold;">border</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">2px</span> <span style="color: #008800; font-weight: bold;">solid</span> <span style="color: #6600ee; font-weight: bold;">#ccc</span>;
<span style="color: #008800; font-weight: bold;">border</span><span style="color: #333333;">-</span>radius<span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">5px</span>;
<span style="color: #008800; font-weight: bold;">padding</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">5px</span>;
<span style="color: #008800; font-weight: bold;">width</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">471px</span>;
<span style="color: #008800; font-weight: bold;">font-family</span><span style="color: #333333;">:</span> Helvetica<span style="color: #333333;">,</span> <span style="color: #008800; font-weight: bold;">sans-serif</span>;
<span style="color: #008800; font-weight: bold;">font-size</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">110</span><span style="color: #333333;">%</span>;
}
<span style="color: #0066bb; font-weight: bold;">#contact-area</span> <span style="color: #007700;">textarea</span> {
<span style="color: #008800; font-weight: bold;">height</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">90px</span>;
}
<span style="color: #0066bb; font-weight: bold;">#contact-area</span> <span style="color: #007700;">textarea</span><span style="color: #555555; font-weight: bold;">:focus</span><span style="color: #333333;">,</span> <span style="color: #0066bb; font-weight: bold;">#contact-area</span> <span style="color: #007700;">input</span><span style="color: #555555; font-weight: bold;">:focus</span> {
<span style="color: #008800; font-weight: bold;">border</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">2px</span> <span style="color: #008800; font-weight: bold;">solid</span> <span style="color: #6600ee; font-weight: bold;">#900</span>;
}
<span style="color: #0066bb; font-weight: bold;">#contact-area</span> <span style="color: #007700;">input</span><span style="color: #bb0066; font-weight: bold;">.submit-button</span> {
<span style="color: #008800; font-weight: bold;">float</span><span style="color: #333333;">:</span> <span style="color: #008800; font-weight: bold;">left</span>;
<span style="color: #008800; font-weight: bold;">cursor</span><span style="color: #333333;">:</span> <span style="color: #008800; font-weight: bold;">pointer</span>;
<span style="color: #008800; font-weight: bold;">margin-top</span><span style="color: #333333;">:</span><span style="color: #6600ee; font-weight: bold;">10px</span>;
<span style="color: #008800; font-weight: bold;">margin-left</span><span style="color: #333333;">:</span><span style="color: #6600ee; font-weight: bold;">112px</span>;
<span style="color: #008800; font-weight: bold;">background</span><span style="color: #333333;">:</span> <span style="color: #008800; font-weight: bold;">transparent</span>;
<span style="color: #008800; font-weight: bold;">width</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">100px</span>;
<span style="color: #008800; font-weight: bold;">font-size</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">100</span><span style="color: #333333;">%</span>;
<span style="color: #008800; font-weight: bold;">color</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">#024d8e</span>
}
<span style="color: #0066bb; font-weight: bold;">#contact-area</span> <span style="color: #007700;">input</span><span style="color: #333333;">[</span><span style="color: #007700;">type</span><span style="color: #333333;">=</span><span style="background-color: #fff0f0;">"submit"</span><span style="color: #333333;">]</span><span style="color: #555555; font-weight: bold;">:hover</span>{
<span style="color: #008800; font-weight: bold;">border</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">2px</span> <span style="color: #008800; font-weight: bold;">solid</span> <span style="color: #6600ee; font-weight: bold;">#900</span>;
}
<span style="color: #0066bb; font-weight: bold;">#recaptcha_widget_div</span> {
<span style="color: #008800; font-weight: bold;">margin-top</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">20px</span>;
<span style="color: #008800; font-weight: bold;">margin-bottom</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">10px</span>;
<span style="color: #008800; font-weight: bold;">margin-left</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">112px</span>;
}
<span style="color: #007700;"></style></span>
<span style="color: #007700;"></head></span>
<span style="color: #007700;"><body></span>
<span style="color: #007700;"><div</span> <span style="color: #0000cc;">id=</span><span style="background-color: #fff0f0;">"contact-wrapper"</span><span style="color: #007700;">></span>
<span style="color: #007700;"><div</span> <span style="color: #0000cc;">id=</span><span style="background-color: #fff0f0;">"contact-area"</span><span style="color: #007700;">></span>
<span style="color: #007700;"><form</span> <span style="color: #0000cc;">method=</span><span style="background-color: #fff0f0;">"post"</span> <span style="color: #0000cc;">action=</span><span style="background-color: #fff0f0;">"demoPoster.php"</span><span style="color: #007700;">></span>
<span style="color: #007700;"><label</span> <span style="color: #0000cc;">for=</span><span style="background-color: #fff0f0;">"Name"</span><span style="color: #007700;">><span</span> <span style="color: #0000cc;">style=</span><span style="background-color: #fff0f0;">"color: red; font-size: 100%"</span><span style="color: #007700;">></span>*<span style="color: #880000; font-weight: bold;">&nbsp;</span><span style="color: #007700;"></span></span>Name:<span style="color: #007700;"></label></span>
<span style="color: #007700;"><input</span> <span style="color: #0000cc;">type=</span><span style="background-color: #fff0f0;">"text"</span> <span style="color: #0000cc;">name=</span><span style="background-color: #fff0f0;">"Name"</span> <span style="color: #0000cc;">id=</span><span style="background-color: #fff0f0;">"Name"</span> <span style="color: #0000cc;">value=</span><span style="background-color: #fff0f0;">""</span> <span style="color: #007700;">/></span>
<span style="color: #007700;"><label</span> <span style="color: #0000cc;">for=</span><span style="background-color: #fff0f0;">"City"</span><span style="color: #007700;">></span>City:<span style="color: #007700;"></label></span>
<span style="color: #007700;"><input</span> <span style="color: #0000cc;">type=</span><span style="background-color: #fff0f0;">"text"</span> <span style="color: #0000cc;">name=</span><span style="background-color: #fff0f0;">"City"</span> <span style="color: #0000cc;">id=</span><span style="background-color: #fff0f0;">"City"</span> <span style="color: #0000cc;">value=</span><span style="background-color: #fff0f0;">""</span> <span style="color: #007700;">/></span>
<span style="color: #007700;"><label</span> <span style="color: #0000cc;">for=</span><span style="background-color: #fff0f0;">"Email"</span><span style="color: #007700;">><span</span> <span style="color: #0000cc;">style=</span><span style="background-color: #fff0f0;">"color: red; font-size: 100%"</span><span style="color: #007700;">></span>*<span style="color: #880000; font-weight: bold;">&nbsp;</span><span style="color: #007700;"></span></span>Email:<span style="color: #007700;"></label></span>
<span style="color: #007700;"><input</span> <span style="color: #0000cc;">type=</span><span style="background-color: #fff0f0;">"text"</span> <span style="color: #0000cc;">name=</span><span style="background-color: #fff0f0;">"Email"</span> <span style="color: #0000cc;">id=</span><span style="background-color: #fff0f0;">"Email"</span> <span style="color: #0000cc;">value=</span><span style="background-color: #fff0f0;">""</span> <span style="color: #007700;">/></span>
<span style="color: #007700;"><label</span> <span style="color: #0000cc;">for=</span><span style="background-color: #fff0f0;">"Subject"</span><span style="color: #007700;">></span>Subject:<span style="color: #007700;"></label></span>
<span style="color: #007700;"><input</span> <span style="color: #0000cc;">type=</span><span style="background-color: #fff0f0;">"text"</span> <span style="color: #0000cc;">name=</span><span style="background-color: #fff0f0;">"Subject"</span> <span style="color: #0000cc;">id=</span><span style="background-color: #fff0f0;">"Subject"</span> <span style="color: #0000cc;">value=</span><span style="background-color: #fff0f0;">""</span> <span style="color: #007700;">/></span>
<span style="color: #007700;"><label</span> <span style="color: #0000cc;">for=</span><span style="background-color: #fff0f0;">"Message"</span><span style="color: #007700;">><span</span> <span style="color: #0000cc;">style=</span><span style="background-color: #fff0f0;">"color: red; font-size: 100%"</span><span style="color: #007700;">></span>*<span style="color: #880000; font-weight: bold;">&nbsp;</span><span style="color: #007700;"></span></span>Message:<span style="color: #007700;"></label></span>
<span style="color: #007700;"><textarea</span> <span style="color: #0000cc;">name=</span><span style="background-color: #fff0f0;">"Message"</span> <span style="color: #0000cc;">rows=</span><span style="background-color: #fff0f0;">"20"</span> <span style="color: #0000cc;">cols=</span><span style="background-color: #fff0f0;">"20"</span> <span style="color: #0000cc;">id=</span><span style="background-color: #fff0f0;">"Message"</span><span style="color: #007700;">></textarea></span>
<span style="color: #007700;"><p</span> <span style="color: #0000cc;">style=</span><span style="background-color: #fff0f0;">"margin:20px auto 10px 112px;"</span><span style="color: #007700;">></span>Fields shown by <span style="color: #007700;"><span</span> <span style="color: #0000cc;">style=</span><span style="background-color: #fff0f0;">"color: red; font-size: 100%"</span><span style="color: #007700;">></span>*<span style="color: #880000; font-weight: bold;">&nbsp;</span><span style="color: #007700;"></span></span> are required.<span style="color: #007700;"></p></span>
<span style="color: #007700;"><div</span> <span style="color: #0000cc;">id=</span><span style="background-color: #fff0f0;">"recaptcha_widget_div"</span><span style="color: #007700;">></span>
<span style="color: #557799;"><?php</span>
<span style="color: #008800; font-weight: bold;">require_once</span>(<span style="background-color: #fff0f0;">'recaptchalib.php'</span>);
<span style="color: #996633;">$publickey</span> <span style="color: #333333;">=</span> <span style="background-color: #fff0f0;">"xxxxx-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"</span>; <span style="color: #888888;">// you got this from the signup page</span>
<span style="color: #008800; font-weight: bold;">echo</span> recaptcha_get_html(<span style="color: #996633;">$publickey</span>);
<span style="color: #557799;">?></span>
<span style="color: #007700;"></div></span>
<span style="color: #007700;"><input</span> <span style="color: #0000cc;">type=</span><span style="background-color: #fff0f0;">"submit"</span> <span style="color: #0000cc;">name=</span><span style="background-color: #fff0f0;">"submit"</span> <span style="color: #0000cc;">value=</span><span style="background-color: #fff0f0;">"Submit"</span> <span style="color: #0000cc;">class=</span><span style="background-color: #fff0f0;">"submit-button"</span> <span style="color: #007700;">/></span>
<span style="color: #007700;"></form></span>
<span style="color: #007700;"><div</span> <span style="color: #0000cc;">style=</span><span style="background-color: #fff0f0;">"clear: both;"</span><span style="color: #007700;">></span>
<span style="color: #007700;"></div></span>
<span style="color: #007700;"></div></span>
<span style="color: #007700;"></div></span>
<span style="color: #007700;"></body></span>
<span style="color: #007700;"></html></span>
</pre>
</td></tr>
</tbody></table>
</div>
<br />
Division at lines (<strong>107</strong>) (<strong>108</strong>) has been added to give the flow to contact form after inserting the reCaptcha.<br />
That is now a very simple robust contact form and can be used. Please <a href="http://messiahpsychoanalyst.org/Codesforus/demoMain3.php" target="_blank">have look at it here</a>. I put its snapshot here. <br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgQ3_oQxMD2jEF0njEINRRBBofoeX_Fl8rrrOeubP6LTu3WEp_dfKKuS5k2SceQhQTFS9acJ3ocGRgbRmiUpwa7Tnqr4AiG_ICo_l4ilESJ3wcY488lwuf_kKnUb7fhT6KXSrN6AFL9MWg/s1600/Cfusrecaptcha.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgQ3_oQxMD2jEF0njEINRRBBofoeX_Fl8rrrOeubP6LTu3WEp_dfKKuS5k2SceQhQTFS9acJ3ocGRgbRmiUpwa7Tnqr4AiG_ICo_l4ilESJ3wcY488lwuf_kKnUb7fhT6KXSrN6AFL9MWg/s400/Cfusrecaptcha.PNG" height="350" width="400" /></a></div>
Next we are going to give it final cosmetics touches and consolidate all scattered pages in one PHP page. <a href="http://codesforus.blogspot.co.uk/2013/12/how-to-create-contact-form-for-your_13.html" target="_blank">Please click here</a>.<br />
<br />
Download <strong><em>this tutorial as PDF</em></strong> format <a href="http://messiahpsychoanalyst.org/Codesforus/ContactForm_6.pdf" target="_blank"><span style="color: #448888;">here</span></a> <br />
Download <strong><em>part 1 to part 6 as PDF</em></strong> format <a href="http://messiahpsychoanalyst.org/Codesforus/ContactForm1_6.pdf" target="_blank"><span style="color: #448888;">here</span></a> Peter Joneshttp://www.blogger.com/profile/03192918305428815983noreply@blogger.com0tag:blogger.com,1999:blog-667520058465774437.post-69148084728271049532013-12-07T13:22:00.002+00:002014-03-11T12:23:14.957+00:00How to Create a Contact Form for Your Website in an Easy Way : A Set of Step by Step Tutorials Using HTML5, CSS3 and PHP (5)<span style="color: red;">(For the latest PDF files Merger Software please have a look at the top of the left margin, inside the red box.)</span> <br />
Continues From <a href="http://codesforus.blogspot.co.uk/2013/12/making-contact-form-for-your-website-4.html" target="_blank">Part 4</a>.<br />
Our next assigned task is to check email field for correctness of its format. It is advantageous to check if the domain claimed by visitor exists at all to reduce spams. But it is not possible to check if the email name is also a valid existing email user's name.<br />
PHP has a facility for the correctness of the format of the email.<br />
<!-- HTML generated using hilite.me --><br />
<div style="background: rgb(255, 255, 255); border-radius: 3px; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<pre style="line-height: 125%; margin: 0px;"><span style="color: blue;">Boolean</span> filter_var(<span style="color: #7f6000;">$Email</span>, FILTER_VALIDATE_EMAIL);
</pre>
</div>
<br />
I add that to my demoPoster.php (download <strong><em>PHP</em></strong> code in Zip format <a href="http://messiahpsychoanalyst.org/Codesforus/demoPoster2.zip" target="_blank"><span style="color: #448888;">here</span></a> or open the code in text format <a href="http://messiahpsychoanalyst.org/Codesforus/demoPoster2.txt" target="_blank"><span style="color: #448888;">here</span></a>).<!-- HTML generated using hilite.me --><br />
<!-- HTML generated using hilite.me --><br />
<div style="background: rgb(255, 255, 255); border-radius: 10px; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<table><tbody>
<tr><td><pre style="line-height: 125%; margin: 0px;"> 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70</pre>
</td><td><pre style="line-height: 125%; margin: 0px;"><span style="color: #557799;"><?php</span>
<span style="color: #996633;">$Name</span> <span style="color: #333333;">=</span> Trim(<span style="color: #007020;">stripslashes</span>(<span style="color: #996633;">$_POST</span>[<span style="background-color: #fff0f0;">'Name'</span>]));
<span style="color: #996633;">$City</span> <span style="color: #333333;">=</span> Trim(<span style="color: #007020;">stripslashes</span>(<span style="color: #996633;">$_POST</span>[<span style="background-color: #fff0f0;">'City'</span>]));
<span style="color: #996633;">$Email</span> <span style="color: #333333;">=</span> Trim(<span style="color: #007020;">stripslashes</span>(<span style="color: #996633;">$_POST</span>[<span style="background-color: #fff0f0;">'Email'</span>]));
<span style="color: #996633;">$Subject</span> <span style="color: #333333;">=</span> Trim(<span style="color: #007020;">stripslashes</span>(<span style="color: #996633;">$_POST</span>[<span style="background-color: #fff0f0;">'Subject'</span>]));
<span style="color: #996633;">$Message</span> <span style="color: #333333;">=</span> Trim(<span style="color: #007020;">stripslashes</span>(<span style="color: #996633;">$_POST</span>[<span style="background-color: #fff0f0;">'Message'</span>]));
<span style="color: #008800; font-weight: bold;">if</span> ((<span style="color: #008800; font-weight: bold;">empty</span>(<span style="color: #996633;">$Name</span>))<span style="color: #333333;">||</span>(<span style="color: #008800; font-weight: bold;">empty</span>(<span style="color: #996633;">$Email</span> ))<span style="color: #333333;">||</span>(<span style="color: #008800; font-weight: bold;">empty</span>(<span style="color: #996633;">$Message</span>))) {
<span style="color: #008800; font-weight: bold;">print</span> <span style="background-color: #fff0f0;">"<meta http-equiv=</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\"</span><span style="background-color: #fff0f0;">refresh</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\"</span><span style="background-color: #fff0f0;"> content=</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\"</span><span style="background-color: #fff0f0;">0;URL=demoError2.html</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\"</span><span style="background-color: #fff0f0;">>"</span>;
<span style="color: #008800; font-weight: bold;">exit</span>();
}
<span style="color: #008800; font-weight: bold;">else</span>{
<span style="color: #008800; font-weight: bold;">if</span>(<span style="color: #333333;">!</span><span style="color: #007020;">filter_var</span>(<span style="color: #996633;">$Email</span>, FILTER_VALIDATE_EMAIL)){
<span style="color: #008800; font-weight: bold;">print</span> <span style="background-color: #fff0f0;">"<meta http-equiv=</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\"</span><span style="background-color: #fff0f0;">refresh</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\"</span><span style="background-color: #fff0f0;"> content=</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\"</span><span style="background-color: #fff0f0;">0;URL=demoError2.html</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\"</span><span style="background-color: #fff0f0;">>"</span>;
<span style="color: #008800; font-weight: bold;">exit</span>();
}
<span style="color: #888888;">//Next send contact to website admin.</span>
<span style="color: #996633;">$EmailToAdmin</span> <span style="color: #333333;">=</span> <span style="background-color: #fff0f0;">"carlo.dj@messiahpsychoanalyst.org"</span>; <span style="color: #888888;">//Put your website admin email here. Don't forget quotes. </span>
<span style="color: #888888;">// body of the email your own admin receives</span>
<span style="color: #996633;">$Body</span> <span style="color: #333333;">=</span> <span style="background-color: #fff0f0;">"RE: Contact from visitors"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"Name: "</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="color: #996633;">$Name</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"City: "</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="color: #996633;">$City</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"Subject: "</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="color: #996633;">$Subject</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"Email: "</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="color: #996633;">$Email</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"Message: "</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="color: #996633;">$Message</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #888888;">// send email to admin</span>
<span style="color: #996633;">$posted</span> <span style="color: #333333;">=</span> <span style="color: #007020;">mail</span>(<span style="color: #996633;">$EmailToAdmin</span>, <span style="color: #996633;">$Subject</span>, <span style="color: #996633;">$Body</span>, <span style="background-color: #fff0f0;">"From: <</span><span style="background-color: #eeeeee;">$Email</span><span style="background-color: #fff0f0;">>"</span>);
<span style="color: #888888;">// redirect to thanks page </span>
<span style="color: #008800; font-weight: bold;">if</span> (<span style="color: #996633;">$posted</span>){
<span style="color: #008800; font-weight: bold;">print</span> <span style="background-color: #fff0f0;">"<meta http-equiv=</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\"</span><span style="background-color: #fff0f0;">refresh</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\"</span><span style="background-color: #fff0f0;"> content=</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\"</span><span style="background-color: #fff0f0;">0;URL=demoThanks.php</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\"</span><span style="background-color: #fff0f0;">>"</span>;
<span style="color: #888888;">//After thank you send an email containing his message to the visitor</span>
<span style="color: #888888;">// prepare email body text</span>
<span style="color: #996633;">$Body</span> <span style="color: #333333;">=</span> <span style="background-color: #fff0f0;">" Madam/Sir,</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;"> Thank you for your message.</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;"> Dysprosium.</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">" ======================================================</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"Name: "</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="color: #996633;">$Name</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">", Esq."</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"From: "</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="color: #996633;">$City</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"Email: "</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="color: #996633;">$Email</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"Subject: "</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="color: #996633;">$Subject</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"Message: "</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="color: #996633;">$Message</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #888888;">// send email </span>
<span style="color: #007020;">mail</span>(<span style="color: #996633;">$Email</span>, <span style="color: #996633;">$Subject</span>, <span style="color: #996633;">$Body</span>, <span style="background-color: #fff0f0;">"From: <</span><span style="background-color: #eeeeee;">$EmailToAdmin</span><span style="background-color: #fff0f0;">>"</span>);
}
<span style="color: #008800; font-weight: bold;">else</span>{
<span style="color: #888888;">//do nothing for now</span>
}
}
<span style="color: #557799;">?></span>
</pre>
</td></tr>
</tbody></table>
</div>
<br />
You can create and put a separate demoError.html, say, demoError2.html page, only for bad formatted emails; that is, emails which are not in form of <a href="mailto:someone@somewhere.com">someone@somewhere.com</a> or .org and so on. <br />
If some spammer uses <a href="mailto:xyz@rxzjq.com">xyz@rxzjq.com</a>, then you cannot check if such a domain as rxzjq.com exists at all. There is few lines you can add. It is by your own risk to be assured if these lines always work correctly. I have checked them dozen of times with the expected correct result.<br />
Please add the following PHP function as a separate piece of PHP to the tail of your demoPoster.php.<br />
<!-- HTML generated using hilite.me --><br />
<div style="background: rgb(255, 255, 255); border-radius: 10px; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<table><tbody>
<tr><td><pre style="line-height: 125%; margin: 0px;"> 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32</pre>
</td><td><pre style="line-height: 125%; margin: 0px;"><span style="color: #557799;"><?Php</span>
<span style="color: #dd4422;">/**</span>
<span style="color: #dd4422;"> * http://www.electrictoolbox.com/php-get-mail-server-ip-address/</span>
<span style="color: #dd4422;"> * Get a mail server's IP address with PHP</span>
<span style="color: #dd4422;"> * Posted November 9th, 2012 in PHP by Chris Hope</span>
<span style="color: #dd4422;"> * Returns an IP address that mail can be delivered to for the passed in domain.</span>
<span style="color: #dd4422;"> *</span>
<span style="color: #dd4422;"> **/</span>
<span style="color: #008800; font-weight: bold;">function</span> <span style="color: #0066bb; font-weight: bold;">MailIPAddress</span>(<span style="color: #996633;">$domain</span>) {
<span style="color: #996633;">$ip</span> <span style="color: #333333;">=</span> <span style="color: #008800; font-weight: bold;">false</span>;
<span style="color: #996633;">$records</span> <span style="color: #333333;">=</span> <span style="color: #007020;">dns_get_record</span>(<span style="color: #996633;">$domain</span>, DNS_MX);
<span style="color: #996633;">$priority</span> <span style="color: #333333;">=</span> <span style="color: #008800; font-weight: bold;">null</span>;
<span style="color: #008800; font-weight: bold;">foreach</span> (<span style="color: #996633;">$records</span> <span style="color: #008800; font-weight: bold;">as</span> <span style="color: #996633;">$record</span>) {
<span style="color: #008800; font-weight: bold;">if</span> (<span style="color: #996633;">$priority</span> <span style="color: #333333;">==</span> <span style="color: #008800; font-weight: bold;">null</span> <span style="color: #333333;">||</span> <span style="color: #996633;">$record</span>[<span style="background-color: #fff0f0;">'pri'</span>] <span style="color: #333333;"><</span> <span style="color: #996633;">$priority</span>) {
<span style="color: #996633;">$myip</span> <span style="color: #333333;">=</span> <span style="color: #007020;">gethostbyname</span>(<span style="color: #996633;">$record</span>[<span style="background-color: #fff0f0;">'target'</span>]);
<span style="color: #888888;">// if the value returned is the same, then the lookup failed</span>
<span style="color: #008800; font-weight: bold;">if</span> (<span style="color: #996633;">$myip</span> <span style="color: #333333;">!=</span> <span style="color: #996633;">$record</span>[<span style="background-color: #fff0f0;">'target'</span>]) {
<span style="color: #996633;">$ip</span> <span style="color: #333333;">=</span> <span style="color: #996633;">$myip</span>;
<span style="color: #996633;">$priority</span> <span style="color: #333333;">=</span> <span style="color: #996633;">$record</span>[<span style="background-color: #fff0f0;">'pri'</span>];
}
}
}
<span style="color: #008800; font-weight: bold;">if</span> (<span style="color: #333333;">!</span><span style="color: #996633;">$ip</span>) {
<span style="color: #996633;">$ip</span> <span style="color: #333333;">=</span> <span style="color: #007020;">gethostbyname</span>(<span style="color: #996633;">$domain</span>);
<span style="color: #888888;">// if the value returned is the same, then the lookup failed</span>
<span style="color: #008800; font-weight: bold;">if</span> (<span style="color: #996633;">$ip</span> <span style="color: #333333;">==</span> <span style="color: #996633;">$domain</span>) {
<span style="color: #996633;">$ip</span> <span style="color: #333333;">=</span> <span style="color: #008800; font-weight: bold;">false</span>;
}
}
<span style="color: #008800; font-weight: bold;">return</span> <span style="color: #996633;">$ip</span>;
}
<span style="color: #557799;">?></span>
</pre>
</td></tr>
</tbody></table>
</div>
<br />
Then use this function as a Boolean together with PHP string <em>explode</em>. PHP <em>explode</em> separates domain part of the email from its name part into a two elements <em>list.</em> <br />
<!-- HTML generated using hilite.me --><br />
<div style="background: rgb(255, 255, 255); border-radius: 3px; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<pre style="line-height: 125%; margin: 0px;"><span style="color: #008800; font-weight: bold;">list</span>(<span style="color: #996633;">$emailPart</span>, <span style="color: #996633;">$domainPart</span>) <span style="color: #333333;">=</span> <span style="color: #007020;">explode</span>(<span style="background-color: #fff0f0;">'@'</span>, <span style="color: #996633;">$Email</span>);
</pre>
</div>
<br />
Now use the Boolean function <br />
<!-- HTML generated using hilite.me --><br />
<div style="background: rgb(255, 255, 255); border-radius: 3px; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<pre style="line-height: 125%; margin: 0px;"><span style="color: #0066bb;"><span style="color: blue;">Boolean</span><span style="color: black;"> </span><strong>MailIPAddress</strong></span>(<span style="color: #996633;">$domainPart</span>);
</pre>
</div>
<br />
together with email format check. We have,<br />
<!-- HTML generated using hilite.me --><br />
<div style="background: rgb(255, 255, 255); border-radius: 6px; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<table><tbody>
<tr><td><pre style="line-height: 125%; margin: 0px;">1
2
3
4
5
6
7</pre>
</td><td><pre style="line-height: 125%; margin: 0px;"><span style="color: #008800; font-weight: bold;">list</span>(<span style="color: #996633;">$emailPart</span>, <span style="color: #996633;">$domainPart</span>) <span style="color: #333333;">=</span> <span style="color: #007020;">explode</span>(<span style="background-color: #fff0f0;">'@'</span>, <span style="color: #996633;">$Email</span>);
<span style="color: #996633;">$one</span><span style="color: #333333;">=</span><span style="color: #007020;">filter_var</span>(<span style="color: #996633;">$Email</span>, FILTER_VALIDATE_EMAIL);
<span style="color: #996633;">$two</span><span style="color: #333333;">=</span>MailIPAddress(<span style="color: #996633;">$domainPart</span>);
<span style="color: #008800; font-weight: bold;">if</span> (<span style="color: #333333;">!</span>((<span style="color: #996633;">$one</span>) <span style="color: #333333;">&&</span> (<span style="color: #996633;">$two</span>))) {
<span style="color: #008800; font-weight: bold;">print</span> <span style="background-color: #fff0f0;">"<meta http-equiv=</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\"</span><span style="background-color: #fff0f0;">refresh</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\"</span><span style="background-color: #fff0f0;"> content=</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\"</span><span style="background-color: #fff0f0;">0;URL=demoError.html</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\"</span><span style="background-color: #fff0f0;">>"</span>;
<span style="color: #008800; font-weight: bold;">exit</span>();
}
</pre>
</td></tr>
</tbody></table>
</div>
<br />
That makes our demoPoster a bit longer and more robust. Again, you can create separate HTML pages in response of different errors. The overall result is the new demoPoster.php, as follows (download <strong><em>PHP</em></strong> code in Zip format <a href="http://messiahpsychoanalyst.org/Codesforus/demoPoster3.zip" target="_blank"><span style="color: #448888;">here</span></a> or open the code in text format <a href="http://messiahpsychoanalyst.org/Codesforus/demoPoster3.txt" target="_blank"><span style="color: #448888;">here</span></a>).<!-- HTML generated using hilite.me --><br />
<!-- HTML generated using hilite.me --><br />
<div style="background: rgb(255, 255, 255); border-radius: 10px; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<table><tbody>
<tr><td><pre style="line-height: 125%; margin: 0px;"> 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105</pre>
</td><td><pre style="line-height: 125%; margin: 0px;"><span style="color: #557799;"><?php</span>
<span style="color: #996633;">$Name</span> <span style="color: #333333;">=</span> Trim(<span style="color: #007020;">stripslashes</span>(<span style="color: #996633;">$_POST</span>[<span style="background-color: #fff0f0;">'Name'</span>]));
<span style="color: #996633;">$City</span> <span style="color: #333333;">=</span> Trim(<span style="color: #007020;">stripslashes</span>(<span style="color: #996633;">$_POST</span>[<span style="background-color: #fff0f0;">'City'</span>]));
<span style="color: #996633;">$Email</span> <span style="color: #333333;">=</span> Trim(<span style="color: #007020;">stripslashes</span>(<span style="color: #996633;">$_POST</span>[<span style="background-color: #fff0f0;">'Email'</span>]));
<span style="color: #996633;">$Subject</span> <span style="color: #333333;">=</span> Trim(<span style="color: #007020;">stripslashes</span>(<span style="color: #996633;">$_POST</span>[<span style="background-color: #fff0f0;">'Subject'</span>]));
<span style="color: #996633;">$Message</span> <span style="color: #333333;">=</span> Trim(<span style="color: #007020;">stripslashes</span>(<span style="color: #996633;">$_POST</span>[<span style="background-color: #fff0f0;">'Message'</span>]));
<span style="color: #008800; font-weight: bold;">if</span> ((<span style="color: #008800; font-weight: bold;">empty</span>(<span style="color: #996633;">$Name</span>))<span style="color: #333333;">||</span>(<span style="color: #008800; font-weight: bold;">empty</span>(<span style="color: #996633;">$Email</span> ))<span style="color: #333333;">||</span>(<span style="color: #008800; font-weight: bold;">empty</span>(<span style="color: #996633;">$Message</span>))) {
<span style="color: #008800; font-weight: bold;">print</span> <span style="background-color: #fff0f0;">"<meta http-equiv=</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\"</span><span style="background-color: #fff0f0;">refresh</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\"</span><span style="background-color: #fff0f0;"> content=</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\"</span><span style="background-color: #fff0f0;">0;URL=demoError2.html</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\"</span><span style="background-color: #fff0f0;">>"</span>;
<span style="color: #008800; font-weight: bold;">exit</span>();
}
<span style="color: #008800; font-weight: bold;">else</span>{
<span style="color: #008800; font-weight: bold;">list</span>(<span style="color: #996633;">$emailPart</span>, <span style="color: #996633;">$domainPart</span>) <span style="color: #333333;">=</span> <span style="color: #007020;">explode</span>(<span style="background-color: #fff0f0;">'@'</span>, <span style="color: #996633;">$Email</span>);
<span style="color: #996633;">$one</span><span style="color: #333333;">=</span><span style="color: #007020;">filter_var</span>(<span style="color: #996633;">$Email</span>, FILTER_VALIDATE_EMAIL);
<span style="color: #996633;">$two</span><span style="color: #333333;">=</span>MailIPAddress(<span style="color: #996633;">$domainPart</span>);
<span style="color: #008800; font-weight: bold;">if</span> (<span style="color: #333333;">!</span>((<span style="color: #996633;">$one</span>) <span style="color: #333333;">&&</span> (<span style="color: #996633;">$two</span>))) {
<span style="color: #008800; font-weight: bold;">print</span> <span style="background-color: #fff0f0;">"<meta http-equiv=</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\"</span><span style="background-color: #fff0f0;">refresh</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\"</span><span style="background-color: #fff0f0;"> content=</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\"</span><span style="background-color: #fff0f0;">0;URL=demoError2.html</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\"</span><span style="background-color: #fff0f0;">>"</span>;
<span style="color: #008800; font-weight: bold;">exit</span>();
}
<span style="color: #888888;">//Next send contact to website admin.</span>
<span style="color: #996633;">$EmailToAdmin</span> <span style="color: #333333;">=</span> <span style="background-color: #fff0f0;">"carlo.dj@messiahpsychoanalyst.org"</span>; <span style="color: #888888;">//Put your website admin email here. Don't forget quotes. </span>
<span style="color: #888888;">// body of the email your own admin receives</span>
<span style="color: #996633;">$Body</span> <span style="color: #333333;">=</span> <span style="background-color: #fff0f0;">"RE: Contact from visitors"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"Name: "</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="color: #996633;">$Name</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"City: "</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="color: #996633;">$City</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"Subject: "</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="color: #996633;">$Subject</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"Email: "</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="color: #996633;">$Email</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"Message: "</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="color: #996633;">$Message</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #888888;">// send email to admin</span>
<span style="color: #996633;">$posted</span> <span style="color: #333333;">=</span> <span style="color: #007020;">mail</span>(<span style="color: #996633;">$EmailToAdmin</span>, <span style="color: #996633;">$Subject</span>, <span style="color: #996633;">$Body</span>, <span style="background-color: #fff0f0;">"From: <</span><span style="background-color: #eeeeee;">$Email</span><span style="background-color: #fff0f0;">>"</span>);
<span style="color: #888888;">// redirect to thanks page </span>
<span style="color: #008800; font-weight: bold;">if</span> (<span style="color: #996633;">$posted</span>){
<span style="color: #008800; font-weight: bold;">print</span> <span style="background-color: #fff0f0;">"<meta http-equiv=</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\"</span><span style="background-color: #fff0f0;">refresh</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\"</span><span style="background-color: #fff0f0;"> content=</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\"</span><span style="background-color: #fff0f0;">0;URL=demoThanks.php</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\"</span><span style="background-color: #fff0f0;">>"</span>;
<span style="color: #888888;">//After thank you send an email containing his message to the visitor</span>
<span style="color: #888888;">// prepare email body text</span>
<span style="color: #996633;">$Body</span> <span style="color: #333333;">=</span> <span style="background-color: #fff0f0;">" Madam/Sir,</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;"> Thank you for your message.</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;"> Dysprosium.</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">" ======================================================</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"Name: "</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="color: #996633;">$Name</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">", Esq."</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"From: "</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="color: #996633;">$City</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"Email: "</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="color: #996633;">$Email</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"Subject: "</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="color: #996633;">$Subject</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"Message: "</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="color: #996633;">$Message</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #888888;">// send email </span>
<span style="color: #007020;">mail</span>(<span style="color: #996633;">$Email</span>, <span style="color: #996633;">$Subject</span>, <span style="color: #996633;">$Body</span>, <span style="background-color: #fff0f0;">"From: <</span><span style="background-color: #eeeeee;">$EmailToAdmin</span><span style="background-color: #fff0f0;">>"</span>);
}
<span style="color: #008800; font-weight: bold;">else</span>{
<span style="color: #888888;">//do nothing for now</span>
}
}
<span style="color: #557799;">?></span>
<span style="color: #557799;"><?Php</span>
<span style="color: #dd4422;">/**</span>
<span style="color: #dd4422;"> * http://www.electrictoolbox.com/php-get-mail-server-ip-address/</span>
<span style="color: #dd4422;"> * Get a mail server's IP address with PHP</span>
<span style="color: #dd4422;"> * Posted November 9th, 2012 in PHP by Chris Hope</span>
<span style="color: #dd4422;"> * Returns an IP address that mail can be delivered to for the passed in domain.</span>
<span style="color: #dd4422;"> *</span>
<span style="color: #dd4422;"> **/</span>
<span style="color: #008800; font-weight: bold;">function</span> <span style="color: #0066bb; font-weight: bold;">MailIPAddress</span>(<span style="color: #996633;">$domain</span>) {
<span style="color: #996633;">$ip</span> <span style="color: #333333;">=</span> <span style="color: #008800; font-weight: bold;">false</span>;
<span style="color: #996633;">$records</span> <span style="color: #333333;">=</span> <span style="color: #007020;">dns_get_record</span>(<span style="color: #996633;">$domain</span>, DNS_MX);
<span style="color: #996633;">$priority</span> <span style="color: #333333;">=</span> <span style="color: #008800; font-weight: bold;">null</span>;
<span style="color: #008800; font-weight: bold;">foreach</span> (<span style="color: #996633;">$records</span> <span style="color: #008800; font-weight: bold;">as</span> <span style="color: #996633;">$record</span>) {
<span style="color: #008800; font-weight: bold;">if</span> (<span style="color: #996633;">$priority</span> <span style="color: #333333;">==</span> <span style="color: #008800; font-weight: bold;">null</span> <span style="color: #333333;">||</span> <span style="color: #996633;">$record</span>[<span style="background-color: #fff0f0;">'pri'</span>] <span style="color: #333333;"><</span> <span style="color: #996633;">$priority</span>) {
<span style="color: #996633;">$myip</span> <span style="color: #333333;">=</span> <span style="color: #007020;">gethostbyname</span>(<span style="color: #996633;">$record</span>[<span style="background-color: #fff0f0;">'target'</span>]);
<span style="color: #888888;">// if the value returned is the same, then the lookup failed</span>
<span style="color: #008800; font-weight: bold;">if</span> (<span style="color: #996633;">$myip</span> <span style="color: #333333;">!=</span> <span style="color: #996633;">$record</span>[<span style="background-color: #fff0f0;">'target'</span>]) {
<span style="color: #996633;">$ip</span> <span style="color: #333333;">=</span> <span style="color: #996633;">$myip</span>;
<span style="color: #996633;">$priority</span> <span style="color: #333333;">=</span> <span style="color: #996633;">$record</span>[<span style="background-color: #fff0f0;">'pri'</span>];
}
}
}
<span style="color: #008800; font-weight: bold;">if</span> (<span style="color: #333333;">!</span><span style="color: #996633;">$ip</span>) {
<span style="color: #996633;">$ip</span> <span style="color: #333333;">=</span> <span style="color: #007020;">gethostbyname</span>(<span style="color: #996633;">$domain</span>);
<span style="color: #888888;">// if the value returned is the same, then the lookup failed</span>
<span style="color: #008800; font-weight: bold;">if</span> (<span style="color: #996633;">$ip</span> <span style="color: #333333;">==</span> <span style="color: #996633;">$domain</span>) {
<span style="color: #996633;">$ip</span> <span style="color: #333333;">=</span> <span style="color: #008800; font-weight: bold;">false</span>;
}
}
<span style="color: #008800; font-weight: bold;">return</span> <span style="color: #996633;">$ip</span>;
}
<span style="color: #557799;">?></span>
</pre>
</td></tr>
</tbody></table>
</div>
<br />
<div style="text-align: justify;">
Quote from the author of the mentioned function,</div>
<div style="text-align: justify;">
</div>
<div style="text-align: justify;">
<em><span style="color: #999999;">"Note that an IP address being returned is no guarantee that there is a mail<br /> server listening at that IP address, or that it will accept mail for the domain </span></em></div>
<div style="text-align: justify;">
<em><span style="color: #999999;"> being queried. It simply returns values based on the DNS records."</span></em></div>
<br />
Next we should retain values of the fields after return of the user if they made an error and left the page. We continue in the next post. <a href="http://codesforus.blogspot.co.uk/2013/12/making-contact-form-for-your-website-6_8.html" target="_blank">Please, click here</a>.<br />
<br />
Download <strong><em>this tutorial as PDF</em></strong> format <a href="http://messiahpsychoanalyst.org/Codesforus/ContactForm_5.pdf" target="_blank"><span style="color: #448888;">here</span></a> <br />
Download <strong><em>part 1 to part 5 as PDF</em></strong> format <a href="http://messiahpsychoanalyst.org/Codesforus/ContactForm1_5.pdf" target="_blank"><span style="color: #448888;">here</span></a> Peter Joneshttp://www.blogger.com/profile/03192918305428815983noreply@blogger.com0tag:blogger.com,1999:blog-667520058465774437.post-36569684551909391992013-12-06T19:53:00.002+00:002014-03-11T12:22:25.013+00:00How to Create a Contact Form for Your Website in an Easy Way : A Set of Step by Step Tutorials Using HTML5, CSS3 and PHP (4)<br />
<span style="color: red;">(For the latest PDF files Merger Software please have a look at the top of the left margin, inside the red box.) </span><br />
Continues From <a href="http://codesforus.blogspot.co.uk/2013/12/making-contact-form-for-your-website-3.html" target="_blank">Part 3</a>. <br />
I have these tasks to finish my contact form.<br />
<ul>
<li>Send a copy of visitor's message back to them, in case he likes to archive it for themselves</li>
<li>Prevent empty fields.</li>
<li>Prevent fake emails.</li>
<li>Prevent flooding by software robots.</li>
<li>Perhaps preventing nasty words.</li>
<li>Keeping filled forms as is to prevent disappointment of visitors when they cannot enter reCaptch correctly. </li>
<li>Put "error" messages in the same page as the contact form.</li>
<li>Put "thanks" message in the same page as the contact form.</li>
<li>As a result, delete demoThanks.php and demoPoster.php files.</li>
</ul>
First thing's first; to send a copy back to visitors. Just add the following lines after line (33) of your demoPoster.php file. <br />
<!-- HTML generated using hilite.me --><br />
<div style="background: rgb(255, 255, 255); border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<table><tbody>
<tr><td><pre style="line-height: 125%; margin: 0px;"> 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23</pre>
</td><td><pre style="line-height: 125%; margin: 0px;"><span style="color: #888888;"><span style="color: #557799;"> </span>//After thank you send an email containing his message to the visitor</span>
<span style="color: #888888;">// prepare email body text</span>
<span style="color: #996633;">$Body</span> <span style="color: #333333;">=</span> <span style="background-color: #fff0f0;">" Madam/Sir,</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;"> Thank you for your message.</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;"> Dysprosium.</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">" ======================================================</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"Name: "</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="color: #996633;">$Name</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">", Esq."</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"From: "</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="color: #996633;">$City</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"Email: "</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="color: #996633;">$Email</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"Subject: "</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="color: #996633;">$Subject</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"Message: "</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="color: #996633;">$Message</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #888888;">// send email </span>
<span style="color: #007020;">mail</span>(<span style="color: #996633;">$Email</span>, <span style="color: #996633;">$Subject</span>, <span style="color: #996633;">$Body</span>, <span style="background-color: #fff0f0;">"From: <</span><span style="background-color: #eeeeee;">$EmailToAdmin</span><span style="background-color: #fff0f0;">>"</span>);
</pre>
</td></tr>
</tbody></table>
</div>
<br />
As a result, at this stage, my demoPoster.php is like this<br />
<!-- HTML generated using hilite.me --><br />
<div style="background: rgb(255, 255, 255); border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<table><tbody>
<tr><td><pre style="line-height: 125%; margin: 0px;"> 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61</pre>
</td><td><pre style="line-height: 125%; margin: 0px;"><span style="color: #557799;"><?php</span>
<span style="color: #996633;">$Name</span> <span style="color: #333333;">=</span> Trim(<span style="color: #007020;">stripslashes</span>(<span style="color: #996633;">$_POST</span>[<span style="background-color: #fff0f0;">'Name'</span>]));
<span style="color: #996633;">$City</span> <span style="color: #333333;">=</span> Trim(<span style="color: #007020;">stripslashes</span>(<span style="color: #996633;">$_POST</span>[<span style="background-color: #fff0f0;">'City'</span>]));
<span style="color: #888888;">//$Email = Trim(stripslashes($_POST['Email'])); </span>
<span style="color: #996633;">$Email</span> <span style="color: #333333;">=</span> <span style="background-color: #fff0f0;">"this.visitor@googlemail.com"</span>;
<span style="color: #996633;">$Subject</span> <span style="color: #333333;">=</span> Trim(<span style="color: #007020;">stripslashes</span>(<span style="color: #996633;">$_POST</span>[<span style="background-color: #fff0f0;">'Subject'</span>]));
<span style="color: #996633;">$Message</span> <span style="color: #333333;">=</span> Trim(<span style="color: #007020;">stripslashes</span>(<span style="color: #996633;">$_POST</span>[<span style="background-color: #fff0f0;">'Message'</span>]));
<span style="color: #888888;">//Next send contact to website admin.</span>
<span style="color: #996633;">$EmailToAdmin</span> <span style="color: #333333;">=</span> <span style="background-color: #fff0f0;">"carlo.dj@messiahpsychoanalyst.org"</span>; <span style="color: #888888;">//Put your website admin email here. Don't forget quotes. </span>
<span style="color: #888888;">// body of the email your own admin receives</span>
<span style="color: #996633;">$Body</span> <span style="color: #333333;">=</span> <span style="background-color: #fff0f0;">"RE: Contact from visitors"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"Name: "</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="color: #996633;">$Name</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"City: "</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="color: #996633;">$City</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"Subject: "</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="color: #996633;">$Subject</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"Email: "</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="color: #996633;">$Email</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"Message: "</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="color: #996633;">$Message</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #888888;">// send email to admin</span>
<span style="color: #996633;">$posted</span> <span style="color: #333333;">=</span> <span style="color: #007020;">mail</span>(<span style="color: #996633;">$EmailToAdmin</span>, <span style="color: #996633;">$Subject</span>, <span style="color: #996633;">$Body</span>, <span style="background-color: #fff0f0;">"From: <</span><span style="background-color: #eeeeee;">$Email</span><span style="background-color: #fff0f0;">>"</span>);
<span style="color: #888888;">// redirect to thanks page </span>
<span style="color: #008800; font-weight: bold;">if</span> (<span style="color: #996633;">$posted</span>){
<span style="color: #008800; font-weight: bold;">print</span> <span style="background-color: #fff0f0;">"<meta http-equiv=</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\"</span><span style="background-color: #fff0f0;">refresh</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\"</span><span style="background-color: #fff0f0;"> content=</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\"</span><span style="background-color: #fff0f0;">0;URL=demoThanks.php</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\"</span><span style="background-color: #fff0f0;">>"</span>;
<span style="color: #888888;">//After thank you send an email containing his message to the visitor</span>
<span style="color: #888888;">// prepare email body text</span>
<span style="color: #996633;">$Body</span> <span style="color: #333333;">=</span> <span style="background-color: #fff0f0;">" Madam/Sir,</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;"> Thank you for your message.</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;"> Dysprosium.</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">" ======================================================</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"Name: "</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="color: #996633;">$Name</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">", Esq."</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"From: "</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="color: #996633;">$City</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"Email: "</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="color: #996633;">$Email</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"Subject: "</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="color: #996633;">$Subject</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"Message: "</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="color: #996633;">$Message</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #888888;">// send email </span>
<span style="color: #007020;">mail</span>(<span style="color: #996633;">$Email</span>, <span style="color: #996633;">$Subject</span>, <span style="color: #996633;">$Body</span>, <span style="background-color: #fff0f0;">"From: <</span><span style="background-color: #eeeeee;">$EmailToAdmin</span><span style="background-color: #fff0f0;">>"</span>);
}
<span style="color: #008800; font-weight: bold;">else</span>{
<span style="color: #888888;">//do nothing for now</span>
}
<span style="color: #557799;">?></span>
</pre>
</td></tr>
</tbody></table>
</div>
<br />
You have swapped email of admin with the email of the visitor. Please compare line (<strong>30</strong>) with line (<strong>56</strong>). Put at line (<strong>5</strong>) email of your friend and at line (<strong>9</strong>) an email of yours and then test your form by filling other parts, leaving email field empty.<br />
Download <strong><em>PHP</em></strong> code in Zip format <a href="http://messiahpsychoanalyst.org/Codesforus/demoPoster1.zip" target="_blank"><span style="color: #448888;">here</span></a> or open the code in text format <a href="http://messiahpsychoanalyst.org/Codesforus/demoPoster1.txt" target="_blank"><span style="color: #448888;">here</span></a>.<br />
Result email that receives to the visitor is like this. You might like to use ideas similar to lines (<strong>36</strong>) and (<strong>37</strong>) to improve the format of the email sent back to the potential customer visitor. (via yourhostingaccount.com is related to my webhosting email administration. Yours could be different.)<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNQHsx9Ev8YlS26H4A6xeF-43lgmfZ7Fw0O36VGfI8fgxtRR2cL_yQRxlgyCNthvqTjetYzEmXEU3wIMPq9vSy5dzU_ttcVT3DlFiZpmEQ-NnqoQDyPcra-TWuvuvktzHEJUq06XBZnZs/s1600/Cfuvisitor.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNQHsx9Ev8YlS26H4A6xeF-43lgmfZ7Fw0O36VGfI8fgxtRR2cL_yQRxlgyCNthvqTjetYzEmXEU3wIMPq9vSy5dzU_ttcVT3DlFiZpmEQ-NnqoQDyPcra-TWuvuvktzHEJUq06XBZnZs/s1600/Cfuvisitor.PNG" height="328" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
Next, preventing empty fields to be submitted. It depends to you that which fields you like to be filled by the visitor and which could be optional. You can explicitly indicate them to the user by putting a red star or dagger in front of the relevant fields and add a paragraph at the bottom to attract attention of users to your requirement. Body of your demoMain.php could be something like this.<br />
<!-- HTML generated using hilite.me --><br />
<div style="background: rgb(255, 255, 255); border-radius: 8px; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<table><tbody>
<tr><td><pre style="line-height: 125%; margin: 0px;"> 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20</pre>
</td><td><pre style="line-height: 125%; margin: 0px;"> <span style="color: #007700;"><body></span>
<span style="color: #007700;"><div</span> <span style="color: #0000cc;">id=</span><span style="background-color: #fff0f0;">"contact-wrapper"</span><span style="color: #007700;">></span>
<span style="color: #007700;"><div</span> <span style="color: #0000cc;">id=</span><span style="background-color: #fff0f0;">"contact-area"</span><span style="color: #007700;">></span>
<span style="color: #007700;"><form</span> <span style="color: #0000cc;">method=</span><span style="background-color: #fff0f0;">"post"</span> <span style="color: #0000cc;">action=</span><span style="background-color: #fff0f0;">"demoPoster1.php"</span><span style="color: #007700;">></span>
<span style="color: #007700;"><label</span> <span style="color: #0000cc;">for=</span><span style="background-color: #fff0f0;">"Name"</span><span style="color: #007700;">><span</span> <span style="color: #0000cc;">style=</span><span style="background-color: #fff0f0;">"color: red; font-size: 100%"</span><span style="color: #007700;">></span>*<span style="color: #880000; font-weight: bold;">&nbsp;</span><span style="color: #007700;"></span></span>Name:<span style="color: #007700;"></label></span>
<span style="color: #007700;"><input</span> <span style="color: #0000cc;">type=</span><span style="background-color: #fff0f0;">"text"</span> <span style="color: #0000cc;">name=</span><span style="background-color: #fff0f0;">"Name"</span> <span style="color: #0000cc;">id=</span><span style="background-color: #fff0f0;">"Name"</span> <span style="color: #0000cc;">value=</span><span style="background-color: #fff0f0;">""</span> <span style="color: #007700;">/></span>
<span style="color: #007700;"><label</span> <span style="color: #0000cc;">for=</span><span style="background-color: #fff0f0;">"City"</span><span style="color: #007700;">></span>City:<span style="color: #007700;"></label></span>
<span style="color: #007700;"><input</span> <span style="color: #0000cc;">type=</span><span style="background-color: #fff0f0;">"text"</span> <span style="color: #0000cc;">name=</span><span style="background-color: #fff0f0;">"City"</span> <span style="color: #0000cc;">id=</span><span style="background-color: #fff0f0;">"City"</span> <span style="color: #0000cc;">value=</span><span style="background-color: #fff0f0;">""</span> <span style="color: #007700;">/></span>
<span style="color: #007700;"><label</span> <span style="color: #0000cc;">for=</span><span style="background-color: #fff0f0;">"Email"</span><span style="color: #007700;">><span</span> <span style="color: #0000cc;">style=</span><span style="background-color: #fff0f0;">"color: red; font-size: 100%"</span><span style="color: #007700;">></span>*<span style="color: #880000; font-weight: bold;">&nbsp;</span><span style="color: #007700;"></span></span>Email:<span style="color: #007700;"></label></span>
<span style="color: #007700;"><input</span> <span style="color: #0000cc;">type=</span><span style="background-color: #fff0f0;">"text"</span> <span style="color: #0000cc;">name=</span><span style="background-color: #fff0f0;">"Email"</span> <span style="color: #0000cc;">id=</span><span style="background-color: #fff0f0;">"Email"</span> <span style="color: #0000cc;">value=</span><span style="background-color: #fff0f0;">""</span> <span style="color: #007700;">/></span>
<span style="color: #007700;"><label</span> <span style="color: #0000cc;">for=</span><span style="background-color: #fff0f0;">"Subject"</span><span style="color: #007700;">></span>Subject:<span style="color: #007700;"></label></span>
<span style="color: #007700;"><input</span> <span style="color: #0000cc;">type=</span><span style="background-color: #fff0f0;">"text"</span> <span style="color: #0000cc;">name=</span><span style="background-color: #fff0f0;">"Subject"</span> <span style="color: #0000cc;">id=</span><span style="background-color: #fff0f0;">"Subject"</span> <span style="color: #0000cc;">value=</span><span style="background-color: #fff0f0;">""</span> <span style="color: #007700;">/></span>
<span style="color: #007700;"><label</span> <span style="color: #0000cc;">for=</span><span style="background-color: #fff0f0;">"Message"</span><span style="color: #007700;">><span</span> <span style="color: #0000cc;">style=</span><span style="background-color: #fff0f0;">"color: red; font-size: 100%"</span><span style="color: #007700;">></span>*<span style="color: #880000; font-weight: bold;">&nbsp;</span><span style="color: #007700;"></span></span>Message:<span style="color: #007700;"></label></span>
<span style="color: #007700;"><textarea</span> <span style="color: #0000cc;">name=</span><span style="background-color: #fff0f0;">"Message"</span> <span style="color: #0000cc;">rows=</span><span style="background-color: #fff0f0;">"20"</span> <span style="color: #0000cc;">cols=</span><span style="background-color: #fff0f0;">"20"</span> <span style="color: #0000cc;">id=</span><span style="background-color: #fff0f0;">"Message"</span><span style="color: #007700;">></textarea></span>
<span style="color: #007700;"><p</span> <span style="color: #0000cc;">style=</span><span style="background-color: #fff0f0;">"margin:20px auto 10px 112px;"</span><span style="color: #007700;">></span>Fields shown by <span style="color: #007700;"><span</span> <span style="color: #0000cc;">style=</span><span style="background-color: #fff0f0;">"color: red; font-size: 100%"</span><span style="color: #007700;">></span>*<span style="color: #880000; font-weight: bold;">&nbsp;</span><span style="color: #007700;"></span></span> are required.<span style="color: #007700;"></p></span>
<span style="color: #007700;"><input</span> <span style="color: #0000cc;">type=</span><span style="background-color: #fff0f0;">"submit"</span> <span style="color: #0000cc;">name=</span><span style="background-color: #fff0f0;">"submit"</span> <span style="color: #0000cc;">value=</span><span style="background-color: #fff0f0;">"Submit"</span> <span style="color: #0000cc;">class=</span><span style="background-color: #fff0f0;">"submit-button"</span> <span style="color: #007700;">/></span>
<span style="color: #007700;"></form></span>
<span style="color: #007700;"></div></span>
<span style="color: #007700;"></div></span>
<span style="color: #007700;"></body></span>
</pre>
</td></tr>
</tbody></table>
</div>
<br />
Now your contact page is like this.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhDjfw32FWaLB-8pCsjHNwl-0xwVJ1XzuoCfG5GPIiu6PdmYABy2Da-EvR3LMp6dLIBmGbcG1FTmi89dueSp2nmT_rHDtPCkyP06OWBFVf9OuBc7mrYwXphfNyZ1pbXAE9AxkBZFUKqaYs/s1600/CfusContactv2.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhDjfw32FWaLB-8pCsjHNwl-0xwVJ1XzuoCfG5GPIiu6PdmYABy2Da-EvR3LMp6dLIBmGbcG1FTmi89dueSp2nmT_rHDtPCkyP06OWBFVf9OuBc7mrYwXphfNyZ1pbXAE9AxkBZFUKqaYs/s1600/CfusContactv2.PNG" height="245" width="400" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<br />
You can view it by <a href="http://messiahpsychoanalyst.org/CodesforusdemoMain2.php" target="_blank">clicking here, please</a>. I called this demoMain2.php to differentiate with previous version, demoMain.php.<br />
Download <strong><em>PHP</em></strong> code in Zip format <a href="http://messiahpsychoanalyst.org/Codesforus/demoMain2.zip" target="_blank"><span style="color: #448888;">here</span></a> or open the code in text format <a href="http://messiahpsychoanalyst.org/Codesforus/demoMain2.txt" target="_blank"><span style="color: #448888;">here</span></a>.<br />
To prevent empty fields or in another word to be able to validate the form there is a facility frequently used inside PHP users . It is <br />
<br />
<div style="background: rgb(255, 255, 255); border-radius: 3px; border: solid gray; overflow: hidden; padding: 4px; width: 150px;">
<pre style="line-height: 100%; margin: 0px;">$validationOK = </pre>
</div>
<br />
Other side of declaration is a Boolean, a test of fields being emptyor desireable.If you put it equal to <strong><em><span style="color: blue;">true</span></em></strong> then it accepts any form filled or empty and process your submissions. We like to test if any of the three required field is being empty the validation fails. At the beginning of each refresh of the page the value of that variable should be initialised to a desired <span style="color: blue;">false</span> or <span style="color: blue;">true</span>.<br />
This is rather tedious and one can use any Boolean to check,<br />
<!-- HTML generated using hilite.me --><br />
<div style="background: rgb(255, 255, 255); border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<table><tbody>
<tr><td><pre style="line-height: 125%; margin: 0px;">1
2
3
4
5</pre>
</td><td><pre style="line-height: 125%; margin: 0px;"><span style="color: #557799;"> </span><span style="color: #008800; font-weight: bold;">if</span>((<span style="color: #008800; font-weight: bold;">empty</span>(<span style="color: #996633;">$Name</span>))<span style="color: #333333;">||</span>(<span style="color: #008800; font-weight: bold;">empty</span>(<span style="color: #996633;">$Email</span> ))<span style="color: #333333;">||</span>(<span style="color: #008800; font-weight: bold;">empty</span>(<span style="color: #996633;">$Message</span>)))
{
<span style="color: #888888;">// Its empty so throw a validation error</span>
<span style="color: #008800; font-weight: bold;">echo</span> <span style="background-color: #fff0f0;">'Input is empty!'</span>;
}
</pre>
</td></tr>
</tbody></table>
</div>
<br />
Command "<em><strong>echo</strong></em>" is an important PHP command that prints something somewhere. It actual puts a string of your choice anywhere you decide. Later we use it to modify our HTML. Now, it is better to redirect error to an <em>error</em> HTML file. Hence,<br />
<!-- HTML generated using hilite.me --><br />
<div style="background: rgb(255, 255, 255); border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<table><tbody>
<tr><td><pre style="line-height: 125%; margin: 0px;">1
2
3
4
5
6</pre>
</td><td><pre style="line-height: 125%; margin: 0px;"><span style="color: #008800; font-weight: bold;"><span style="color: #557799;"> </span>if</span>((<span style="color: #008800; font-weight: bold;">empty</span>(<span style="color: #996633;">$Name</span>))<span style="color: #333333;">||</span>(<span style="color: #008800; font-weight: bold;">empty</span>(<span style="color: #996633;">$Email</span> ))<span style="color: #333333;">||</span>(<span style="color: #008800; font-weight: bold;">empty</span>(<span style="color: #996633;">$Message</span>)))
{
<span style="color: #888888;">// Its empty so throw a validation error </span>
<span style="color: #008800; font-weight: bold;">print</span> <span style="background-color: #fff0f0;">"<meta http-equiv=</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\"</span><span style="background-color: #fff0f0;">refresh</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\"</span><span style="background-color: #fff0f0;"> content=</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\"</span><span style="background-color: #fff0f0;">0;URL=demoError.html</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\"</span><span style="background-color: #fff0f0;">>"</span>;
<span style="color: #008800; font-weight: bold;">exit</span>();
}
</pre>
</td></tr>
</tbody></table>
</div>
<br />
This takes care for any empty field. Make a demoError.html page, and upload it to your website (download <strong><em>PHP</em></strong> code in Zip format <a href="http://messiahpsychoanalyst.org/Codesforus/demoError.zip" target="_blank"><span style="color: #448888;">here</span></a> or open the code in text format <a href="http://messiahpsychoanalyst.org/Codesforus/demoError.txt" target="_blank"><span style="color: #448888;">here</span></a>). Now put the remaining part of the demoPoster.php file after <em><span style="color: blue;">else</span></em> of this <span style="color: blue;"><em>if</em></span>. We are going to have the next file (download <strong><em>PHP</em></strong> code in Zip format <a href="http://messiahpsychoanalyst.org/Codesforus/demoPoster1.zip" target="_blank"><span style="color: #448888;">here</span></a> or open the code in text format <a href="http://messiahpsychoanalyst.org/Codesforus/demoPoster1.txt" target="_blank"><span style="color: #448888;">here</span></a>). <br />
<!-- HTML generated using hilite.me --><br />
<div style="background: rgb(255, 255, 255); border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<table><tbody>
<tr><td><pre style="line-height: 125%; margin: 0px;"> 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67</pre>
</td><td><pre style="line-height: 125%; margin: 0px;"><span style="color: #557799;"><?php</span>
<span style="color: #996633;">$Name</span> <span style="color: #333333;">=</span> Trim(<span style="color: #007020;">stripslashes</span>(<span style="color: #996633;">$_POST</span>[<span style="background-color: #fff0f0;">'Name'</span>]));
<span style="color: #996633;">$City</span> <span style="color: #333333;">=</span> Trim(<span style="color: #007020;">stripslashes</span>(<span style="color: #996633;">$_POST</span>[<span style="background-color: #fff0f0;">'City'</span>]));
<span style="color: #888888;">//$Email = Trim(stripslashes($_POST['Email'])); </span>
<span style="color: #996633;">$Email</span> <span style="color: #333333;">=</span> <span style="background-color: #fff0f0;">"this.visitor@googlemail.com"</span>;
<span style="color: #996633;">$Subject</span> <span style="color: #333333;">=</span> Trim(<span style="color: #007020;">stripslashes</span>(<span style="color: #996633;">$_POST</span>[<span style="background-color: #fff0f0;">'Subject'</span>]));
<span style="color: #996633;">$Message</span> <span style="color: #333333;">=</span> Trim(<span style="color: #007020;">stripslashes</span>(<span style="color: #996633;">$_POST</span>[<span style="background-color: #fff0f0;">'Message'</span>]));
<span style="color: #008800; font-weight: bold;">if</span> ((<span style="color: #008800; font-weight: bold;">empty</span>(<span style="color: #996633;">$Name</span>))<span style="color: #333333;">||</span>(<span style="color: #008800; font-weight: bold;">empty</span>(<span style="color: #996633;">$Email</span> ))<span style="color: #333333;">||</span>(<span style="color: #008800; font-weight: bold;">empty</span>(<span style="color: #996633;">$Message</span>))) {
<span style="color: #008800; font-weight: bold;">print</span> <span style="background-color: #fff0f0;">"<meta http-equiv=</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\"</span><span style="background-color: #fff0f0;">refresh</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\"</span><span style="background-color: #fff0f0;"> content=</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\"</span><span style="background-color: #fff0f0;">0;URL=demoError.html</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\"</span><span style="background-color: #fff0f0;">>"</span>;
<span style="color: #008800; font-weight: bold;">exit</span>();
}
<span style="color: #008800; font-weight: bold;">else</span>{
<span style="color: #888888;">//Next send contact to website admin.</span>
<span style="color: #996633;">$EmailToAdmin</span> <span style="color: #333333;">=</span> <span style="background-color: #fff0f0;">"carlo.dj@messiahpsychoanalyst.org"</span>; <span style="color: #888888;">//Put your website admin email here. Don't forget quotes. </span>
<span style="color: #888888;">// body of the email your own admin receives</span>
<span style="color: #996633;">$Body</span> <span style="color: #333333;">=</span> <span style="background-color: #fff0f0;">"RE: Contact from visitors"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"Name: "</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="color: #996633;">$Name</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"City: "</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="color: #996633;">$City</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"Subject: "</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="color: #996633;">$Subject</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"Email: "</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="color: #996633;">$Email</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"Message: "</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="color: #996633;">$Message</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #888888;">// send email to admin</span>
<span style="color: #996633;">$posted</span> <span style="color: #333333;">=</span> <span style="color: #007020;">mail</span>(<span style="color: #996633;">$EmailToAdmin</span>, <span style="color: #996633;">$Subject</span>, <span style="color: #996633;">$Body</span>, <span style="background-color: #fff0f0;">"From: <</span><span style="background-color: #eeeeee;">$Email</span><span style="background-color: #fff0f0;">>"</span>);
<span style="color: #888888;">// redirect to thanks page </span>
<span style="color: #008800; font-weight: bold;">if</span> (<span style="color: #996633;">$posted</span>){
<span style="color: #008800; font-weight: bold;">print</span> <span style="background-color: #fff0f0;">"<meta http-equiv=</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\"</span><span style="background-color: #fff0f0;">refresh</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\"</span><span style="background-color: #fff0f0;"> content=</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\"</span><span style="background-color: #fff0f0;">0;URL=demoThanks.php</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\"</span><span style="background-color: #fff0f0;">>"</span>;
<span style="color: #888888;">//After thank you send an email containing his message to the visitor</span>
<span style="color: #888888;">// prepare email body text</span>
<span style="color: #996633;">$Body</span> <span style="color: #333333;">=</span> <span style="background-color: #fff0f0;">" Madam/Sir,</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;"> Thank you for your message.</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;"> Dysprosium.</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">" ======================================================</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"Name: "</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="color: #996633;">$Name</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">", Esq."</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"From: "</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="color: #996633;">$City</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"Email: "</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="color: #996633;">$Email</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"Subject: "</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="color: #996633;">$Subject</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"Message: "</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="color: #996633;">$Message</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #888888;">// send email </span>
<span style="color: #007020;">mail</span>(<span style="color: #996633;">$Email</span>, <span style="color: #996633;">$Subject</span>, <span style="color: #996633;">$Body</span>, <span style="background-color: #fff0f0;">"From: <</span><span style="background-color: #eeeeee;">$EmailToAdmin</span><span style="background-color: #fff0f0;">>"</span>);
}
<span style="color: #008800; font-weight: bold;">else</span>{
<span style="color: #888888;">//do nothing for now</span>
}
}
<span style="color: #557799;">?></span>
</pre>
</td></tr>
</tbody></table>
</div>
<br />
and demoError.html is something like the following file (download <strong><em>PHP</em></strong> code in Zip format <a href="http://messiahpsychoanalyst.org/Codesforus/demoError.zip" target="_blank"><span style="color: #448888;">here</span></a> or open the code in text format <a href="http://messiahpsychoanalyst.org/Codesforus/demoError.txt" target="_blank"><span style="color: #448888;">here</span></a>).<br />
<!-- HTML generated using hilite.me --><br />
<div style="background: rgb(255, 255, 255); border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<table><tbody>
<tr><td><pre style="line-height: 125%; margin: 0px;"> 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34</pre>
</td><td><pre style="line-height: 125%; margin: 0px;"><span style="color: #557799;"><!DOCTYPE html></span>
<span style="color: #888888;"><!--</span>
<span style="color: #888888;">To change this license header, choose License Headers in Project Properties.</span>
<span style="color: #888888;">To change this template file, choose Tools | Templates</span>
<span style="color: #888888;">and open the template in the editor.</span>
<span style="color: #888888;">--></span>
<span style="color: #007700;"><html></span>
<span style="color: #007700;"><head></span>
<span style="color: #007700;"><title></span>This is a Demo Error Page<span style="color: #007700;"></title></span>
<span style="color: #007700;"><meta</span> <span style="color: #0000cc;">charset=</span><span style="background-color: #fff0f0;">"UTF-8"</span><span style="color: #007700;">></span>
<span style="color: #007700;"><meta</span> <span style="color: #0000cc;">name=</span><span style="background-color: #fff0f0;">"viewport"</span> <span style="color: #0000cc;">content=</span><span style="background-color: #fff0f0;">"width=device-width"</span><span style="color: #007700;">></span>
<span style="color: #007700;"><style></span>
<span style="color: #0066bb; font-weight: bold;">#phonix-wrapper</span> {
<span style="color: #008800; font-weight: bold;">margin</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">20px</span> <span style="color: #008800; font-weight: bold;">auto</span>;
<span style="color: #008800; font-weight: bold;">border</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">2px</span> <span style="color: #008800; font-weight: bold;">solid</span> <span style="color: #6600ee; font-weight: bold;">#ccc</span>;
<span style="color: #008800; font-weight: bold;">border</span><span style="color: #333333;">-</span>radius<span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">10px</span>;
<span style="color: #008800; font-weight: bold;">padding</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">20px</span> <span style="color: #6600ee; font-weight: bold;">50px</span> <span style="color: #6600ee; font-weight: bold;">20px</span> <span style="color: #6600ee; font-weight: bold;">50px</span>;
<span style="color: #008800; font-weight: bold;">background</span><span style="color: #333333;">:</span> <span style="color: #008800; font-weight: bold;">transparent</span>;
<span style="color: #008800; font-weight: bold;">width</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">600px</span>;
<span style="color: #008800; font-weight: bold;">min-height</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">500px</span>;
<span style="color: #008800; font-weight: bold;">height</span><span style="color: #333333;">:</span> <span style="color: #008800; font-weight: bold;">auto</span> <span style="color: #557799;">!important</span>;
<span style="color: #008800; font-weight: bold;">height</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">500px</span>;
}
<span style="color: #007700;"></style></span>
<span style="color: #007700;"></head></span>
<span style="color: #007700;"><body></span>
<span style="color: #007700;"><div</span> <span style="color: #0000cc;">id=</span><span style="background-color: #fff0f0;">"phonix-wrapper"</span><span style="color: #007700;">></span>
<span style="color: #007700;"><p></span>By Dysprosium<span style="color: #007700;"></p></span>
<span style="color: #007700;"><hr</span> <span style="color: #0000cc;">style=</span><span style="background-color: #fff0f0;">'margin: 1px auto 1px auto; height: 1px; color: #fefefe; width: 82%;'</span><span style="color: #007700;">/></span>
<span style="color: #007700;"><h1></span>Sorry! You left a required field empty. Please try again.<span style="color: #007700;"></h1></span>
<span style="color: #007700;"><p><a</span> <span style="color: #0000cc;">href=</span><span style="background-color: #fff0f0;">"demoMain2.php"</span><span style="color: #007700;">></span>Refresh Contact Form<span style="color: #007700;"></a></p></span>
<span style="color: #007700;"><p></span>Or use your browser back button to amend your message.<span style="color: #007700;"></p></span>
<span style="color: #007700;"></div></span>
<span style="color: #007700;"></html></span>
</pre>
</td></tr>
</tbody></table>
</div>
<br />
<a href="http://messiahpsychoanalyst.org/Codesforus/demoError.html" target="_blank">Please click here</a> to watch it. I put a snapshot here for your attention.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgRrLRKq_os64bC1N0fECNgk2cpJ_SiHUgRD2HLddVZmXj2_S17cy7uqDTnrCbBv45szGuQxpOujETreMJWefu_2GOsv_t1p_YRHf9fyn7p4j5Sneh8_U06C2cNFxSwQnkOj4XYgJuezIY/s1600/Cfuerror.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgRrLRKq_os64bC1N0fECNgk2cpJ_SiHUgRD2HLddVZmXj2_S17cy7uqDTnrCbBv45szGuQxpOujETreMJWefu_2GOsv_t1p_YRHf9fyn7p4j5Sneh8_U06C2cNFxSwQnkOj4XYgJuezIY/s400/Cfuerror.PNG" height="315" width="400" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
This post became too long. I'll continue in next posts; <a href="http://codesforus.blogspot.co.uk/2013/12/making-contact-form-for-your-website-5.html" target="_blank">please click here</a>. Thanks.<br />
<br />
Download <strong><em>this tutorial as PDF</em></strong> format <a href="http://messiahpsychoanalyst.org/Codesforus/ContactForm_4.pdf" target="_blank"><span style="color: #448888;">here</span></a> <br />
Download <strong><em>part 1 to part 4 as PDF</em></strong> format <a href="http://messiahpsychoanalyst.org/Codesforus/ContactForm1_4.pdf" target="_blank"><span style="color: #448888;">here</span></a> Peter Joneshttp://www.blogger.com/profile/03192918305428815983noreply@blogger.com0tag:blogger.com,1999:blog-667520058465774437.post-6243231165989660722013-12-05T20:34:00.001+00:002014-03-11T12:20:59.808+00:00How to Create a Contact Form for Your Website in an Easy Way : A Set of Step by Step Tutorials Using HTML5, CSS3 and PHP (3)<span style="color: red;">(For the latest PDF files Merger Software please have a look at the top of the left margin, inside the red box.) </span><br />
Continues From <a href="http://codesforus.blogspot.co.uk/2013/12/making-contact-form-for-your-website-2.html" target="_blank">Part 2</a>. <br />
<h4>
How to dispatch message of the contact form?</h4>
To be able to receive messages of visitors your contact form should become live with its required "<em>action</em>." Note that your "<em>action</em>" was empty. <br />
<!-- HTML generated using hilite.me --><br />
<div style="background: rgb(255, 255, 255); border-radius: 3px; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<table><tbody>
<tr><td><pre style="line-height: 125%; margin: 0px;">1</pre>
</td><td><pre style="line-height: 125%; margin: 0px;"><span style="color: #007700;"><form</span> <span style="color: #0000cc;">method=</span><span style="background-color: #fff0f0;">"post"</span> <span style="color: #0000cc;">action=</span><span style="background-color: #fff0f0;">""</span><span style="color: #007700;">></span>
</pre>
</td></tr>
</tbody></table>
</div>
<br />
Your form page and your "<em>thanks</em>" page are said to be "<em>client-side</em>" visible to clients. You need your "<em>server-side</em>" PHP page visible to you to put on your web-server. This will forward messages from visitor to a known place of yours, usually a mailbox of yours, created for this purpose or else of your daily usage. If you create it purpose built then could be easily portable when you change your hosting service. You can keep things organised and separate from your other administrative chores.
First the version without loop-back to the visitor.
<!-- HTML generated using hilite.me --><br />
<div style="background: rgb(255, 255, 255); border-radius: 10px; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<table><tbody>
<tr><td><pre style="line-height: 125%; margin: 0px;"> 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38</pre>
</td><td><pre style="line-height: 125%; margin: 0px;"><span style="color: #557799;"><?php</span>
<span style="color: #996633;">$Name</span> <span style="color: #333333;">=</span> Trim(<span style="color: #007020;">stripslashes</span>(<span style="color: #996633;">$_POST</span>[<span style="background-color: #fff0f0;">'Name'</span>]));
<span style="color: #996633;">$City</span> <span style="color: #333333;">=</span> Trim(<span style="color: #007020;">stripslashes</span>(<span style="color: #996633;">$_POST</span>[<span style="background-color: #fff0f0;">'City'</span>]));
<span style="color: #888888;">//$Email = Trim(stripslashes($_POST['Email'])); </span>
<span style="color: #996633;">$Email</span> <span style="color: #333333;">=</span> <span style="background-color: #fff0f0;">"this.visitor@googlemail.com"</span>;
<span style="color: #996633;">$Subject</span> <span style="color: #333333;">=</span> Trim(<span style="color: #007020;">stripslashes</span>(<span style="color: #996633;">$_POST</span>[<span style="background-color: #fff0f0;">'Subject'</span>]));
<span style="color: #996633;">$Message</span> <span style="color: #333333;">=</span> Trim(<span style="color: #007020;">stripslashes</span>(<span style="color: #996633;">$_POST</span>[<span style="background-color: #fff0f0;">'Message'</span>]));
<span style="color: #888888;">//Next send contact to website admin.</span>
<span style="color: #996633;">$EmailToAdmin</span> <span style="color: #333333;">=</span> <span style="background-color: #fff0f0;">"carlo.dj@messiahpsychoanalyst.org"</span>; <span style="color: #888888;">//Put your website admin email here. Don't forget quotes. </span>
<span style="color: #888888;">// body of the email your own admin receives</span>
<span style="color: #996633;">$Body</span> <span style="color: #333333;">=</span> <span style="background-color: #fff0f0;">"RE: Contact from visitors"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"Name: "</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="color: #996633;">$Name</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"City: "</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="color: #996633;">$City</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"Subject: "</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="color: #996633;">$Subject</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"Email: "</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="color: #996633;">$Email</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"Message: "</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="color: #996633;">$Message</span>;
<span style="color: #996633;">$Body</span> <span style="color: #333333;">.=</span> <span style="background-color: #fff0f0;">"</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\n</span><span style="background-color: #fff0f0;">"</span>;
<span style="color: #888888;">// send email to admin</span>
<span style="color: #996633;">$posted</span> <span style="color: #333333;">=</span> <span style="color: #007020;">mail</span>(<span style="color: #996633;">$EmailToAdmin</span>, <span style="color: #996633;">$Subject</span>, <span style="color: #996633;">$Body</span>, <span style="background-color: #fff0f0;">"From: <</span><span style="background-color: #eeeeee;">$Email</span><span style="background-color: #fff0f0;">>"</span>);
<span style="color: #888888;">// redirect to thanks page </span>
<span style="color: #008800; font-weight: bold;">if</span> (<span style="color: #996633;">$posted</span>){
<span style="color: #008800; font-weight: bold;">print</span> <span style="background-color: #fff0f0;">"<meta http-equiv=</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\"</span><span style="background-color: #fff0f0;">refresh</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\"</span><span style="background-color: #fff0f0;"> content=</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\"</span><span style="background-color: #fff0f0;">0;URL=demoThanks.php</span><span style="background-color: #fff0f0; color: #666666; font-weight: bold;">\"</span><span style="background-color: #fff0f0;">>"</span>;
}
<span style="color: #008800; font-weight: bold;">else</span>{
<span style="color: #888888;">//do nothing for now</span>
}
<span style="color: #557799;">?></span></pre>
</td></tr>
</tbody></table>
</div>
<br />
Line (<strong>9</strong>), carlo.dj AT messiahpsychonalyst is my admin who receives messages for my website. I have commented out sender's email place-holder at line (<strong>4</strong>) to prevent bots and spammers attack my site before I put enough robust barriers on their way. Later I will un-comment that line. In place of that I put email of one old colleague I know (with his permission) at line (<strong>5</strong>). After finishing the design I remove it. I save this file as a PHP file (I have saved it as <em><strong>demoPoster.php</strong></em>) and upload it to my website. <br />
<br />
Note that now I have three PHP file for the contact page in my website.<br />
<ul>
<li>First, demoMain.php which is my original contact page. Now it is pure HTML, but later many PHP parts will be added to it.</li>
<li>Second file is the "<em>thanks</em>" file, demoThanks.php. This is also pure HTML saved as a PHP file.</li>
<li>Third, is all PHP file in the server-side, demoPoster.php</li>
</ul>
It is better to upload all of them to the "<em>root</em>" directory of website for the ease of <em><strong>path-finding</strong></em>.<br />
<br />
In the next stage, I change my contact form page from this, <br />
<!-- HTML generated using hilite.me --><br />
<div style="background: rgb(255, 255, 255); border-radius: 3px; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<table><tbody>
<tr><td><pre style="line-height: 125%; margin: 0px;">1</pre>
</td><td><pre style="line-height: 125%; margin: 0px;"><span style="color: #007700;"><form</span> <span style="color: #0000cc;">method=</span><span style="background-color: #fff0f0;">"post"</span> <span style="color: #0000cc;">action=</span><span style="background-color: #fff0f0;">""</span><span style="color: #007700;">></span>
</pre>
</td></tr>
</tbody></table>
</div>
<br />
to this one,<br />
<!-- HTML generated using hilite.me --><br />
<div style="background: rgb(255, 255, 255); border-radius: 3px; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<table><tbody>
<tr><td><pre style="line-height: 125%; margin: 0px;">1</pre>
</td><td><pre style="line-height: 125%; margin: 0px;"><span style="color: #007700;"><form</span> <span style="color: #0000cc;">method=</span><span style="background-color: #fff0f0;">"post"</span> <span style="color: #0000cc;">action=</span><span style="background-color: #fff0f0;">"demoPoster.php"</span><span style="color: #007700;">></span>
</pre>
</td></tr>
</tbody></table>
</div>
<br />
I test it with filling all fields, except the email field. There is no need and no use of filling that for now, as I have locked it by putting line (5) in the uploaded demoPoster.php. My admin has received the message and its snapshot is here.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjgdpg_XL_-rpMhBLvUI1jL-VztbDfdRmLxACxzBAoT-ZxeSTZXRZFGOSgDzU0oP4tFA3bvpAjpGN9vjwj1GVUm4YswPb3z5wpS4CJRbXTFJpB0rJaSvptzhSMI_uPz4XUrIwdpNXbBMN4/s1600/Cfusreceived.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjgdpg_XL_-rpMhBLvUI1jL-VztbDfdRmLxACxzBAoT-ZxeSTZXRZFGOSgDzU0oP4tFA3bvpAjpGN9vjwj1GVUm4YswPb3z5wpS4CJRbXTFJpB0rJaSvptzhSMI_uPz4XUrIwdpNXbBMN4/s1600/Cfusreceived.PNG" height="308" width="400" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
So far so good. It works perfectly. I could use it if it was not for the spamming bots. <br />
One of the best filters available is the free open source and flexible reCaptcha filter that tests the visitor for being human rather than a software robot flooding crawler. I should add that to my page to barricade my site. It is in the <a href="http://codesforus.blogspot.co.uk/2013/12/making-contact-form-for-your-website-4.html" target="_blank">next post</a>. My other tasks are preventing empty fields and fake emails.<br />
Download PHP code in Zip format, <a href="http://messiahpsychoanalyst.org/Codesforus/demoPoster0.zip" target="_blank">here</a>. Open code as text in browser, <a href="http://messiahpsychoanalyst.org/Codesforus/demoPoster0.txt" target="_blank">here</a>.<br />
<br />
Download <strong><em>this tutorial as PDF</em></strong> format <a href="http://messiahpsychoanalyst.org/Codesforus/ContactForm_3.pdf" target="_blank"><span style="color: #448888;">here</span></a> <br />
Download <strong><em>part 1 to part 3 as PDF</em></strong> format <a href="http://messiahpsychoanalyst.org/Codesforus/ContactForm1_3.pdf" target="_blank"><span style="color: #448888;">here</span></a> Peter Joneshttp://www.blogger.com/profile/03192918305428815983noreply@blogger.com0tag:blogger.com,1999:blog-667520058465774437.post-38139620794343977442013-12-05T14:07:00.000+00:002014-03-11T12:18:07.038+00:00How to Create a Contact Form for Your Website in an Easy Way : A Set of Step by Step Tutorials Using HTML5, CSS3 and PHP (2)<span style="color: red;">(For the latest PDF files Merger Software please have a look at the top of the left margin, inside the red box.) </span><br />
Continues From <a href="http://codesforus.blogspot.co.uk/2013/12/making-contact-form-for-your-website-1.html" target="_blank">Part 1</a>. <br />
<br />
First of all when you save your contact form, save it as a <strong><em>PHP</em></strong> file not an <em><strong>HTML</strong></em>. My example is demoMain.php <em><strong>not</strong></em> the demoMain.html. You need two more <strong><em>PHP</em></strong> files.<br />
<ul>
<li>First, a file to inform and thanks the sender of the message. </li>
<ul>
<li>I call this demoThanks.php.</li>
</ul>
<li>Second, a file that informs you of the sender's address and content of their message.</li>
<ul>
<li>I call this demoPoster.php file.</li>
<li>It is a good manner to send back content of the message to the visitor as a courtesy if he likes to archive it for himself and inside the demoPoster.php I put this in practice, too.</li>
</ul>
</ul>
Therefore, for now I have three files that for the ease of mind all are saved as <strong><em>PHP</em></strong>. Later, I remove these files as I make my contact form more advanced and I will not need them any longer. <br />
<br />
Let me show you the elaborate page I created as a thank you message for the visitor.<br />
<!-- HTML generated using hilite.me --><br />
<div style="background: rgb(255, 255, 255); border-radius: 10px; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<table><tbody>
<tr><td><pre style="line-height: 125%; margin: 0px;"> 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37</pre>
</td><td><pre style="line-height: 125%; margin: 0px;"><span style="color: #557799;"><!DOCTYPE html></span>
<span style="color: #888888;"><!--</span>
<span style="color: #888888;">To change this license header, choose License Headers in Project Properties.</span>
<span style="color: #888888;">To change this template file, choose Tools | Templates</span>
<span style="color: #888888;">and open the template in the editor.</span>
<span style="color: #888888;">--></span>
<span style="color: #007700;"><html></span>
<span style="color: #007700;"><head></span>
<span style="color: #007700;"><title></span>Phoenix Thanks for Your Message<span style="color: #007700;"></title></span>
<span style="color: #007700;"><meta</span> <span style="color: #0000cc;">charset=</span><span style="background-color: #fff0f0;">"UTF-8"</span> <span style="color: #007700;">></span>
<span style="color: #007700;"><meta</span> <span style="color: #0000cc;">name=</span><span style="background-color: #fff0f0;">"viewport"</span> <span style="color: #0000cc;">content=</span><span style="background-color: #fff0f0;">"width=device-width"</span> <span style="color: #007700;">></span>
<span style="color: #007700;"><link</span> <span style="color: #0000cc;">rel=</span><span style="background-color: #fff0f0;">"stylesheet"</span> <span style="color: #0000cc;">type=</span><span style="background-color: #fff0f0;">"text/css"</span> <span style="color: #0000cc;">href=</span><span style="background-color: #fff0f0;">"/MP_Master.css"</span> <span style="color: #007700;">/></span>
<span style="color: #007700;"></head></span>
<span style="color: #007700;"><body></span>
<span style="color: #007700;"><div</span> <span style="color: #0000cc;">style=</span><span style="background-color: #fff0f0;">'padding-left: 10px; background-image: url("/Images/Themes/bg_home.jpg");'</span> <span style="color: #0000cc;">class=</span><span style="background-color: #fff0f0;">"MP_Page_Left Zone_Page_L"</span><span style="color: #007700;">></span>
<span style="color: #007700;"><img</span> <span style="color: #0000cc;">src=</span><span style="background-color: #fff0f0;">"/Images/Logos/phoenix.jpg"</span> <span style="color: #0000cc;">alt=</span><span style="background-color: #fff0f0;">"Phoenix"</span> <span style="color: #007700;">/></span>
<span style="color: #007700;"><p></span>By <span style="color: #007700;"><a</span> <span style="color: #0000cc;">href=</span><span style="background-color: #fff0f0;">"http://messiahpsychoanalyst.org"</span> <span style="color: #0000cc;">class=</span><span style="background-color: #fff0f0;">"MP_LinkStyle"</span><span style="color: #007700;">></span>Dysprosium<span style="color: #007700;"></a></p></span>
<span style="color: #007700;"><hr</span> <span style="color: #0000cc;">style=</span><span style="background-color: #fff0f0;">'margin: 1px auto 1px auto; height: 1px; color: #fefefe; width: 82%;'</span><span style="color: #007700;">/></span>
<span style="color: #007700;"><h1></span>Your message has been sent! Thanks for Your Message!<span style="color: #007700;"></h1></span>
<span style="color: #007700;"><p><a</span> <span style="color: #0000cc;">href=</span><span style="background-color: #fff0f0;">"Home.html"</span> <span style="color: #0000cc;">class=</span><span style="background-color: #fff0f0;">"MP_LinkStyle"</span><span style="color: #007700;">></span>Back to Home Page!<span style="color: #007700;"></a></p></span>
<span style="color: #007700;"></div></span>
<span style="color: #888888;"><!-- CXNID=5426436&Code=C2 Google--></span>
<span style="color: #007700;"><script </span><span style="color: #0000cc;">type=</span><span style="background-color: #fff0f0;">"text/javascript"</span><span style="color: #007700;">></span>
<span style="color: #008800; font-weight: bold;">var</span> gaJsHost <span style="color: #333333;">=</span> ((<span style="background-color: #fff0f0;">"https:"</span><span style="color: #333333;">===</span> <span style="color: #007020;">document</span>.location.protocol) <span style="color: #333333;">?</span> <span style="background-color: #fff0f0;">"https://ssl."</span> <span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"http://www."</span>);
<span style="color: #007020;">document</span>.write(unescape(<span style="background-color: #fff0f0;">"%3Cscript src='"</span> <span style="color: #333333;">+</span> gaJsHost <span style="color: #333333;">+</span> <span style="background-color: #fff0f0;">"google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"</span>));
<span style="color: #007700;"></script></span>
<span style="color: #007700;"><script </span><span style="color: #0000cc;">type=</span><span style="background-color: #fff0f0;">"text/javascript"</span><span style="color: #007700;">></span>
<span style="color: #008800; font-weight: bold;">try</span> {
<span style="color: #008800; font-weight: bold;">var</span> pageTracker <span style="color: #333333;">=</span> _gat._getTracker(<span style="background-color: #fff0f0;">"UA-10441212-1"</span>);
pageTracker._setDomainName(<span style="background-color: #fff0f0;">".messiahpsychoanalyst.org"</span>);
pageTracker._trackPageview();
}
<span style="color: #008800; font-weight: bold;">catch</span>(err) {}
<span style="color: #007700;"></script></span>
<span style="color: #007700;"></body></span>
<span style="color: #007700;"></html></span>
</pre>
</td></tr>
</tbody></table>
</div>
<br />
You can watch it <a href="http://messiahpsychoanalyst.org/phoenix.php" target="_blank">by clicking here, please</a>. There are items in the code which are not of your interest. I explain them for you such that you replace them with yours if you like, and then I give a simple skeleton of the page.<br />
<ul>
<li>I have a link to refer to my master CSS file. Please replace it with yours.<!-- HTML generated using hilite.me --></li>
</ul>
<div style="background: rgb(255, 255, 255); border-radius: 3px; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<table><tbody>
<tr><td><pre style="line-height: 125%; margin: 0px;">1</pre>
</td><td><pre style="line-height: 125%; margin: 0px;"><span style="color: #007700;"><link</span> <span style="color: #0000cc;">rel=</span><span style="background-color: #fff0f0;">"stylesheet"</span> <span style="color: #0000cc;">type=</span><span style="background-color: #fff0f0;">"text/css"</span> <span style="color: #0000cc;">href=</span><span style="background-color: #fff0f0;">"/MP_Master.css"</span> <span style="color: #007700;">/></span>
</pre>
</td></tr>
</tbody></table>
</div>
<ul>
<li>the division tag, div, in the page has my own taste and options from my CSS master file. Later, I am going to replace it with a simple style for this demonstration.<!-- HTML generated using hilite.me --></li>
</ul>
<div style="background: rgb(255, 255, 255); border-radius: 3px; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<table><tbody>
<tr><td><pre style="line-height: 125%; margin: 0px;">1</pre>
</td><td><pre style="line-height: 125%; margin: 0px;"><span style="color: #007700;"><div</span> <span style="color: #0000cc;">style=</span><span style="background-color: #fff0f0;">'padding-left: 10px; background-image: url("/Images/Themes/bg_home.jpg");'</span> <span style="color: #0000cc;">class=</span><span style="background-color: #fff0f0;">"MP_Page_Left Zone_Page_L"</span><span style="color: #007700;">></span>
</pre>
</td></tr>
</tbody></table>
</div>
<ul>
<li>I have an emblem, similar to my favicon that I'll remove for simplicity. You can put your organisation emblem there.</li>
</ul>
<div style="background: rgb(255, 255, 255); border-radius: 3px; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<table><tbody>
<tr><td><pre style="line-height: 125%; margin: 0px;">1</pre>
</td><td><pre style="line-height: 125%; margin: 0px;"><span style="color: #007700;"><img</span> <span style="color: #0000cc;">src=</span><span style="background-color: #fff0f0;">"/Images/Logos/phoenix.jpg"</span> <span style="color: #0000cc;">alt=</span><span style="background-color: #fff0f0;">"Phoenix"</span> <span style="color: #007700;">/></span>
</pre>
</td></tr>
</tbody></table>
</div>
<ul>
<li>My signature link has its own style to be visible in sky blue background and all. Yours could be different. <!-- HTML generated using hilite.me --></li>
</ul>
<div style="background: rgb(255, 255, 255); border-radius: 3px; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<table><tbody>
<tr><td><pre style="line-height: 125%; margin: 0px;">1</pre>
</td><td><pre style="line-height: 125%; margin: 0px;"><span style="color: #007700;"><a</span> <span style="color: #0000cc;">href=</span><span style="background-color: #fff0f0;">"http://messiahpsychoanalyst.org"</span> <span style="color: #0000cc;">class=</span><span style="background-color: #fff0f0;">"MP_LinkStyle"</span><span style="color: #007700;">></span>Dysprosium<span style="color: #007700;"></a></span>
</pre>
</td></tr>
</tbody></table>
</div>
<ul>
<li>That also applies to return page. You can select any page to return to. Best is your home page or whatever.<!-- HTML generated using hilite.me --></li>
</ul>
<div style="background: rgb(255, 255, 255); border-radius: 3px; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<table><tbody>
<tr><td><pre style="line-height: 125%; margin: 0px;">1</pre>
</td><td><pre style="line-height: 125%; margin: 0px;"><span style="color: #007700;"><a</span> <span style="color: #0000cc;">href=</span><span style="background-color: #fff0f0;">"Home.html"</span> <span style="color: #0000cc;">class=</span><span style="background-color: #fff0f0;">"MP_LinkStyle"</span><span style="color: #007700;">></span>Back to Home Page!<span style="color: #007700;"></a></span>
</pre>
</td></tr>
</tbody></table>
</div>
<ul>
<li>I have put a tracker (mine is google analytics). Yours could be provider of your choice. It is a good practice such that you can have a click to add to your presence on the Internet.<!-- HTML generated using hilite.me --></li>
</ul>
<div style="background: rgb(255, 255, 255); border-radius: 8px; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<table><tbody>
<tr><td><pre style="line-height: 125%; margin: 0px;"> 1
2
3
4
5
6
7
8
9
10
11
12
13</pre>
</td><td><pre style="line-height: 125%; margin: 0px;"> <span style="color: #888888;"><!--</span> CXNID<span style="color: #333333;">=</span><span style="color: #0000dd; font-weight: bold;">5426436</span><span style="color: #333333;">&</span>Code<span style="color: #333333;">=</span>C2 Google<span style="color: #333333;">--></span>
<span style="color: #333333;"><</span>script type<span style="color: #333333;">=</span><span style="background-color: #fff0f0;">"text/javascript"</span><span style="color: #333333;">></span>
<span style="color: #008800; font-weight: bold;">var</span> gaJsHost <span style="color: #333333;">=</span> ((<span style="background-color: #fff0f0;">"https:"</span><span style="color: #333333;">===</span> <span style="color: #007020;">document</span>.location.protocol) <span style="color: #333333;">?</span> <span style="background-color: #fff0f0;">"https://ssl."</span> <span style="color: #333333;">:</span> <span style="background-color: #fff0f0;">"http://www."</span>);
<span style="color: #007020;">document</span>.write(unescape(<span style="background-color: #fff0f0;">"%3Cscript src='"</span> <span style="color: #333333;">+</span> gaJsHost <span style="color: #333333;">+</span> <span style="background-color: #fff0f0;">"google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"</span>));
<span style="color: #333333;"><</span><span style="background-color: #ffaaaa; color: red;">/script></span>
<span style="color: #333333;"><</span>script type<span style="color: #333333;">=</span><span style="background-color: #fff0f0;">"text/javascript"</span><span style="color: #333333;">></span>
<span style="color: #008800; font-weight: bold;">try</span> {
<span style="color: #008800; font-weight: bold;">var</span> pageTracker <span style="color: #333333;">=</span> _gat._getTracker(<span style="background-color: #fff0f0;">"UA-10441212-1"</span>);
pageTracker._setDomainName(<span style="background-color: #fff0f0;">".messiahpsychoanalyst.org"</span>);
pageTracker._trackPageview();
}
<span style="color: #008800; font-weight: bold;">catch</span>(err) {}
<span style="color: #333333;"><</span><span style="background-color: #ffaaaa; color: red;">/script></span>
</pre>
</td></tr>
</tbody></table>
</div>
<br />
And that is all. Now, I put the simplified version.<br />
<!-- HTML generated using hilite.me --><br />
<div style="background: rgb(255, 255, 255); border-radius: 10px; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<table><tbody>
<tr><td><pre style="line-height: 125%; margin: 0px;"> 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34</pre>
</td><td><pre style="line-height: 125%; margin: 0px;"><span style="color: #557799;"><!DOCTYPE html></span>
<span style="color: #888888;"><!--</span>
<span style="color: #888888;">To change this license header, choose License Headers in Project Properties.</span>
<span style="color: #888888;">To change this template file, choose Tools | Templates</span>
<span style="color: #888888;">and open the template in the editor.</span>
<span style="color: #888888;">--></span>
<span style="color: #007700;"><html></span>
<span style="color: #007700;"><head></span>
<span style="color: #007700;"><title></span>Phoenix Thanks for Your Message<span style="color: #007700;"></title></span>
<span style="color: #007700;"><meta</span> <span style="color: #0000cc;">charset=</span><span style="background-color: #fff0f0;">"UTF-8"</span> <span style="color: #007700;">></span>
<span style="color: #007700;"><meta</span> <span style="color: #0000cc;">name=</span><span style="background-color: #fff0f0;">"viewport"</span> <span style="color: #0000cc;">content=</span><span style="background-color: #fff0f0;">"width=device-width"</span> <span style="color: #007700;">></span>
<span style="color: #007700;"><style></span>
<span style="color: #0066bb; font-weight: bold;">#phonix-wrapper</span> {
<span style="color: #008800; font-weight: bold;">margin</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">20px</span> <span style="color: #008800; font-weight: bold;">auto</span>;
<span style="color: #008800; font-weight: bold;">border</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">2px</span> <span style="color: #008800; font-weight: bold;">solid</span> <span style="color: #6600ee; font-weight: bold;">#ccc</span>;
<span style="color: #008800; font-weight: bold;">border</span><span style="color: #333333;">-</span>radius<span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">10px</span>;
<span style="color: #008800; font-weight: bold;">padding</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">20px</span> <span style="color: #6600ee; font-weight: bold;">50px</span> <span style="color: #6600ee; font-weight: bold;">20px</span> <span style="color: #6600ee; font-weight: bold;">50px</span>;
<span style="color: #008800; font-weight: bold;">background</span><span style="color: #333333;">:</span> <span style="color: #008800; font-weight: bold;">transparent</span>;
<span style="color: #008800; font-weight: bold;">width</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">600px</span>;
<span style="color: #008800; font-weight: bold;">min-height</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">500px</span>;
<span style="color: #008800; font-weight: bold;">height</span><span style="color: #333333;">:</span> <span style="color: #008800; font-weight: bold;">auto</span> <span style="color: #557799;">!important</span>;
<span style="color: #008800; font-weight: bold;">height</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">500px</span>;
}
<span style="color: #007700;"></style></span>
<span style="color: #007700;"></head></span>
<span style="color: #007700;"><body></span>
<span style="color: #007700;"><div</span> <span style="color: #0000cc;">id=</span><span style="background-color: #fff0f0;">"phonix-wrapper"</span><span style="color: #007700;">></span>
<span style="color: #007700;"><p></span>By Dysprosium<span style="color: #007700;"></p></span>
<span style="color: #007700;"><hr</span> <span style="color: #0000cc;">style=</span><span style="background-color: #fff0f0;">'margin: 1px auto 1px auto; height: 1px; color: #fefefe; width: 82%;'</span><span style="color: #007700;">/></span>
<span style="color: #007700;"><h1></span>Your message has been sent! Thanks for Your Message!<span style="color: #007700;"></h1></span>
<span style="color: #007700;"><p><a</span> <span style="color: #0000cc;">href=</span><span style="background-color: #fff0f0;">"Home.html"</span><span style="color: #007700;">></span>Back to Home Page<span style="color: #007700;"></a></p></span>
<span style="color: #007700;"></div></span>
<span style="color: #007700;"></body></span>
<span style="color: #007700;"></html></span>
</pre>
</td></tr>
</tbody></table>
</div>
<br />
Please watch if you like it <a href="http://messiahpsychoanalyst.org/Codesforus/demoThanks.php" target="_blank">by clicking here, please</a>.<br />
I finished "thanks message" page. Next I discuss "dispatch message" page.
<a href="http://codesforus.blogspot.co.uk/2013/12/making-contact-form-for-your-website-3.html" target="_blank">Please read it here</a>.<br />
Download code in Zip format <a href="http://messiahpsychoanalyst.org/Codesforus/demoThanks.zip" target="_blank">here</a>. Open code as text in browser <a href="http://messiahpsychoanalyst.org/Codesforus/demoThanks.txt" target="_blank">here</a>.<br />
<br />
Download <strong><em>this tutorial as PDF</em></strong> format <a href="http://messiahpsychoanalyst.org/Codesforus/ContactForm_2.pdf" target="_blank"><span style="color: #448888;">here</span></a> <br />
Download <strong><em>part 1 and part 2 as PDF</em></strong> format <a href="http://messiahpsychoanalyst.org/Codesforus/ContactForm1_2.pdf" target="_blank"><span style="color: #448888;">here</span></a> Peter Joneshttp://www.blogger.com/profile/03192918305428815983noreply@blogger.com0tag:blogger.com,1999:blog-667520058465774437.post-83331111950202006332013-12-04T22:29:00.001+00:002014-02-28T09:40:18.592+00:00How to Create a Contact Form for Your Website in an Easy Way : A Set of Step by Step Tutorials Using HTML5, CSS3 and PHP (1)<br />
<span style="color: red;">(For the latest PDF files Merger Software please have a look at the top of the left margin, inside the red box.) </span><br />
<h4>
How to make the contact form?</h4>
After a long time that I had not a contact form page on my website I decided to create one. I started from easy traditional HTML. Then I succeeded to make it more elaborate with a reCaptcha captcha to prevent spammers and bots to invade to and flood my site. Let me tell my steps in an easy to follow manner.
First create HTML
<br />
<!-- HTML generated using hilite.me --><br />
<div style="background: rgb(255, 255, 255); border-radius: 5px; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<table><tbody>
<tr><td><pre style="line-height: 125%; margin: 0px;"> 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15</pre>
</td><td><pre style="line-height: 125%; margin: 0px;"> <span style="color: #007700;"><div</span> <span style="color: #0000cc;">id=</span><span style="background-color: #fff0f0;">"contact-area"</span><span style="color: #007700;">></span>
<span style="color: #007700;"><form</span> <span style="color: #0000cc;">method=</span><span style="background-color: #fff0f0;">"post"</span> <span style="color: #0000cc;">action=</span><span style="background-color: #fff0f0;">""</span><span style="color: #007700;">></span>
<span style="color: #007700;"><label</span> <span style="color: #0000cc;">for=</span><span style="background-color: #fff0f0;">"Name"</span><span style="color: #007700;">></span>Name:<span style="color: #007700;"></label></span>
<span style="color: #007700;"><input</span> <span style="color: #0000cc;">type=</span><span style="background-color: #fff0f0;">"text"</span> <span style="color: #0000cc;">name=</span><span style="background-color: #fff0f0;">"Name"</span> <span style="color: #0000cc;">id=</span><span style="background-color: #fff0f0;">"Name"</span> <span style="color: #0000cc;">value=</span><span style="background-color: #fff0f0;">""</span> <span style="color: #007700;">/></span>
<span style="color: #007700;"><label</span> <span style="color: #0000cc;">for=</span><span style="background-color: #fff0f0;">"City"</span><span style="color: #007700;">></span>City:<span style="color: #007700;"></label></span>
<span style="color: #007700;"><input</span> <span style="color: #0000cc;">type=</span><span style="background-color: #fff0f0;">"text"</span> <span style="color: #0000cc;">name=</span><span style="background-color: #fff0f0;">"City"</span> <span style="color: #0000cc;">id=</span><span style="background-color: #fff0f0;">"City"</span> <span style="color: #0000cc;">value=</span><span style="background-color: #fff0f0;">""</span> <span style="color: #007700;">/></span>
<span style="color: #007700;"><label</span> <span style="color: #0000cc;">for=</span><span style="background-color: #fff0f0;">"Email"</span><span style="color: #007700;">></span>Email:<span style="color: #007700;"></label></span>
<span style="color: #007700;"><input</span> <span style="color: #0000cc;">type=</span><span style="background-color: #fff0f0;">"text"</span> <span style="color: #0000cc;">name=</span><span style="background-color: #fff0f0;">"Email"</span> <span style="color: #0000cc;">id=</span><span style="background-color: #fff0f0;">"Email"</span> <span style="color: #0000cc;">value=</span><span style="background-color: #fff0f0;">""</span> <span style="color: #007700;">/></span>
<span style="color: #007700;"><label</span> <span style="color: #0000cc;">for=</span><span style="background-color: #fff0f0;">"Subject"</span><span style="color: #007700;">></span>Subject:<span style="color: #007700;"></label></span>
<span style="color: #007700;"><input</span> <span style="color: #0000cc;">type=</span><span style="background-color: #fff0f0;">"text"</span> <span style="color: #0000cc;">name=</span><span style="background-color: #fff0f0;">"Subject"</span> <span style="color: #0000cc;">id=</span><span style="background-color: #fff0f0;">"Subject"</span> <span style="color: #0000cc;">value=</span><span style="background-color: #fff0f0;">""</span> <span style="color: #007700;">/></span>
<span style="color: #007700;"><label</span> <span style="color: #0000cc;">for=</span><span style="background-color: #fff0f0;">"Message"</span><span style="color: #007700;">></span>Message:<span style="color: #007700;"></label></span>
<span style="color: #007700;"><textarea</span> <span style="color: #0000cc;">name=</span><span style="background-color: #fff0f0;">"Message"</span> <span style="color: #0000cc;">rows=</span><span style="background-color: #fff0f0;">"20"</span> <span style="color: #0000cc;">cols=</span><span style="background-color: #fff0f0;">"20"</span> <span style="color: #0000cc;">id=</span><span style="background-color: #fff0f0;">"Message"</span><span style="color: #007700;">></textarea></span>
<span style="color: #007700;"><input</span> <span style="color: #0000cc;">type=</span><span style="background-color: #fff0f0;">"submit"</span> <span style="color: #0000cc;">name=</span><span style="background-color: #fff0f0;">"submit"</span> <span style="color: #0000cc;">value=</span><span style="background-color: #fff0f0;">"Submit"</span> <span style="color: #0000cc;">class=</span><span style="background-color: #fff0f0;">"submit-button"</span> <span style="color: #007700;">/></span>
<span style="color: #007700;"></form></span>
<span style="color: #007700;"></div></span>
</pre>
</td></tr>
</tbody></table>
</div>
<br />
Now I create style for each HTML tag.
<br />
<!-- HTML generated using hilite.me --><br />
<div style="background: rgb(255, 255, 255); border-radius: 10px; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<table><tbody>
<tr><td><pre style="line-height: 125%; margin: 0px;"> 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53</pre>
</td><td><pre style="line-height: 125%; margin: 0px;"> <span style="color: #333333;"><</span><span style="color: #007700;">style</span><span style="color: #333333;">></span>
<span style="color: #0066bb; font-weight: bold;">#contact-area</span> {
<span style="color: #008800; font-weight: bold;">width</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">600px</span>;
<span style="color: #008800; font-weight: bold;">margin-top</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">25px</span>;
}
<span style="color: #0066bb; font-weight: bold;">#contact-area</span> <span style="color: #007700;">label</span> {
<span style="color: #008800; font-weight: bold;">float</span><span style="color: #333333;">:</span> <span style="color: #008800; font-weight: bold;">left</span>;
<span style="color: #008800; font-weight: bold;">margin-right</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">15px</span>;
<span style="color: #008800; font-weight: bold;">padding-top</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">5px</span>;
<span style="color: #008800; font-weight: bold;">width</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">100px</span>;
<span style="color: #008800; font-weight: bold;">text-align</span><span style="color: #333333;">:</span> <span style="color: #008800; font-weight: bold;">right</span>;
<span style="color: #008800; font-weight: bold;">font-size</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">100</span><span style="color: #333333;">%</span>;
}
<span style="color: #0066bb; font-weight: bold;">#contact-area</span> <span style="color: #007700;">input</span><span style="color: #333333;">,</span> <span style="color: #0066bb; font-weight: bold;">#contact-area</span> <span style="color: #007700;">textarea</span> {
<span style="color: #008800; font-weight: bold;">margin</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">0px</span> <span style="color: #6600ee; font-weight: bold;">0px</span> <span style="color: #6600ee; font-weight: bold;">10px</span> <span style="color: #6600ee; font-weight: bold;">0px</span>;
<span style="color: #008800; font-weight: bold;">border</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">2px</span> <span style="color: #008800; font-weight: bold;">solid</span> <span style="color: #6600ee; font-weight: bold;">#ccc</span>;
<span style="color: #008800; font-weight: bold;">border-top</span><span style="color: #333333;">-</span><span style="color: #008800; font-weight: bold;">left</span><span style="color: #333333;">-</span>radius<span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">5px</span>;
<span style="color: #008800; font-weight: bold;">border-top</span><span style="color: #333333;">-</span><span style="color: #008800; font-weight: bold;">right</span><span style="color: #333333;">-</span>radius<span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">5px</span>;
<span style="color: #008800; font-weight: bold;">border-bottom</span><span style="color: #333333;">-</span><span style="color: #008800; font-weight: bold;">left</span><span style="color: #333333;">-</span>radius<span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">5px</span>;
<span style="color: #008800; font-weight: bold;">border-bottom</span><span style="color: #333333;">-</span><span style="color: #008800; font-weight: bold;">right</span><span style="color: #333333;">-</span>radius<span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">5px</span>;
<span style="color: #008800; font-weight: bold;">padding</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">5px</span>;
<span style="color: #008800; font-weight: bold;">width</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">471px</span>;
<span style="color: #008800; font-weight: bold;">font-family</span><span style="color: #333333;">:</span> Helvetica<span style="color: #333333;">,</span> <span style="color: #008800; font-weight: bold;">sans-serif</span>;
<span style="color: #008800; font-weight: bold;">font-size</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">110</span><span style="color: #333333;">%</span>;
}
<span style="color: #0066bb; font-weight: bold;">#contact-area</span> <span style="color: #007700;">textarea</span> {
<span style="color: #008800; font-weight: bold;">height</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">90px</span>;
}
<span style="color: #0066bb; font-weight: bold;">#contact-area</span> <span style="color: #007700;">textarea</span><span style="color: #555555; font-weight: bold;">:focus</span><span style="color: #333333;">,</span> <span style="color: #0066bb; font-weight: bold;">#contact-area</span> <span style="color: #007700;">input</span><span style="color: #555555; font-weight: bold;">:focus</span> {
<span style="color: #008800; font-weight: bold;">border</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">2px</span> <span style="color: #008800; font-weight: bold;">solid</span> <span style="color: #6600ee; font-weight: bold;">#900</span>;
}
<span style="color: #0066bb; font-weight: bold;">#contact-area</span> <span style="color: #007700;">input</span><span style="color: #bb0066; font-weight: bold;">.submit-button</span> {
<span style="color: #008800; font-weight: bold;">float</span><span style="color: #333333;">:</span> <span style="color: #008800; font-weight: bold;">left</span>;
<span style="color: #008800; font-weight: bold;">cursor</span><span style="color: #333333;">:</span> <span style="color: #008800; font-weight: bold;">pointer</span>;
<span style="color: #008800; font-weight: bold;">margin-top</span><span style="color: #333333;">:</span><span style="color: #6600ee; font-weight: bold;">10px</span>;
<span style="color: #008800; font-weight: bold;">margin-left</span><span style="color: #333333;">:</span><span style="color: #6600ee; font-weight: bold;">112px</span>;
<span style="color: #008800; font-weight: bold;">background</span><span style="color: #333333;">:</span> <span style="color: #008800; font-weight: bold;">transparent</span>;
<span style="color: #008800; font-weight: bold;">width</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">100px</span>;
<span style="color: #008800; font-weight: bold;">font-size</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">100</span><span style="color: #333333;">%</span>;
<span style="color: #008800; font-weight: bold;">color</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">#024d8e</span>
}
<span style="color: #0066bb; font-weight: bold;">#contact-area</span> <span style="color: #007700;">input</span><span style="color: #333333;">[</span><span style="color: #007700;">type</span><span style="color: #333333;">=</span><span style="background-color: #fff0f0;">"submit"</span><span style="color: #333333;">]</span><span style="color: #555555; font-weight: bold;">:hover</span>{
<span style="color: #008800; font-weight: bold;">border</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">2px</span> <span style="color: #008800; font-weight: bold;">solid</span> <span style="color: #6600ee; font-weight: bold;">#900</span>;
}
<span style="color: #333333;"></</span><span style="color: #007700;">style</span><span style="color: #333333;">></span>
</pre>
</td></tr>
</tbody></table>
</div>
<br />
I put this style in the head part of the HTML. There are three way to apply CSS style fow HTML. <br />
<ul>
<li>in-line.</li>
<li>in the head part.</li>
<li>and as a separate style sheet which is saved as a css file.
</li>
</ul>
in a later post i'll describe them. Most of people are familiar with those concepts. Let me focus on my "Contact Page" now. <br />
I have an overall design for my website and I insert the above <em><strong>HTML</strong></em> inside that architecture. Simply, I do not leave the above HTML in a page. I wrap it inside a wrapper to position it correctly, as if you position an image inside a known and well defined place in your web-pages. Computer people use the jargon wrapper for that bounding. It is just an HTML div tag. I give an example for such a wrapper.<br />
<br />
<!-- HTML generated using hilite.me --><br />
<div style="background: rgb(255, 255, 255); border-radius: 5px; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<table><tbody>
<tr><td><pre style="line-height: 125%; margin: 0px;"> 1
2
3
4
5
6
7
8
9
10</pre>
</td><td><pre style="line-height: 125%; margin: 0px;"> <span style="color: #0066bb; font-weight: bold;">#contact-wrapper</span> {
<span style="color: #008800; font-weight: bold;">margin</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">20px</span> <span style="color: #008800; font-weight: bold;">auto</span>;
<span style="color: #008800; font-weight: bold;">border</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">2px</span> <span style="color: #008800; font-weight: bold;">solid</span> <span style="color: #6600ee; font-weight: bold;">#ccc</span>;
<span style="color: #008800; font-weight: bold;">padding</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">20px</span> <span style="color: #6600ee; font-weight: bold;">50px</span> <span style="color: #6600ee; font-weight: bold;">20px</span> <span style="color: #6600ee; font-weight: bold;">50px</span>;
<span style="color: #008800; font-weight: bold;">background</span><span style="color: #333333;">:</span> <span style="color: #008800; font-weight: bold;">transparent</span>;
<span style="color: #008800; font-weight: bold;">width</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">600px</span>;
<span style="color: #008800; font-weight: bold;">min-height</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">500px</span>;
<span style="color: #008800; font-weight: bold;">height</span><span style="color: #333333;">:</span> <span style="color: #008800; font-weight: bold;">auto</span> <span style="color: #557799;">!important</span>;
<span style="color: #008800; font-weight: bold;">height</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">500px</span>;
}
</pre>
</td></tr>
</tbody></table>
</div>
<br />
My wrapper is not this one but you can test and modify the above and if you liked use it, by all means. Put all of these in an HTML and then you have your contact form. I put a border for it to be recognised from other things in the page. Here is assembly of things.<br />
<!-- HTML generated using hilite.me --><br />
<div style="background: rgb(255, 255, 255); border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<table><tbody>
<tr><td><pre style="line-height: 125%; margin: 0px;"> 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97</pre>
</td><td><pre style="line-height: 125%; margin: 0px;"><span style="color: #557799;"><!DOCTYPE html></span>
<span style="color: #888888;"><!--</span>
<span style="color: #888888;">To change this license header, choose License Headers in Project Properties.</span>
<span style="color: #888888;">To change this template file, choose Tools | Templates</span>
<span style="color: #888888;">and open the template in the editor.</span>
<span style="color: #888888;">--></span>
<span style="color: #007700;"><html></span>
<span style="color: #007700;"><head></span>
<span style="color: #007700;"><title></span> Dysprosium Contact Form<span style="color: #007700;"></title></span>
<span style="color: #007700;"><meta</span> <span style="color: #0000cc;">charset=</span><span style="background-color: #fff0f0;">"UTF-8"</span><span style="color: #007700;">></span>
<span style="color: #007700;"><meta</span> <span style="color: #0000cc;">name=</span><span style="background-color: #fff0f0;">"viewport"</span> <span style="color: #0000cc;">content=</span><span style="background-color: #fff0f0;">"width=device-width"</span><span style="color: #007700;">></span>
<span style="color: #007700;"><style></span>
<span style="color: #0066bb; font-weight: bold;">#contact-wrapper</span> {
<span style="color: #008800; font-weight: bold;">margin</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">20px</span> <span style="color: #008800; font-weight: bold;">auto</span>;
<span style="color: #008800; font-weight: bold;">border</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">2px</span> <span style="color: #008800; font-weight: bold;">solid</span> <span style="color: #6600ee; font-weight: bold;">#ccc</span>;
<span style="color: #008800; font-weight: bold;">border</span><span style="color: #333333;">-</span>radius<span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">7px</span>;
<span style="color: #008800; font-weight: bold;">padding</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">20px</span> <span style="color: #6600ee; font-weight: bold;">50px</span> <span style="color: #6600ee; font-weight: bold;">20px</span> <span style="color: #6600ee; font-weight: bold;">50px</span>;
<span style="color: #008800; font-weight: bold;">background</span><span style="color: #333333;">:</span> <span style="color: #008800; font-weight: bold;">transparent</span>;
<span style="color: #008800; font-weight: bold;">width</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">600px</span>;
<span style="color: #008800; font-weight: bold;">min-height</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">500px</span>;
<span style="color: #008800; font-weight: bold;">height</span><span style="color: #333333;">:</span> <span style="color: #008800; font-weight: bold;">auto</span> <span style="color: #557799;">!important</span>;
<span style="color: #008800; font-weight: bold;">height</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">500px</span>;
}
<span style="color: #0066bb; font-weight: bold;">#contact-area</span> {
<span style="color: #008800; font-weight: bold;">width</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">600px</span>;
<span style="color: #008800; font-weight: bold;">margin-top</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">25px</span>;
}
<span style="color: #0066bb; font-weight: bold;">#contact-area</span> <span style="color: #007700;">label</span> {
<span style="color: #008800; font-weight: bold;">float</span><span style="color: #333333;">:</span> <span style="color: #008800; font-weight: bold;">left</span>;
<span style="color: #008800; font-weight: bold;">margin-right</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">15px</span>;
<span style="color: #008800; font-weight: bold;">padding-top</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">5px</span>;
<span style="color: #008800; font-weight: bold;">width</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">100px</span>;
<span style="color: #008800; font-weight: bold;">text-align</span><span style="color: #333333;">:</span> <span style="color: #008800; font-weight: bold;">right</span>;
<span style="color: #008800; font-weight: bold;">font-size</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">100</span><span style="color: #333333;">%</span>;
}
<span style="color: #0066bb; font-weight: bold;">#contact-area</span> <span style="color: #007700;">input</span><span style="color: #333333;">,</span> <span style="color: #0066bb; font-weight: bold;">#contact-area</span> <span style="color: #007700;">textarea</span> {
<span style="color: #008800; font-weight: bold;">margin</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">0px</span> <span style="color: #6600ee; font-weight: bold;">0px</span> <span style="color: #6600ee; font-weight: bold;">10px</span> <span style="color: #6600ee; font-weight: bold;">0px</span>;
<span style="color: #008800; font-weight: bold;">border</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">2px</span> <span style="color: #008800; font-weight: bold;">solid</span> <span style="color: #6600ee; font-weight: bold;">#ccc</span>;
<span style="color: #008800; font-weight: bold;">border-top</span><span style="color: #333333;">-</span><span style="color: #008800; font-weight: bold;">left</span><span style="color: #333333;">-</span>radius<span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">5px</span>;
<span style="color: #008800; font-weight: bold;">border-top</span><span style="color: #333333;">-</span><span style="color: #008800; font-weight: bold;">right</span><span style="color: #333333;">-</span>radius<span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">5px</span>;
<span style="color: #008800; font-weight: bold;">border-bottom</span><span style="color: #333333;">-</span><span style="color: #008800; font-weight: bold;">left</span><span style="color: #333333;">-</span>radius<span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">5px</span>;
<span style="color: #008800; font-weight: bold;">border-bottom</span><span style="color: #333333;">-</span><span style="color: #008800; font-weight: bold;">right</span><span style="color: #333333;">-</span>radius<span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">5px</span>;
<span style="color: #008800; font-weight: bold;">padding</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">5px</span>;
<span style="color: #008800; font-weight: bold;">width</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">471px</span>;
<span style="color: #008800; font-weight: bold;">font-family</span><span style="color: #333333;">:</span> Helvetica<span style="color: #333333;">,</span> <span style="color: #008800; font-weight: bold;">sans-serif</span>;
<span style="color: #008800; font-weight: bold;">font-size</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">110</span><span style="color: #333333;">%</span>;
}
<span style="color: #0066bb; font-weight: bold;">#contact-area</span> <span style="color: #007700;">textarea</span> {
<span style="color: #008800; font-weight: bold;">height</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">90px</span>;
}
<span style="color: #0066bb; font-weight: bold;">#contact-area</span> <span style="color: #007700;">textarea</span><span style="color: #555555; font-weight: bold;">:focus</span><span style="color: #333333;">,</span> <span style="color: #0066bb; font-weight: bold;">#contact-area</span> <span style="color: #007700;">input</span><span style="color: #555555; font-weight: bold;">:focus</span> {
<span style="color: #008800; font-weight: bold;">border</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">2px</span> <span style="color: #008800; font-weight: bold;">solid</span> <span style="color: #6600ee; font-weight: bold;">#900</span>;
}
<span style="color: #0066bb; font-weight: bold;">#contact-area</span> <span style="color: #007700;">input</span><span style="color: #bb0066; font-weight: bold;">.submit-button</span> {
<span style="color: #008800; font-weight: bold;">float</span><span style="color: #333333;">:</span> <span style="color: #008800; font-weight: bold;">left</span>;
<span style="color: #008800; font-weight: bold;">cursor</span><span style="color: #333333;">:</span> <span style="color: #008800; font-weight: bold;">pointer</span>;
<span style="color: #008800; font-weight: bold;">margin-top</span><span style="color: #333333;">:</span><span style="color: #6600ee; font-weight: bold;">10px</span>;
<span style="color: #008800; font-weight: bold;">margin-left</span><span style="color: #333333;">:</span><span style="color: #6600ee; font-weight: bold;">112px</span>;
<span style="color: #008800; font-weight: bold;">background</span><span style="color: #333333;">:</span> <span style="color: #008800; font-weight: bold;">transparent</span>;
<span style="color: #008800; font-weight: bold;">width</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">100px</span>;
<span style="color: #008800; font-weight: bold;">font-size</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">100</span><span style="color: #333333;">%</span>;
<span style="color: #008800; font-weight: bold;">color</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">#024d8e</span>
}
<span style="color: #0066bb; font-weight: bold;">#contact-area</span> <span style="color: #007700;">input</span><span style="color: #333333;">[</span><span style="color: #007700;">type</span><span style="color: #333333;">=</span><span style="background-color: #fff0f0;">"submit"</span><span style="color: #333333;">]</span><span style="color: #555555; font-weight: bold;">:hover</span>{
<span style="color: #008800; font-weight: bold;">border</span><span style="color: #333333;">:</span> <span style="color: #6600ee; font-weight: bold;">2px</span> <span style="color: #008800; font-weight: bold;">solid</span> <span style="color: #6600ee; font-weight: bold;">#900</span>;
}
<span style="color: #007700;"></style></span>
<span style="color: #007700;"></head></span>
<span style="color: #007700;"><body></span>
<span style="color: #007700;"><div</span> <span style="color: #0000cc;">id=</span><span style="background-color: #fff0f0;">"contact-wrapper"</span><span style="color: #007700;">></span>
<span style="color: #007700;"><div</span> <span style="color: #0000cc;">id=</span><span style="background-color: #fff0f0;">"contact-area"</span><span style="color: #007700;">></span>
<span style="color: #007700;"><form</span> <span style="color: #0000cc;">method=</span><span style="background-color: #fff0f0;">"post"</span> <span style="color: #0000cc;">action=</span><span style="background-color: #fff0f0;">""</span><span style="color: #007700;">></span>
<span style="color: #007700;"><label</span> <span style="color: #0000cc;">for=</span><span style="background-color: #fff0f0;">"Name"</span><span style="color: #007700;">></span>Name:<span style="color: #007700;"></label></span>
<span style="color: #007700;"><input</span> <span style="color: #0000cc;">type=</span><span style="background-color: #fff0f0;">"text"</span> <span style="color: #0000cc;">name=</span><span style="background-color: #fff0f0;">"Name"</span> <span style="color: #0000cc;">id=</span><span style="background-color: #fff0f0;">"Name"</span> <span style="color: #0000cc;">value=</span><span style="background-color: #fff0f0;">""</span> <span style="color: #007700;">/></span>
<span style="color: #007700;"><label</span> <span style="color: #0000cc;">for=</span><span style="background-color: #fff0f0;">"City"</span><span style="color: #007700;">></span>City:<span style="color: #007700;"></label></span>
<span style="color: #007700;"><input</span> <span style="color: #0000cc;">type=</span><span style="background-color: #fff0f0;">"text"</span> <span style="color: #0000cc;">name=</span><span style="background-color: #fff0f0;">"City"</span> <span style="color: #0000cc;">id=</span><span style="background-color: #fff0f0;">"City"</span> <span style="color: #0000cc;">value=</span><span style="background-color: #fff0f0;">""</span> <span style="color: #007700;">/></span>
<span style="color: #007700;"><label</span> <span style="color: #0000cc;">for=</span><span style="background-color: #fff0f0;">"Email"</span><span style="color: #007700;">></span>Email:<span style="color: #007700;"></label></span>
<span style="color: #007700;"><input</span> <span style="color: #0000cc;">type=</span><span style="background-color: #fff0f0;">"text"</span> <span style="color: #0000cc;">name=</span><span style="background-color: #fff0f0;">"Email"</span> <span style="color: #0000cc;">id=</span><span style="background-color: #fff0f0;">"City"</span> <span style="color: #0000cc;">value=</span><span style="background-color: #fff0f0;">""</span> <span style="color: #007700;">/></span>
<span style="color: #007700;"><label</span> <span style="color: #0000cc;">for=</span><span style="background-color: #fff0f0;">"Subject"</span><span style="color: #007700;">></span>Subject:<span style="color: #007700;"></label></span>
<span style="color: #007700;"><input</span> <span style="color: #0000cc;">type=</span><span style="background-color: #fff0f0;">"text"</span> <span style="color: #0000cc;">name=</span><span style="background-color: #fff0f0;">"Subject"</span> <span style="color: #0000cc;">id=</span><span style="background-color: #fff0f0;">"Subject"</span> <span style="color: #0000cc;">value=</span><span style="background-color: #fff0f0;">""</span> <span style="color: #007700;">/></span>
<span style="color: #007700;"><label</span> <span style="color: #0000cc;">for=</span><span style="background-color: #fff0f0;">"Message"</span><span style="color: #007700;">></span>Message:<span style="color: #007700;"></label></span>
<span style="color: #007700;"><textarea</span> <span style="color: #0000cc;">name=</span><span style="background-color: #fff0f0;">"Message"</span> <span style="color: #0000cc;">rows=</span><span style="background-color: #fff0f0;">"20"</span> <span style="color: #0000cc;">cols=</span><span style="background-color: #fff0f0;">"20"</span> <span style="color: #0000cc;">id=</span><span style="background-color: #fff0f0;">"Message"</span><span style="color: #007700;">></textarea></span>
<span style="color: #007700;"><input</span> <span style="color: #0000cc;">type=</span><span style="background-color: #fff0f0;">"submit"</span> <span style="color: #0000cc;">name=</span><span style="background-color: #fff0f0;">"submit"</span> <span style="color: #0000cc;">value=</span><span style="background-color: #fff0f0;">"Submit"</span> <span style="color: #0000cc;">class=</span><span style="background-color: #fff0f0;">"submit-button"</span> <span style="color: #007700;">/></span>
<span style="color: #007700;"></form></span>
<span style="color: #007700;"></div></span>
<span style="color: #007700;"></div></span>
<span style="color: #007700;"></body></span>
<span style="color: #007700;"></html></span>
</pre>
</td></tr>
</tbody></table>
</div>
<br />
Here is the image of resulting page. If you like you can see it <a href="http://messiahpsychoanalyst.org/Codesforus/demoMain.php" target="_blank">by clicking here, please</a>.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjaOE8GhsL7S3jdv7UAqS6oJMd_mj7o3dcIM1cepJ7O1t0bnFbNOlu42irC_3P2aiMxWcee7lrk_V0yUdLYCDM5iCpCai4vl27YMnLkgfqCUm9Wc3DpDjotMUcNvz-Cu1UzwgvzjKIBt-s/s1600/CfusContact.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjaOE8GhsL7S3jdv7UAqS6oJMd_mj7o3dcIM1cepJ7O1t0bnFbNOlu42irC_3P2aiMxWcee7lrk_V0yUdLYCDM5iCpCai4vl27YMnLkgfqCUm9Wc3DpDjotMUcNvz-Cu1UzwgvzjKIBt-s/s1600/CfusContact.PNG" height="313" width="400" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
This is a well designed form and has the advantages of <br />
<ul>
<li>a knit wrapping boundary,</li>
<li>when you click on any field its boundary changes to red,</li>
<li>when mouse enters the bounds of the "Submit" button its boundary changes its colour,</li>
<li>having a pointer (small hand) when you move the mouse over the "Submit" button to show it clickable,</li>
<li>all corners are rounded to give a smoother impression.</li>
</ul>
It shows how you can design a button. <br />
But this still does not post messages back to you. It is not functioning, yet. I'll show how to do it in the next blog post. Snippets have made this one very long. <a href="http://codesforus.blogspot.co.uk/2013/12/making-contact-form-for-your-website-2.html" target="_blank">Next post is here; please click</a>.<br />
Download <strong><em>PHP</em></strong> code in Zip format <a href="http://messiahpsychoanalyst.org/Codesforus/demoMain.zip" target="_blank">here</a> or open the code in text format <a href="http://messiahpsychoanalyst.org/Codesforus/demoMain.txt" target="_blank">here</a>.<br />
<br />
Download <strong><em>this tutorial as PDF</em></strong> format <a href="http://messiahpsychoanalyst.org/Codesforus/ContactForm_1.pdf" target="_blank"><span style="color: #448888;">here</span></a> Peter Joneshttp://www.blogger.com/profile/03192918305428815983noreply@blogger.com0tag:blogger.com,1999:blog-667520058465774437.post-53097430735920977252012-12-22T16:45:00.002+00:002015-10-15T10:20:09.007+01:00Web Hosting at Your Home (Revisited)<span style="color: red;">(For the latest PDF files Merger Software please have a look at the top of the left margin, inside the red box.) </span>From the time that I wrote the post on this topics, many things has changed. Now, I revise the material.<br />
<br />
First, you need a dedicated computer to install and run your webserver on that. I used to use an old laptop; it was older than ten years. Regretfully it made a lot of noise during the night cooling the CPU. CPU was 2 GHz, but with small CPU cache it was killing slow. It still had some customers to earn some cash, so went on auction site and "bid" farewell. As I have a very cheap and high quality paid hosting, I didn't bother to replace the home web hosting laptop. I put the home hosting on my computer, hence when I hibernate the computer or shut it down it is not visible anymore.<br />
<ul>
<li>Therefore, if you want to use an old laptop as a server consider how far it is still useful. You frequently have to work with it and if it is too slow, it can make you impatient. It is difficult to upgrade its CPU and impossible to improve its cooling mechanism. It also consume some electricity and it creates some noise.</li>
<li>If you decide to use an old desktop (tower) computer, you easily can upgrade it to a more powerful one. You also can get almost good computers with very low prices on auction sites. They consume more electricity and for tuning you need to connect keyboard, mouse and screen to them. Their noise also might be too much.</li>
<li>Considering expenses all together a web hosting at home might not be profitable comparing to a purchased web hosting mostly under $40, $50 a year. But it is rewarding in terms of having a hobby. If you have a small business and hoping to develop it or it is growing it is a good practice to keep your IT operation under your control and within the horizon of your understanding; then web hosting at home could be a good exercise to that ends. </li>
<li>Call the computer of your home web-hosting your "<strong><em>web server</em></strong>" after this.</li>
</ul>
Second, download and install Apache HTTP (web) server to your home web server. To do that<br />
<ul>
<li>Create a folder in the root directory of your web server as C:/Apache Software Foundation<strong>/</strong>Apachex.x where x.x stands for the version of downloaded software. Mine is Apache2.2. </li>
<li>Install Apache server and during the installation instruct Apache to be installed in that C:/Apache Software Foundation<strong>/</strong>Apachex.x folder.</li>
<li>Fill in the installation form of Apache. You can fill its field with anything that looks like a website name and email. Later you can correct them in conf/httpd.conf file.</li>
<li>Open htdocs folder inside Apache2.2 and double click on index.html if it opens and shows "It Works!" then you have been successful so far.</li>
<li>If succeeded change name of index.html to indexold.html.</li>
</ul>
Now it is time to bring your website into your home web hosting.<br />
<ul>
<li>From wherever you have saved your website copy all the files and folders and paste them inside the htdocs folder of your Apache.</li>
<li>You have a front or home page. It could be home.html, index.html, or default.html. Extensions could be html or aspx or other accepted extensions. Make a copy of that and change its name to index.html. Having done this you do not need to tweak with conf/httpd.conf file for now; until later that you become an advanced user.</li>
</ul>
Log into your router, normally by typing 192.168.0.1 (or in some routers 192.168.1.1) in your browser.<br />
<ul>
<li>Find the IP address of the web hosting server computer of yours from the "Connected Devices" section. It should be something like 192.168.0.7</li>
</ul>
While still logged in the router note that in all routers there is an "Advanced Settings" and inside that a section for "Security" settings. Among the "Security" settings you'll find a "Port Forwarding" area. Enter in "Port Forwarding."<br />
<ul>
<li>Select HTTP for name of the "Service."</li>
<li>Select TCP for "Protocol."</li>
<li>Enter IP of your web server computer into the IP field (192.168.0.7).</li>
</ul>
If you are in Windows XP this is fine enough. If you are in Vista/ Windows 7 or Windows 8, you need to instruct the Windows to make an exception in the Firewall to allow inbound traffics for your web server.<br />
<ul>
<li>Open "Control Panel" and then open "System and Security."</li>
<li>Click on Windows Firewall to open its dialogue.</li>
<li>On the left side list find "Advanced Setting" and click on it. </li>
<li>A "Windows Firewall with Advanced Security" dialogue will open.</li>
<li>On the left side list click on "inbound rules."</li>
<li>Now on the right side list click at the top on the "new rule."</li>
<li>Among the selection radio buttons click on "Port" and the next.</li>
<li>In the next dialogue click on "TCP" radio button and then specify on the "Specific Local Ports" by typing value 80 in the field and then next.</li>
<li>In the next dialogue leave "Allow Connection" as it is selected by default. Click next.</li>
<li>Well your web serving computer is in your home. Hence in the next dialogue you need to select "Private" network by ticking the box. Click on next.</li>
<li>In the next dialogue select a "Name" for your rule such as "My Apache Web Hosting." Click "Finish" and you are done.</li>
</ul>
After setting up the new "Firewall Rule" type <a href="http://localhost/">http://localhost/</a> in your browser. That should bring your home page. Look at your browser it is just <a href="http://localhost/">http://localhost/</a> with no index.html or anything after that. This is a good lesson for later tunings. Now click on your "Home" link (you have that link somewhere in your front page), then browser changes to <a href="http://localhost/home.html">http://localhost/home.html</a> or <a href="http://localhost/default.aspx">http://localhost/default.aspx</a> or whatever file you have as your home page. I decided to have mine as default.html since I found it more comfortable to work. I have three similar copies of my home page as index.html, default.html and home.html inside the htdocs folder of my Apache.<br />
<br />
You have your web server hosting at home up and running. <br />
<ul>
<li>Get your main internet service IP from your router or by typing "my ip" in your favourite search engine. It should be something like 87.321.46.18 (this is not a real IP as one of the numbers is greater than 255 which is impossible).</li>
<li>Ask a friend to type that IP in their browser. Check if your web hosting is visible for them.</li>
</ul>
Hopefully you have done all you need at home for your web hosting. It is disappointing that it is visible only for your acquaintances. Next make it visible for the world.<br />
<ul>
<li>One solution is to get a free subdomain from numerous provider. They do it in a hope that one day you are going to get one of their paid services. Once they get enough clients, gradually they kick out free nerds with excuses. One I am using is DNSdynamic. They provide you with a free client to be installed on your computer. You do not need this client in principle. I'll explain for you in a minute. Sign up to their site and select a name for your site, say homelyhost, then your address will be, say, homelyhost.dnsd.info. There are other options besides dnsd.info. Mine is messiah.dnsd.info. These types of names does not look much exciting.</li>
<li>While logged in the DNSdynamic website, or wherever, use their provided instructions and point the name (say, homelyhost.dnsd.info) to your IP (87.321.46.18).</li>
<li>Log out and test the name in your browser. Sometimes it take 24 hours that things become sorted out throughout the worldwide network of Internet.</li>
</ul>
Reason for installing the client is that normally people have dynamic IP which is subject to unnoticed arbitrary change by their Internet Service Provider (ISP). You do not need the client as much since due to technical issues IP addresses will be kept static and without change for a long time and years if you do not move from your present address or you do not change the Service Provider. <br />
<ul>
<li>You can check your IP every now and then, perhaps on a daily basis, and if it had been changed log into your member page at DNSdynamic site and point the name to new IP.</li>
<li>Alternatively you can buy a static IP.</li>
</ul>
(Update 26/April/2014: As explained here and I expected DynDns that I already had, has informed me that they can't continue providing free services anymore. Their offered prices are so unreasonable as if they are living in another planet. I moved to DNSdynamic.org, and edited this blog post, accordingly. They look very innocent now.)<br />
You might like to buy a name for your web site that you are hosting at home. You have not much options now a days for selecting cool and conspicuous names. They are already gone or big companies have bought them, in speculation, to sell them to wealthy people, celebrities and companies who need such names. Even misspelled names are sold already for famous brands. If you type in browser say foerd.com you might get to ford.com, for instance. They also may use it for "parking" sites. If you browse by misspelling ford as foerd you reach to a site that has parked advertisements for car selling/repair/used-car companies and during the year might bring few hundred dollars for its owner.<br />
If you need very ordinary name, especially long names, these names are sold on a yearly subscription basis and are not expensive. They are from $5 to maximum $25 per year. I bought a dysprosiumsoft.com for $8 a year.<br />
I pointed it to my webhosting at my home, but how. Sites such as DynDns asks paid subscription to provide such a pointing service which is called DNS or Domain Name Services.<br />
<ul>
<li>You need to use a free DNS provider. </li>
<li>There are many of them out there with the same rule: when they get enough people convinced to upgrade to paid service they kick out the remaining die-hard non-paying nerds.</li>
<li>I found freedns.afraid.org more nerd oriented than others and very easy to configure (© 2001-2014 Joshua Anderson, <a href="http://freedns.afraid.org/"><span style="color: black;">Free DNS</span></a> is currently processing 4,373 DNS queries per second).</li>
<li>I signed up to their free subscription and followed their instructions to point their DNS to dysprosiumsoft.com and then dysprosiumsoft.com points to my IP. Click on <a href="http://dysprosiumsoft.com/">http://dysprosiumsoft.com</a> and if my computer is on (mostly GMT : 8 am to midnight) you will see my web hosted on my own computer. It is also the same pointed by <a href="http://messiah1.ddns.net/" target="_blank">http://messiah1.ddns.net/</a>. They both land on the same folder. I have one folder for home web hosting but I have pointed two names to it; similar to foerd.com and ford.com that points to the same site such that if people make a mistake while typing in browsers they land on the same place. I have added a small tag at the top (Home Web Hosting Demo) to be recognised from the out-sourced professionally hosted <a href="http://messiahpsychoanalyst.org/">http://messiahpsychoanalyst.org</a>. </li>
<li>Click on the W3C validation at bottom. It becomes validated similarly.</li>
</ul>
Believe it; it needs some patience.<br />
<br />
(Disclaim : names I used in this note are those I am using I have no idea regarding recommending or endorsing them. Though I am thankful to them but you might prefer using your favourite search engine finding similar services)<br />
<br />
Please also see a newer post <a href="http://codesforus.blogspot.co.uk/2015/10/web-hosting-at-your-home-php-and-port.html">Web Hosting at Your Home : PHP and Port Forwarding Conflicts</a> Peter Joneshttp://www.blogger.com/profile/03192918305428815983noreply@blogger.com0tag:blogger.com,1999:blog-667520058465774437.post-19229701179277492582011-10-31T12:26:00.038+00:002016-05-26T09:51:27.527+01:00What News About Dysprosium?<span style="color: red;">(For the latest PDF files Merger Software please have a look at the top of the left margin, inside the red box.) </span><strong>This is an obsolete content. Some updates can be find at the bottom of this post.</strong> I promised a release of Dysprosium Suite before the end of this 2011. I could not eliminate a serious hurdle on the way. I could not find a PDF viewer that seamlessly joins to Java. I mean a free viewer. There had been an excellent free Java viewer by Adobe developed ten years ago. It means it is based at best on works started before the millennium. It works still perfect if your created PDF be of the type you might create by the latest LaTeX tools (such as MiKTex) or by Adobe Professional tools. It does not even load a blank page which is not created in this way. But most of the people use everything to create PDF; such as, Google Docs, or Open Office, and many scanner to PDF software. Such cases crashes the Adobe Java viewer. Adobe for unknown reasons did not continue the development of that software, and its present free software SDK is pure C++. I worked to switch to that tool but there is a further hurdle since this SDK utilizes MFC proprietary libraries and include files. I tested every available claimed free Java PDF viewer, but actually they all have a mistake. They are not Java Swing. Adobe viewer is a pure Java Swing. It is so malleable that you can give them the "group layout;" a very Java Swingish layout. But I succeeded in pushing the limit of merge to astonishing <span style="color: red;">3.5GB</span> in 64 bits versions of Windows 7 and Windows 8, with enough RAM memory. I had 32GB installed and put 4GB of it available for Java heap. CPU was quad core and never exceeded in 10% usage for each core. FSB was 1600MHz. This is the biggest PDF file you might find. The other reason that I did not switch to C++ is the belief that I have on Java programming. It is much more natural than C++. (I am a C language fanatic, but not C++) Well, C# is somehow Java. But it is not free, for full blood development. (It was a strategic mistake, in terms of nerds commenting, that Sun pushed against usage of Java by Microsoft. Otherwise, there could be more harmony in the present sphere of development tools.) Switching to C++, or to C# will change my work as a retired person to a full time professional developer. I am going to create a separate package with Adobe Java viewer with no guarantee of being usable on loading every PDF. I am going to develop one without viewer, besides. Please have a look at the snapshot. <br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEikh3XNXq-uR2d1Nz56JBa1PDy9fq5ihXNLnx6JYptnhGCQ0g3cTSIZIRfP8xQ_sjeKa_n4xM-x6ZaTqqEqtLUcBJj6p7hB3Na507H0d50GOop6eY-BYDAw_Zq0aRLRc53CMZKdomBqO9g/s1600/Dysprosium010.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEikh3XNXq-uR2d1Nz56JBa1PDy9fq5ihXNLnx6JYptnhGCQ0g3cTSIZIRfP8xQ_sjeKa_n4xM-x6ZaTqqEqtLUcBJj6p7hB3Na507H0d50GOop6eY-BYDAw_Zq0aRLRc53CMZKdomBqO9g/s400/Dysprosium010.PNG" width="358" /></a></div>
It is a document created by the LaTeX (using MiKTeX). Book includes extreme fonts and sophisticated images. All 74 pages are loaded nicely. Yellow color has been used to create contrast for this demo. The next document is a one page document created by Open Office. Only one word is written on it. It dispatches error upon loading.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhEi5CdgswlqcREEe2f-WFLmzC5TnC_khRFMKy3kRF88-BRs-LvfltfSEqcJ6cuDJsT2MUdobMH_SJ3CzSsMI86HY-uG0U2vRwuYLkLbCPD1K7Diz0Ce6TPlZlqwjpvtr6nLft_kx9KOTo/s1600/Dysprosium011.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhEi5CdgswlqcREEe2f-WFLmzC5TnC_khRFMKy3kRF88-BRs-LvfltfSEqcJ6cuDJsT2MUdobMH_SJ3CzSsMI86HY-uG0U2vRwuYLkLbCPD1K7Diz0Ce6TPlZlqwjpvtr6nLft_kx9KOTo/s400/Dysprosium011.PNG" width="367" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
There was, another disappointment, too, in lack of much progress in breaking the password of PDF. I was interested in its mathematical side. A brute force multi threading could break a password of 5-character length created out of 64 characters in a reasonable time. Hence, we have "Remove Password" button (on condition that you have the owner's password) but not the "Unlock Password" button.</div>
<div class="separator" style="clear: both; text-align: left;">
<span style="color: red;">Update, May 2016</span> : Dysprosium (Dolce edition) has been released (<a href="http://messiahpsychoanalyst.org/Documents/Downloads.html">please click</a>) based on iText from mid of April 2014 and smoothly on a nightly basis added more features and now I have deprecated many scattered pieces of PDF utilities I already released. There are so many features that I cannot write complete instructions for all of them. From other previous pieces only Signature manager has been remained to be integrated. I sorted out PDF viewer problem somehow satisfactorily.)</div>
<div class="separator" style="clear: both; text-align: left;">
(updated : 26/May/2016) I have had over <span style="color: red;">60,000</span> downloads from <span style="color: red;">187</span> countries. All around the world, only <span style="color: red;">1</span> country in South America (French Guiana) and <span style="color: red;">1</span> countries in Asia (Democratic North Korea ) have not used Dysprosium Software, yet. The remaing countries not downloaded to this date (less than <span style="color: red;">10</span>) are from the central Africa and perhaps some very small Island countries.</div>
<div class="separator" style="clear: both; text-align: left;">
(<span style="color: red;">Deprecated Paragraph</span> : People contacted me regarding not fulfilling promises in creating an integrated software for different pieces of dysprosium in on single -and perhaps bloated- suite. My friend Grant Hardy is too busy with electronics and doesn't come around. Phoenix is also has committed himself in different web developments. I have been left alone and I am too old and feeble, but have progressed in some areas. For example, I have created a Complex Polynomial Calculator; <a href="http://www.messiahpsychoanalyst.org/Documents/Downloads.html#part8" target="_blank"><span style="color: #448888;">download here</span></a>. I postpone my promises towards end of this year. We had some joy with majority of algorithms in recovering lost owner's passwords. Well, I succeeded in a relatively fast password cracker but won't publish it. People who have lost their password might like to use other things available out there.<span style="background-color: white;"> <span style="color: red;">We fulfilled all promises</span></span><span style="color: red;"> at this date 26/May/2016.</span><span style="color: black;">)</span></div>
<div class="separator" style="clear: both; text-align: left;">
</div>
Peter Joneshttp://www.blogger.com/profile/03192918305428815983noreply@blogger.com0tag:blogger.com,1999:blog-667520058465774437.post-82254034026610628542011-08-07T17:08:00.016+01:002014-03-28T10:28:44.326+00:00How to Create a Free Web Hosting in Your Home? (2)<span style="color: red;">(For the latest PDF files Merger Software please have a look at the top of the left margin, inside the red box.) </span>Next you need to test your IP address on the Internet. <span style="color: red;">(Please also read the previous post.)</span>This is different with your private hub IP addresses. It is the unique address given by your broadband service provider to the location of your router on the entire Internet.You can get it on different places.<br />
For example, log into your router and click on "Basic Setup" you find it as<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiO8rXP9WWx5WrGgUkMBOK3LI6Zgf085knVa4Q7YbPxngNW-xpGNr1JOCHr0U7t7-vspP36K6JjtPWdioM0ToOfFfpjo2C1xpAgryLwy1dZhY8tIl466-27z7ARGNjuXCE5_oLc7o8om6k/s1600/WikiHow15.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiO8rXP9WWx5WrGgUkMBOK3LI6Zgf085knVa4Q7YbPxngNW-xpGNr1JOCHr0U7t7-vspP36K6JjtPWdioM0ToOfFfpjo2C1xpAgryLwy1dZhY8tIl466-27z7ARGNjuXCE5_oLc7o8om6k/s640/WikiHow15.PNG" height="264" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
It is something like "98.227.112.49" This number is as good and working as any important site such as www.un.org or other sites. Ask a friend to type that IP address in their browser and <em>voila</em>! He will be directed to your hand-made web site. Remember from the previous post that if your default home page is not "index.htm" you have to configure "httpd.conf" file accordingly, or type "http://98.227.112.49/home.html". You have a web hosting of your own free. This IP address is subject to arbitrary change by the provider. It is dynamic for ease of maintenance. People join to and opt out from a provider and their address will be given to others. You also may change the provider or your residential. It also cannot be remembered easily. It needs a mnemonic to help to memorise. There are companies on the Internet that provide you with a free client software for maintaining a constant connection of the Internet with your potentially changable IP through a mnemonic of your choice. These companies are called "Dynamic DNS Provider" or such. You can use your favourit search engine to find one. By client I mean the old PC that is being used for your in-the-home web hosting. It is necessary that you subscribe to such a free service. Then download and install the client software on the "client" following their simple instructions. This mnemonic is not a top level domain such as www.anexample.org. It is a subdomain such as "subexample.anexample.org" Mine is messiah.dyndns.inf. I got dyndns.inf from free DynDns' many available options. I mention their name as a gratitude to the free service. If you like to have a top domain name, then you have to buy one by paying £5 ($8) (at the time of writing this article) a year. Many of more attracting names are being used by others or are bought to be kept to sell for higher prices. After purchasing that domain name or if you already have one, then you can redirect your top domain name through that dynamic IP provider to your home made web site. dynamic IP provider tells you how you should do that. (freedns.afraid.org starts by default from a top domain name of yours. Their dynamic DNS service is also free. With £5 ($8) a year (at the time of writing this article) you buy a domain name from any seller and then redirect it through dynamic dns and nameservers of freedns.afraid.org to your home web server.) You should follow guidelines to maintain your down-time to minimum per year. It is easy to surpass in quality over an expensive web hosting if you minimise load of that web server machine. Do not use it for other purposes and do not put more than the minimum of operating system software on it. Uninstall additional software (sometimes called bloat-ware) that comes with an operating system and has not any use for your web server. It is possible to gain an old PC with an OEM Windows XP installed under £20 ($30) or sometimes drastically less than that on the eBay now a days. You can upgrade it to a 3GHz CPU, 3GB RAM. The bad thing about a desktop PC is its electricity consumption and noise that it creates. Bad thing about old laptops is that you cannot upgrade its cpu easily and old laptops normally cannot accept more than 1GB of RAM. By the end of 2012 Britain will be the first country that all its communication network will be on the Internet. There will remain no conventional telephon switching after that. Thanks to optical fiber on your door, speed of connections are not subject to trafic load and distance and is constant all around the clock. Hosting at home is the next asset that you can have besides being just consumers of the other web sites. At the end this is very pleasing job to accomplish. It is fulfilling like ham radio and DXing, when you were producer of your own equipments instead of buying them. After preliminary set up of the site, there'll be many Elmer's notebooks on the Internet that paves the way towards full professionalism. For example, click on this link, <a href="http://messiah.dyndns.info/CodesForUs.html">http://messiah.dyndns.info/CodesForUs.html</a>. You can find that I have moved part of this blog on into that web site at my home. (Thanks to <a href="http://messiahpsychoanalyst.org/Documents/Calendar.html">Grant Hardy</a> who edited this post from the US)<br />
(Update : See also this post <a href="http://codesforus.blogspot.co.uk/2012/12/web-hosting-at-your-home-revisited.html">Web Hosting at Your Home (Revisited)</a> )<br />
<div style="background-color: yellow; border-radius: 5px; border: 2px solid red; color: darkred; margin: 2px;">
<div style="margin: 10px;">
Update, 25 March 2014 : You might find these two wikis useful, too. </div>
<ul>
<li><div style="margin: 10px;">
<span dir="auto"><span dir="auto"><a href="http://www.messiahpsychoanalyst.org/wikihow/index.php?title=How_to_Create_a_Web_Host_in_Your_Home">How to Create a Web Host in Your Home</a></span></span></div>
</li>
<li><div style="margin: 10px;">
<span dir="auto"><span dir="auto"><span dir="auto"><a href="http://www.messiahpsychoanalyst.org/wikihow/index.php?title=How_to_Open_Your_Port_80_Behind_a_Firewall">How to Open Your Port 80 Behind a Firewall</a></span></span></span></div>
</li>
</ul>
<div style="margin: 10px;">
<span dir="auto">They include images and are step-by-step. </span></div>
</div>
Peter Joneshttp://www.blogger.com/profile/03192918305428815983noreply@blogger.com1tag:blogger.com,1999:blog-667520058465774437.post-30414005766803839302011-08-07T13:35:00.017+01:002012-12-24T12:47:53.316+00:00Moving from Microsoft Office Live Web Hosting (3): How to Create a Free Web Hosting in Your Home (1)?<span style="color: red;">(For the latest PDF files Merger Software please have a look at the top of the left margin, inside the red box.) </span>If you are on a broadband and have an old computer or laptop and have a taste of hobbyist tinkerers jobs, you might be eager to become your own host for your website. <span style="color: red;">(This is a continuation of two previous posts in moving from OL.)</span> That could become more powerful than a purchased hosting. You need to download the <a href="http://httpd.apache.org/download.cgi">Apache http Server</a> which is a free software (GPL compatible) for serving your website to public. Install Apache server on your old PC. Well, my platform is a Windows XP Professional SP3. I have not tested that on a Unix yet. I'll do it and update this blog. I double click on downloaded software (it is Microsoft Installer file format, .msi). After some routine procedures, this dialogue asks me for some information.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-Ep9NSRvnEGRgISxpm1-ppN67irMb0pv5kjBYfDOCnlegfCv1fv7brPJ5izRrRexUGT-2k_mZIT2xvR_7vo602hiMswZGUDH_lMEDnBSwfQD5wgxmLhEWSmuDxF2J_acBqqlShVdERaQ/s1600/Apache02.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="245" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-Ep9NSRvnEGRgISxpm1-ppN67irMb0pv5kjBYfDOCnlegfCv1fv7brPJ5izRrRexUGT-2k_mZIT2xvR_7vo602hiMswZGUDH_lMEDnBSwfQD5wgxmLhEWSmuDxF2J_acBqqlShVdERaQ/s320/Apache02.PNG" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
Information I put could be arbitrary. Later, I can configure them if I like. Next I select a custom install. <br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi8_PhCGlmszstBkS8XduzRjLfiSo0YnFgmS47mSQaf5abBIBvmkvCopHkleTlNMdZKn9f-AdRxBRS3_aSAalSYu6PBfzlrhf6J3d_Ezgfc3ShHMlDNwGCWGIhYIhoabUeHwSqnmNQTCqc/s1600/Apache03.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="246" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi8_PhCGlmszstBkS8XduzRjLfiSo0YnFgmS47mSQaf5abBIBvmkvCopHkleTlNMdZKn9f-AdRxBRS3_aSAalSYu6PBfzlrhf6J3d_Ezgfc3ShHMlDNwGCWGIhYIhoabUeHwSqnmNQTCqc/s320/Apache03.PNG" width="320" /></a></div>
<br />
I have an Apache home directory already in my computer as "C:\JavaHome\ Apache Software Foundation" inside my Java home directory. I change the default of http server to this directory, as "C:\JavaHome\ Apache Software Foundation\Apache2.2" <br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjH4490MLikmFPRMNvv8DTLl7Z2XQuyXF9__pJ9v0P-A2ch0VfVHzyWC2oCeoSe2gvrN5RfyWE5SZeXBlu8I9lA1jMTOMEEzFPyfZIcL9-vVCxsKlX5U4bbDJm7-H6zrArrs0BYrIVE0PY/s1600/Apache04.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="245" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjH4490MLikmFPRMNvv8DTLl7Z2XQuyXF9__pJ9v0P-A2ch0VfVHzyWC2oCeoSe2gvrN5RfyWE5SZeXBlu8I9lA1jMTOMEEzFPyfZIcL9-vVCxsKlX5U4bbDJm7-H6zrArrs0BYrIVE0PY/s320/Apache04.PNG" width="320" /></a></div>
<br />
Yours also could be any directory of your choice. After finishing installation, an "Apache Server Icon" appears on the quick launch tray of your desktop. Inside the Apache2.2 folder there are other folders. Please open "htdocs" folder and double click "index.html" it opens in your default browser showing "It works!" as the sign of success in correct installation of Apache http server. Next to "htdocs" you may notice the "conf" folder. Please open the directory to find the "httpd.conf" file inside it. Add a ".txt" extension to its name (i.e., httpd.conf.txt) to be able to edit the file in a notepad. (Frequently I open many of such files in NetBeans IDE). Find this line inside the document (it is line 179): <br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjRJky-rkW-zmC130-0yNOjqe-ucGs7X2bEp7krp8vsYbFU0VmNYioV5MIaJ3mY4-u6wrjBJNUWg8n2G2pwdqBiL-KZPCkQuKHvsM4mENAlfyRSY2MrKCvVx0SMqNEcqWKzZurff4a3ehw/s1600/HomeServer12.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjRJky-rkW-zmC130-0yNOjqe-ucGs7X2bEp7krp8vsYbFU0VmNYioV5MIaJ3mY4-u6wrjBJNUWg8n2G2pwdqBiL-KZPCkQuKHvsM4mENAlfyRSY2MrKCvVx0SMqNEcqWKzZurff4a3ehw/s1600/HomeServer12.PNG" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
You have to change the "DocumentRoot" to your desired directory. I have created a "C:\Web\MyWeb" directory on my old laptop. Hence, I change to:</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgKx0ABBoqfhBr44glBGC-9I_geL3jKseJvgTEvBvewIYRCDCbOuKe_VA74mKUglri7v54M8QlZUH4XxUfyCjrAkPtCUCQ_LC8ONr3TJf4w7Z-_rkb8v6wekw0cedni2Us8V6QaV7wCLqs/s1600/HomeServer03.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgKx0ABBoqfhBr44glBGC-9I_geL3jKseJvgTEvBvewIYRCDCbOuKe_VA74mKUglri7v54M8QlZUH4XxUfyCjrAkPtCUCQ_LC8ONr3TJf4w7Z-_rkb8v6wekw0cedni2Us8V6QaV7wCLqs/s1600/HomeServer03.PNG" /></a></div>
Please not I made the original one commented out by putting pound (#) in front of the line, and added my own home server directory in its place. I immediately make "C:\Web" directory shared in my Windows "WorkGroup" such that I can work on it from my desktop PC. In this way I never have to go physically to that laptop anymore. This sharing is only on your own Work Group and is nothing to do with public network. Please go further down in the Config file to get to:<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhawYkzh5QrG9W36lrSeHVqA0FHTw8htcY_b1ZyE1yyQ52hDyV9lcucHVg6sd8UHHZkucoqMijuPNwnv7-cdC67D5ZR-ZjO_ejG5wgnrX349zu48Ck7ytiaJDJvB0lMEDchcFoNQwN8uO8/s1600/HomeServer04.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhawYkzh5QrG9W36lrSeHVqA0FHTw8htcY_b1ZyE1yyQ52hDyV9lcucHVg6sd8UHHZkucoqMijuPNwnv7-cdC67D5ZR-ZjO_ejG5wgnrX349zu48Ck7ytiaJDJvB0lMEDchcFoNQwN8uO8/s1600/HomeServer04.PNG" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
Change it as to your newly created root directory of yours,<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEii-8qCoY7tA856wKXp5jTJSqooBo4zntnqO9pLzQmag6bQyHcnAjiKlUMfSDQDnvu7hhn9aTKLWk_-HsfXnQFqGTnt6lNg3TP98NxA9In5cjX-5xcEmnbdk7KpNrD0Ax_y1DdYJSbPGUI/s1600/HomeServer11.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEii-8qCoY7tA856wKXp5jTJSqooBo4zntnqO9pLzQmag6bQyHcnAjiKlUMfSDQDnvu7hhn9aTKLWk_-HsfXnQFqGTnt6lNg3TP98NxA9In5cjX-5xcEmnbdk7KpNrD0Ax_y1DdYJSbPGUI/s1600/HomeServer11.PNG" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<br />
Now save and close this file and remove the ".txt" extension from its tail back to its original "httpd.conf" <strong>Left</strong> click on the "Apache http server icon" on your desktop tray and then click on "Restart" on the drop down menu choices. tool tip text shows "All Apache Services Running" Now start to create your web site. Open "C:\Web\MyWeb" directory and on a note pad create any simple html. Then "save as" it as a index.html, or default.html, or home.html. I am running everything from default.htm as I have transported my web site from Microsoft Office Live (OL) and like to minimize my workload during the transition. I have created all three with similar content. That makes it more transportable. But, please note that "httpd.conf" file has a default of its own as the "index.html" that serves on connection. You know that when you type "<a href="http://www.anexample.org/">http://www.anexample.org</a>" in your browser. It brings a default page such as " <a href="http://www.anexample.org/homepage.html">http://www.anexample.org/homepage.html</a>. " This can be determined in the "httpd.conf" file as we can see, <br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjh7NEDIn12j2tzhlvfC8gOHE00e1VAVjAbeZeFaHIaOyDLJBXI6zuUAQ5vkug3QjQHC2ugQwjGOGPoC60BF_fRPsmT8DbIMRnx7wVxVN9HunBpJPr43bhShyphenhyphenJ9dQ5SOop63Cu2InbBtso/s1600/HomeServer09.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjh7NEDIn12j2tzhlvfC8gOHE00e1VAVjAbeZeFaHIaOyDLJBXI6zuUAQ5vkug3QjQHC2ugQwjGOGPoC60BF_fRPsmT8DbIMRnx7wVxVN9HunBpJPr43bhShyphenhyphenJ9dQ5SOop63Cu2InbBtso/s1600/HomeServer09.PNG" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
You can change it to home.html or default.html or comment it out by putting a pound (#) sign in front of the line 242. If you do not create an "index.html" page as your default home page, the <a href="http://www.anexample.org/">www.anexample.org</a> opens a page with a folder/file tree of your websites including everything you have in the "root directory" you created above. To check that I delete my index.htm page. I have three links here for the test: <a href="http://messiah.dyndns.info/">http://messiah.dyndns.info/</a> and <a href="http://messiah.dyndns.info/Home.html">http://messiah.dyndns.info/Home.html</a> and <a href="http://messiah.dyndns.info/Default.html">http://messiah.dyndns.info/Default.html</a> (These as I said could be slow or down due to I turning off the old top.) Later, I explain where "dyndns" comes from.<br />
In the same directory I create four folders as, "documents" and "images" and "cgi-bin" and finally one I need as "PDFs" One might like to have other folders such as "downloads" or "stylesheets" or"JSes" and so on. In contrast to that, I put my css files naked next to index.html, also if any js file. I have none of this type yet. Next I should open the firewall to allow access of the Internet into that server. I log into my router. (I can log from any computer on my hub.) I click on "Port Forwarding Option/Port Triggering" in my NetGear router it is like this:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgbkO1AEV_NUHkT0biH5C48bK4GmthWHfUv0rRPtzBgczQVEhFXcmp_rUEvOj3J5tEY3DQVuR3lYOzOEm4yljcoo6Spm4xTFhyphenhyphen77xhGw02d8kcq8STpsnDZOrH9V49YFAh1kNTfmi3bdZA/s1600/Router03.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="323" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgbkO1AEV_NUHkT0biH5C48bK4GmthWHfUv0rRPtzBgczQVEhFXcmp_rUEvOj3J5tEY3DQVuR3lYOzOEm4yljcoo6Spm4xTFhyphenhyphen77xhGw02d8kcq8STpsnDZOrH9V49YFAh1kNTfmi3bdZA/s640/Router03.PNG" width="640" /></a></div>
<br />
Your port forwarding could be blank, so you need to "Add Custom Service." Fill the necessary fields, as described. "Server IP Address" is the fixed IP address given by the hub of your broadband router to the old computer that you are using for your home web server. You can find it by clicking on "LAN Setup" on the left hand pane of the router. I found it as "192.168.1.7" for me. It almost always starts with "192.168.0" for all connected device. Mine starts with "192.168.1" for all device. After configuring the "Port" please type <a href="http://localhost/">http://localhost/</a> in your browser (local host is the loopback to your web server) or if you have a "home.html" type <a href="http://localhost/home.html">http://localhost/home.html</a> in your browser that takes you to the home page of your "<strong>Home Made</strong>" website. Next, "<a href="http://codesforus.blogspot.com/2011/08/how-to-create-web-hosting-in-your-home.html">How your site becomes visible on the Internet?</a>"<br />
(Update : See also this post <a href="http://codesforus.blogspot.co.uk/2012/12/web-hosting-at-your-home-revisited.html">Web Hosting at Your Home (Revisited)</a> )Peter Joneshttp://www.blogger.com/profile/03192918305428815983noreply@blogger.com0tag:blogger.com,1999:blog-667520058465774437.post-18312915898113383322011-07-13T12:29:00.027+01:002014-03-10T09:39:18.484+00:00Moving from Microsoft Office Live Web Hosting (2)<span style="color: red;">(For the latest PDF files Merger Software please have a look at the top of the left margin, inside the red box.) </span>Already I have checked that how far my web pages are relying on Microsoft Office Live (OL) css files on the host servers. Wherever I go I should have access to these files. I know that those files and their paths remains on-line for a while but if in a weekend the host decides to deprecate all of them, decommission the old servers then I'll be in trouble. Although some people have put them available online, I should have a copy of my own site saved on my own desktop or somewhere in my possession. It is easy to extract them. I give their paths to W3 CSS validator, <a href="http://jigsaw.w3.org/css-validator/">(click) here</a>. To find the path you can right-click on your pages in the browser and open "View Source." In the document, inside the <head> part of the document. You will find the links to css files like this, <br />
<pre><link <span style="color: red; font-size: x-small;"><span style="color: red; font-size: x-small;">href</span></span><span style="color: blue; font-size: x-small;"><span style="color: blue; font-size: x-small;">="http://cdn1.officelivecontent.com/2.02.4131.0/WebHosting/_layouts/1033/wh/stylesV2/masterroot.css"</span></span><span style="font-size: x-small;"> </span><span style="color: red; font-size: x-small;"><span style="color: red; font-size: x-small;">type</span></span><span style="color: blue; font-size: x-small;"><span style="color: blue; font-size: x-small;">="text/css"</span></span><span style="font-size: x-small;"> </span><span style="color: red; font-size: x-small;"><span style="color: red; font-size: x-small;">rel</span></span><span style="color: blue; font-size: x-small;"><span style="color: blue; font-size: x-small;">="stylesheet"</span></span><span style="font-size: x-small;"> </span><span style="color: blue; font-size: x-small;"><span style="color: blue; font-size: x-small;">/</span></span>></pre>
Copy <a href="http://cdn1.officelivecontent.com/2.02.4131.0/WebHosting/_layouts/1033/wh/stylesV2/masterrootto">http://cdn1.officelivecontent.com/2.02.4131.0/WebHosting/_layouts/1033/wh/stylesV2/masterrootto</a> .css part and past it on the text field of W3 CSS Validator and press "Enter." All the CSS file content comes on the page. Copy them and paste on a notepad. Save it as, say, masterroot.css and keep it. I have put my used files, <a href="http://messiahpsychoanalyst.googlecode.com/files/MS_MasterRoot_CSS.css">MasterRoot</a>, <a href="http://messiahpsychoanalyst.googlecode.com/files/MS_Tables_CSS.css">Tables</a>, and <a href="http://messiahpsychoanalyst.googlecode.com/files/MS_Theme_CSS.css">Theme</a> available if you like save them and open them on notepad or using your favourit editor. The file can inspire you, later, when you become more aggressive towards building your site with richer interactions, to modify it and customize it and perhaps correct it on established standards (e.g. use % for font size rather than px or pt) for your personal requirements. Look inside the CSS files, find out what you do not have as your own asset such as, url('../../../wh/images/icons/slideshow_buttons.png'), but you are using them in your pages. Right click on that resource on your related pages and save the pictures with its defult name on your own computer. Later, chang that URL to url('/images/icons/slideshow_buttons.png'). Now, you are ready to be weaned from free milk and it is necessary to pay couple of pounds (you might have to pay dollars or euros) per month. It's worth having it if you gain ad-free hosting, with unlimited disk space, bandwidth, and diversity of uploading file formats. So far my website was very simple. I even could not add a download counter to it. It was enough for me since I do not have a business to promote it on my site as a show window. I do not want to be employed either to attract the head hunters. Nevertheless, I like to experiment new ideas and write them down. After lot of research I could find a place to meet my demands in having a hassle free hosting. That gives me a free domain name if I need one. But I did not need another domain but what now I have and easily can transfer to them as registrar of the domain after now. I can keep the present registrar but my selected web hosting has a scheme that helps a life time free domain name registering. As I am a retired person I like to have a guaranteed place to keep my website at least for ten years after me. I had to select a place that already has shown that resilience not like mushroom firms that come and go without being adhered to any liability. The very cheap hosting I found is the oldest in the market too. I liked to have the best customer service. I have many questions and cannot adventure on googling questions and ramble through forums that you see questions are asked in 2005 and by now has not received any answer. I did not like to receive everyday an unsolicited email to ask me to upgrade to a VIP or pro or such type of equivalent products. I needed to have secure place with up-time almost near to 100 percent. I found it <a href="http://www.fatcow.com/join/index.bml?AffID=660535">here</a>. I am paying £3.0 ($4.5 US) a month. <br />
<table style="border: 2px solid red;"><tbody>
<tr><td><b>(This site is an ad-free education site but for only from 1/March/2012 to 30/April/2012 as a help to pass my experience to many who have to move from free OLSB before 30/April/2012)Disclosure: I am a professional able to review IT related products and may receive compensation from the company whose product I advised here, ONLY if you buy through this <a href="http://www.fatcow.com/join/index.bml?AffID=660535">click</a> (you also may get discount). I tested the product thoroughly and give high marks to only the very best, but I do not accept ANY paid reviews at all. I do not review any other product on any of my ad-free, non-commercial sites and the opinions expressed here are my own. </b></td></tr>
</tbody></table>
I paid $162 ($132 +$30 VAT) for three years. At the portal there is no mention of VAT. Therefore the VAT is hidden from the potential buyer, which is not acceptable for me with the ethics of a teacher. There was no mention of the fact that for the non-profit organisations they have cheaper plans. Also this is an introductory fee. Renewals are as much as twice of this price. I might decide to renew after three years or even make it automatic due to my age. However, many of the people now a days use the "switch-to-next-cheapest-offer scheme." Competition is fierce and diverse in webhosting and gradually in cloud computing in general. See, purchasing car fuel or domestic utility or even Internet Service Provider or cable TV normally narrows down to limited sources but it is not for things such as the web hosting. There are cheaper introductory offers but not as good as this one with such a long track record of hosting. Immediately after subscription I uploaded all of my OL pages as html to my dashboard into the root and into the folders that I have created. I uploaded my CSS files into the root directory. Using their robust editor, I corrected the above mentioned codes to<br />
<pre><<span style="color: #a31515; font-size: x-small;"><span style="color: #a31515; font-size: x-small;">link</span></span><span style="font-size: x-small;"> </span><span style="color: red; font-size: x-small;"><span style="color: red; font-size: x-small;">type</span></span><span style="color: blue; font-size: x-small;"><span style="color: blue; font-size: x-small;">="text/css"</span></span><span style="font-size: x-small;"> </span><span style="color: red; font-size: x-small;"><span style="color: red; font-size: x-small;">rel</span></span><span style="color: blue; font-size: x-small;"><span style="color: blue; font-size: x-small;">="stylesheet"</span></span><span style="font-size: x-small;"> </span><span style="color: red; font-size: x-small;"><span style="color: red; font-size: x-small;">href</span></span><span style="color: blue; font-size: x-small;"><span style="color: blue; font-size: x-small;">="/MS_MasterRoot_CSS.css"</span></span><span style="font-size: x-small;"> </span><span style="color: blue; font-size: x-small;"><span style="color: blue; font-size: x-small;">/</span></span>></pre>
Purposefully I changed names of the CSS to my desired ones. I uploaded all the images, too. In contrast to OL, I could organise files into the subfolders. I uploaded CSS files into the root. In half a day my site was up and running with a look completely similar to my OL site. You can compare this two sites at <a href="http://messiah.web.officelive.com/default.aspx">(click here please) OLSB</a> (07/March/2014: no longer exists) and at its new <a href="http://messiahpsychoanalyst.org/Default.html">(click please) host</a>, or even on my home toy Apache web server that I have implemented on an old laptop (<a href="http://messiah.dyndns.inf/Default.html">please click here</a>; this could be slow and sometimes down due to turning off the laptop).Structure has completely migrated in half a day. Details, I have time and gradually do them. I have left the green default of OLSB background as it is (when you refresh a page it flashes green). It is for the test of my codes. Later I change it to transparent in the CSS. Please look at the bottom of the page it is validated by W3C, both for html code and for the CSS. I put this page for comparison since in its creation I only had used OL default aspx editor, not my own html pages launched from the "Documents Gallery." Due to more control on style, my new page is more meticulously designed. Bulk of my work have been done. I am enjoying my new freedom. I have loads of things ahead to do and to learn (thanks to my friend "Phoenix" for his discussions). A panic has happened among some, perhaps more than half of the OL free guests. It is as easy as this to solve. I have worked on Google hosting almost from a year ago. It is very basic and rough and inflexible. It is good to practice things around but not rely on it to be used as a host. It has no place for any adventure and is far more basic than OL with no guarantee of any customer service. Next, <a href="http://codesforus.blogspot.com/2011/08/moving-from-microsoft-office-live-web.html">How to Create a Free Web Hosting in Your Home</a>?<br />
(Update : See also this post <a href="http://codesforus.blogspot.co.uk/2012/12/web-hosting-at-your-home-revisited.html">Web Hosting at Your Home (Revisited)</a> )<br />
<div style="background-color: yellow; border-radius: 5px; border: 2px solid red; color: darkred; margin: 2px;">
<div style="margin: 10px;">
Update 07/March/2014 : by doing differen experiments and as it is now well known for all designers, I demolished my entire web, built it based on HTML5, CSS3. My site follows a single CSS file. Using tables for layout and partitioning of web pages is completely wrong. Search engines ignore most of the contents inside any table rows and columns. I built all the pages with division (div) html tags. I created templates for pages and in a production line manner, I exported my pages to new layout. CSS3 has facilities for header, footer of pages, for different media, images, video and so on and compatibility with older Internet Explorers versions can easily be overcome. Poor parts of the world might still use IE versions before IE9, but it is their own choice since they can use free and modern versions of Mozilla browsers. I easily have created my own wiki, php files, download counters, and even (though not necessary) a basic analytic. I have a back up of my site on my own personal home web hosting (and also on a 700MB CD) that enables me to change to any host at any desired time. Therefore, good bye to everything that is not under my own control and understanding.</div>
</div>
Peter Joneshttp://www.blogger.com/profile/03192918305428815983noreply@blogger.com0tag:blogger.com,1999:blog-667520058465774437.post-43707364832924556782011-07-13T12:28:00.005+01:002012-12-24T12:46:43.684+00:00Moving from Microsoft Office Live Web Hosting (1)<span style="color: red;">(For the latest PDF files Merger Software please have a look at the top of the left margin, inside the red box.) </span>Frequently in the past I have written about tuning of Microsoft Office Live web hosting. This was a generous flexible tool offered by Microsoft essentially for small businesses to help them to have a decent hassle free presence on the web without cornering them to buy anything from the host. You even could remove that small font link and logo of the host at the bottom of created page. (I never removed it, as I believed that should be promoted; when one gets one should give.) Its editor was the best in terms of robustness and flexibility and design among any on-line editor I ever had experienced. One could bypass that editor by creating his own page and launching them from the "Documents Gallery" of his own. Not that you could produce one of those aggressive websites with different capabilities that is possible to run from a full blooded paid hosting, still enough to learn and keep the fire aflame. Besides tens of thousands of small businesses using that facility for income, there were ten folds of them used the hosting for personal non-profit applications such as educators, charities, different churches of different religions, artists, writers, political protagonists, anybody who wanted to have a voice on the Internet or had something to offer free to the public. This was a great altruism. And one knows that altruism pays. When a computer enterprise promotes free presence of public on the Internet, at the end there'll be a queue of enterprises in some indirect manner in front of its own sales department. But should not forget the lesson of Sun Microsystem. Sun was a computer "Robin Hood," earning from big enterprises but lavishly spending for any geek (perhaps I mean cool) ideas around. It was a funky cafe, in the eyes of nerds to come and test their tastes. I frequently had received free Amazon vouchers, tee shirts, mugs from Sun just for writing a couple of lines as a comment, or a good bug report, without ever asking. There were supports for hundreds of projects without obligation to finish them. Free software, tools, and tutorials were available in every corner of Sun Microsystem, in galore. Return was good as Sun was enjoying having seven billion dollars just in cash in its backroom safe. But when enterprises started to fall, that cash was spent in few months without Sun having a cushion from backbone of more population. Oracle took over the Sun and accepted prudently many of the legacies of Sun Microsystem. Oracle has not any bad reputation as an aggressively business oriented company. Even I do not believe, in spite of many contrary ideas, that such a bad reputation exists for Microsoft. Essentially IBM, Microsoft, Oracle, Sun, Intel, Google, and many other similar companies are based on a founder and a population of employees mostly from the nerds with deep tendency to fulfill a mathematical curiosity than earning the money. Still, I believe, Oracle should keep the name of Sun in a similar way to that of Ohm, Siemens, Volt, Watt, Ampere, and such reputable names. I fell a bit far from my original discourse. Now, Office Live is being shut down. At first, I was somehow bitter, hearing the news. However, now I understand why Microsoft has made such a decision. It was not possible for Microsoft, especially in present financial situation of the world to maintain an activity which is not part of its expertise and statement of mission. Add the fact that most of those customers are not deeply engaged in design of a website. Microsoft has offered a paid hosting as part of the Office 365 on-line suite. That Office 365 is a good and well designed product seamlessly coordinated with Microsoft Office, but its web hosting is far weaker and more basic than Office Live and for one who needs only web hosting is useless and expensive. Therefore, many of OL users are decided to move. Thank you Microsoft for hosting my site. I learned many things from you and received support of a paying customer, but now it is time to adventure in open space and stand on our own feet. How can we move? It is subject of the <a href="http://codesforus.blogspot.com/2011/07/moving-from-microsoft-office-live-web.html">next post</a>.<br />
(Update : See also this post <a href="http://codesforus.blogspot.co.uk/2012/12/web-hosting-at-your-home-revisited.html">Web Hosting at Your Home (Revisited)</a> )Peter Joneshttp://www.blogger.com/profile/03192918305428815983noreply@blogger.com1