Website Tips


Administrator

Administrator

Wednesday, 15 February 2012 01:24

WHMCS Template viewer

How to view your WHMCS Template before you upload it

WHMCS uses Smarty templates which can be setup on your PC to view your changes before you upload them.
Of course there are some linits as the variables must be set for each page which make it a bit of a task.

But if all you want to do is edit the header and footer then I have done the work for you.

Create a index.php file and add the following to it.

<?php
 // put full path to Smarty.class.php
require('libs/Smarty.class.php');
$smarty = new Smarty();

$smarty->assign('companyname',your title here');  //<<-- Your Company Title
$smarty->assign('systemurl','http://localhost/');  //<<-- place the url here
$smarty->setTemplateDir('templates/default');  //<<-- this and the next two must match exact your folder names.
$smarty->setCompileDir('templates_c');
$smarty->setCacheDir('cache');

$smarty->assign('template','default');  //<<- Set it to template folder name and do not change anything below this.
$smarty->assign('charset','utf-8');
$smarty->assign('LANG' , array('hometitle'=>'Home','announcementstitle'=>'Announcements',
                               'knowledgebasetitle'=>'Knowledgebase',
                                'networkstatustitle'=>'Network Status',
                                'affiliatestitle' => 'affiliatestitle','contactus'=>'Contact Us',
                                 'account'=>'Account','login' =>'Login', 'register'=> 'Register',
                                  'forgotpw'=> 'Forgot Password?'));

$smarty->debugging = false;
$smarty->caching = false;
$smarty->cache_lifetime = 120;

 $smarty->display('header.tpl');
$smarty->display('footer.tpl');
?>

That's all you need - now download Smarty 3.x1.7 and copy your WHMCS template folder including all files in it and the includes/jscript folder to your PC

create a directory structure under your web folder as follows

/lib
/includes/jscript
/cache
/templates
/templates_c

That's it - you should be able to view the header and footer as it will look on your site in WHMCS.
There was one problem I had which was the menu didn't work under this proper. For some reason the background color didn't show on the default template and the drop down menu didn't work. This could be due to WHMCS using an older version of Smarty. ( ver 2.6.26)

But you really don't need those to work since they should be changed.
You can set the debug or the cache on if you wish but it's best to leave the cache off for development since you will need to view changes. Having the cache on will require you to erase the cache files in order to see changes made.

Have fun

Friday, 13 January 2012 14:03

US-CERT - problem or solution

Is the US Cert a problem?

You bet it is as I can see no good coming from it.
This came to my attention just recently as a website ( clean-mx.de ) emailed my server company and the us-cert.gov website because a hacker defaced a clients website.

Dear abuse team,

please help to close these offending portals sites(1) so far.

This goes on to show reports from their site and also showing reports from www.bfk.de .

Notice they say close down the offending website. Not repair - not fix - no they want it gone.

In this case Wordpress made a mistake and fixed it so a simple update was required along with restoring the database from backup and deleting any files that did not belong.

Now I ask you this. Why is the government interested in matters that they can not do anything to change. Why would they want a list of websites that were hacked?

I'll tell you why. This is to create reports for analysis. They will break it down and sooner or later make a recommendation as to how to solve this problem.

Their solution will be to create a new law or regulatory branch of government to impose high license fees to website owners. What other possible thing can they do?

This of course will be supported by large companies which will benefit by this as it will make it harder for small startup companies.

There is no reason to track these events other than to compile information which will be the core info of a report used for a recommendation of a new government agency.
Yes I said no reason to track these events as there is nothing they can do about it.
They will not and can not track down the hacker therefore this is a waste of time.

That is my opinion and I don't like what I see.

Tuesday, 03 January 2012 14:48

E-Classifieds Browser problems ver 2

Browser Problems with E-Classifieds

Seems that some browsers do not support group objects.
Google Chrome for instance has problems with multiple check boxes with the same name.

This has caused problems with E-Classifieds when a person adds a new Classified Ad.
If you have version 2.X and you set the max categories to allow multiple subcategories then it will error.

The error will be a required item was not filled in.

The fix to this is to replece the check boxes with a Select.

The file that we need to edit is under the folder     /html/
File name is post_item_form.pl

Line 173  on down to line 178 in this file needs to be replaced with

print qq~<select name="subcategory" multiple=true>~;
foreach $subcategory (@subcategories) {
print qq~ <option>$subcategory</option>~;

}

print qq~</select></td></tr>~;

}

This should fix it.

Sunday, 11 December 2011 21:09

Windows days are numbered

The days of Windows are numbered

Windows XP was the peak and as we go forward Microsoft will slowly destroy it's OS.
The first blow came when Microsoft clearly disregarded it's main source of income.
When it put out Vista, which had no backward compatibility to XP, this was a major mistake.
It took years to develop it's strong hold in the corporate market.
Yet Microsoft is determined to now cater to new technology rather than paying clients.
Windows 7 although it solves much of the Vista problems it offers no upgrade path from XP.
Windows 8 maybe a really nifty looking OS but it is a complete departure from the basic roots.
My guess is Linux will become the main stay for office work as Microsoft can no longer be trusted.
When it comes to who the OS maker will support, the trendy fades or the main stay corporate clients, Microsoft has clearly shown they will jump on the quick money band wagon.
I suspect that Windows 8 will be the beginning of Microsoft's downfall.

Tuesday, 05 April 2011 15:07

Internet under Siege

Is the Internet under Siege?

Having placed an Ad in a popular Classifieds website, which I will not mention, I have gotten so many responses that are either phishing attempts, Scams, Spam or ones that are trying to spread a virus by giving links to infected websites.

The numbers of this type of Ad response is up 1000% over just a few years ago.

One response I got was a popular Nigerian type of Scam.
They will send me a check and 10 PC's but the check will be more than what is needed and I should use the balance to pay for the other 10 PC's.

Really big Classified websites may well be forced to change the way they run their website due to this if it continues to become a growing problem. I can see that a login will be required for those that wish to view the ads as a way to combat this. It may also be a problem for Auction sites as well.

At this point do not assume that the person responding to your Ad is a honest person!
Do not click on any links given in an email.
Do not assume that a email sent you came from the auction or classifieds website.
A popular phishing attempt is to send you a email that looks like it came from the website you placed your ad in but it's really trying to get you to click on the link to get your login details.

Best never to use a link in a email!!!! Go to the site in your web browser and login as this is the best way to protect yourself.
Do not accept any offer that will pay you in a check larger than what you are expecting to get.
One type of scam is they can withdraw money from your account if they have a check from you and the info of a check deposited into your account that they sent you. This has taken place before and you can look it up as it happened to a few non-profits.
A person sent a non-profit a check larger than was told they would send. They then convinced the non-profit it was a mistake and to send them a check back for the difference and this a few weeks later left the non-profit with a empty checking account.

The problems in the world are growing and I fear they are growing faster with each passing day.
The internet is also reflecting the growing troubles in the world.

 

Tuesday, 05 April 2011 13:58

What's the best Backup Solution

Should I use Online Backup or Externial Backup for my PC?

Online Backup is growing in popularity but unless you have a very high speed internet connection it will take many hours or even days to backup a full PC

If you decide to use this type of backup then you will need to limit your backup to only important documents stored on your PC unless you can afford to go to a very high speed internet connection. Costs of such a connection will be about 140.00 per month and it's still limited to 20 Mbs which is around 150 Megabyte per minute.

I prefer the use of External Backup as it's less costly and portable. The old Tape backups in today's world are obsolete so the only choice is hard drive backup. The lowest cost units are simple USB external drives which can do a complete system backup. For those that need something better Netgear and a few other companies have units that cover any backup need a person or small company will require. Backups for a complete hard drive, depending on the amount of data, can be as fast as 20 mins.

Software choice for backup is a big factor in speed, ease of use and ease of restoring data.
The backup that comes with Windows is not very good as it was designed when drives were only 50 Megabytes in size and was designed to work with tape drives. It's been tweaked over time but is not something I would bank on and it can not restore your OS as it's not an image backup.
It's very slow and not easy to use.
I recommend Acronis backup as it's very easy and it creates a image backup which is the best type of backup.
Should your boot drive fail you only need to place a new drive in your PC and boot to the Acronis restore disk.
From there choose the backup and when it's done your PC is working exactly as it was before the old drive failed.
You can also restore your backup to a new PC and it has drive copy ability which is another big plus.
A big plus feature is the ability to open a backup in Windows Explorer using the mount feature in Acronis.
When a backup is mounted it will appear as a new drive letter in Windows Explorer and there you can access all your files at hard drive speed.
This allows you to go back and view files or copy backed up files should some files have been damaged or erased.

If you have data that is important then you can setup backups that take place weekly and incremental backups that take place daily. If you drive has enough room for multiple backups then you can do multiple sets of backups spaced apart by a week or two or more. This allows you to go back in time as if the latest backup was also containing files that were damaged the one two weeks ago may have a good version of that document.
For one of my clients I have setup 4 full backups and 4 incremental backups that take place in sequential order so as to have 4 weeks of complete backups. This allows up to a one month period to discover a problem and be able to recover the files which may not be up to date but is at least better then nothing.

Admin
CW3 Web Hosting

Monday, 01 November 2010 17:19

E-Classifieds spam fix

How to remove send to friend
 

If you are using E-Classifieds software you have version 2.39 or older which has the link to send email to a friend you will be a target for spammers.

The form lacks a image verify input to weed out bots from using this form.

A bot only need send the following and wham you may find your site black listed.

session_key=&send_ad_button=on&results_format=long&db_id=any ID&query=retrieval

For the ID above of course it will have an ID for one of your classified ads.

Until a new version comes out remove this ability for users to send any ads to anyone.

This can be done with a standard text editor but keep a backup of each file in case you make a mistake where you can always restore the original file.

First in the classifieds.cgi main file on line 724 comment out the following by placing a # in front of each line as shown below:

#elsif ($form_data{'send_ad_button'} ne "")
#  {
#  $helptopic = "send";
#  &pagesetup("Send Ad To A Friend");
#  &generic_form_header;
#&require_supporting_libraries (__FILE__, __LINE__, "$path/library/search_and_display_db.pl");
#  &search_and_display_db;
#  exit;
#  }

Next in the HTML folder find the file search_results_body.pl

On line 345 remove the line:
<a href="$script_url?session_key=$session_key&send_ad_button=on&results_format=long&db_id=$fields[$index_of_db_id]&query=retrieval"><img src="$graphics_dir/email.gif" width="120" height="27" border=0 alt="E-mail this ad to a friend!"></a>
 
Also remove the file send_ad.pl from the folder /library or rename it as send_ad.bak

These changes will disable the send to friend ability.
When E-Classifieds makes the required changes to prevent Spammer abuse you can upgrade to newer version.

Vincent G.
Sunday, 14 February 2010 14:08

Uploading Files

Uploading files with PHP
 

To upload files with php is pretty simple.
We first start with a basic form and add enctype plus method = post.

<form action="index.php" enctype="multipart/form-data" method="post">
<input type="file" name="upload" size="40">

<input type="submit" name="start_upload" value="Start Load">
</form>

You can place this form on any page but will need to change the action= to match the name of the php script you create. In our example we named it index.php but it can be any name as long as the extension is .php.

We now add the PHP code which is as follows:

<?php
$tst = isset($_POST['start_upload']) ? $_POST['start_upload'] : '';


if (!empty($tst)){

// Where the file is going to be placed
$target_path = "/home/yoursite/public_html/uploads/";

/* Add the original filename to our target path. */
$target_path = $target_path . basename( $_FILES['upload']['name']);

if(move_uploaded_file($_FILES['upload']['tmp_name'], $target_path)) {
    echo "The file ".  basename( $_FILES['upload']['name']).
    " has been uploaded<br>";
}else{
    echo "The uplaod failed!";
}
?>

It's that easy and the only other thing you can do is add a filter to only allow certian file types.
To do this we can add these lines:

$filetype = $_FILES['upload']['type'];
   if($filetype=="application/pdf" or $filetype=="application/zip" or $filetype=="application/x-zip"){

   Put your code here to upload file!!

  }

You can add or remove file types to the above sample.


 

Wednesday, 28 October 2009 11:41

How to customize the WHMCS Status page

Customizing the WHMCS Status Page on version 5.12 and lower.
 

To change the status page you need to edit the template file serverstatus.tpl.
This is located under templates/default.

The lines as follows that come as the default can be changed.

<tr class="clientareatableheading">
<td>{$LANG.servername}</td>
<td>HTTP</td>
<td>FTP</td>
<td>POP3</td>
<td>{$LANG.serverstatusphpinfo}</td>
<td>{$LANG.serverstatusserverload}</td>
<td>{$LANG.serverstatusuptime}</td>
</tr>
{foreach key=num item=server from=$servers}
<tr class="clientareatableactive">
<td>{$server.name}</td>
<td>{get_port_status num="$num" port="80"}</td>
<td>{get_port_status num="$num" port="21"}</td>
<td>{get_port_status num="$num" port="110"}</td>
<td><a href="{$server.phpinfourl}" target="_blank">{$LANG.serverstatusphpinfo}</a></td>
<td>{$server.serverload}</td>
<td>{$server.uptime}</td>
</tr>

As we can see the function get_port_status is passed a port number.
So to add additional checking you only need to add another line with the port you wish to display.

I would suggest right off to remove the PHP info link as it can cause you problems with hackers.

For my servers I put
<tr class="clientareatableheading">
<td>{$LANG.servername} / Info</td>
<td>CPANEL</td>
<td>HTTP</td>
<td>FTP</td>
<td>POP3</td>
<td>MYSQL</td>
<td>WEBMAIL</td>
<td>WHM</td>
<td>PHP Ver</td>
<td>MYSQL Ver</td>
<td>{$LANG.serverstatusserverload}</td>
<td>{$LANG.serverstatusuptime}</td>
</tr>
{foreach key=num item=server from=$servers}
<td>{get_port_status num="$num" port="2082"}</td>
<td>{get_port_status num="$num" port="80"}</td>
<td>{get_port_status num="$num" port="21"}</td>
<td>{get_port_status num="$num" port="110"}</td>
<td>{get_port_status num="$num" port="3306"}</td>
<td>{get_port_status num="$num" port="2095"}</td>
<td>{get_port_status num="$num" port="2086"}</td>
<td>{$server.phpver}</td>
<td>{$server.mysqlver}</td>
<td>{$server.serverload}</td>
<td>{$server.uptime}</td>
{foreachelse}
<tr class="clientareatableactive">
<td colspan="12"><hr></td</tr>
<td colspan="7">{$LANG.serverstatusnoservers}</td>
</tr>
{/foreach}



This shows the info we would like to see but I also added a link, on my hosting site ( cw3host.com ), to view the server info via the script PHPSysinfo

The templates allow conditional processing which is really a great help to make you page do what you want.

Putting {if $server.name eq "Server1"} will control how a single server is processed in your page.

For version 5.13 it has changed.
-------------------------------------------------------------------------------------------

We now have to add lines to the javascript functions.

For instance if we want phpver  we add the following to the function getStats(num)

jQuery("#phpver"+num).html(data.phpver);

Add your table header

            <th class="textcenter">PHP Ver</th>

Then the table col

            <td class="textcenter" id="phpver{$num}"><img src="images/loadingsml.gif" alt="{$LANG.loading}" /></td>

And that's it.

You can add ports but would need to add a line for each after the <script> at end of table ( last col )

As you can see for port 21 thay have checkPort({$num},21);

Just add a Table heading <th> and column for each port plus the checkPort function call.
 

Tuesday, 08 September 2009 15:49

Remote Desktop Connection

How to setup Remote Desktop
 

To setup a remote connection to your PC takes a few steps to do.
Most people use routers and if you are using one you need to not only make changes to your PC settings but also have to add a Port Forward in your Router. You need to get your ISP IP address and you need to set a fixed IP on your PC so first we will address this.

First, on the computer we wish to access, we will go to Properties on MY Computer which is called System in Control Panel.
So either right click on my Computer if you have this on your desktop or go to Start - Control Panel and click on System.
There you will go to the Remote Tab.
Now most important is that you must have a user that has a password set to access this computer.
If you will only have one user then it must be password protected so only those with a password can access the PC using remote access.

So on the System Properties window / Remote Tab:
Check the box under Remote Desktop "Allow users t connect remotely to this computer."
Click on the Select Remote Users.
Add the user you will allow.

Click OK to save on both

Now, if you are using a Router,  we must set the IP for this PC.
If your router allows setting a Static IP address for a PC this will make it a bit better.
Better routers have this feature.
If yours does not then we will have to go to the Status window for Network Connection for Local Area Connection.

Go to Start - Control Panel - Network Connections.
Right click on the Local Area Connection and choose Status.

You should get a Local Area Connection window which has two tabs. ( General and Support)
Click on the support tab and then click on the details button.
Write down the default gateway IP address and the two DNS servers addresses.
Close the details window and click on the general tab in the Local Area Connection window.
Now click on the properties tab.

This opens a new window and here we need to highlight the line Internet Protocol (TCP/IP)
Once selected click on properties.
Click on "Use the following IP address"
Fill in the three boxes the following:
IP address: Use your gateway address but add 5 or 10 to the last set of numbers.
                     For example if you Gateway IP was 192.168.1.1 then make it 192.168.1.6  or 192.168.1.11
Mask: Windows fills this in but if it didn't put 255.255.255.0

Gateway:  Type in your gateway address you wrote down.

The next two boxes put the DNS server IP's in each and be sure "Use the following DNS server addresses" is checked.

Save this by clicking OK

Ok now we go to our Router.
We get into the router by typing in the address bar in Internet Explorer the gateway IP address.
Once you type that in a login screen should now be seen.

If you bought the Router the and have not changed the default login look up the default login in your manual.
For most Linksys routers it's admin for the password and the user is blank.

Once in the setup screen navigate to the screen that controls port forwarding.
For low end Linksys routers it's in the gaming screen.
The port to forward is 3389 and there may be two boxes to enter ports in such as start end.
Put 3389 in both and enter the IP address you set for this PC in the IP address box.
Save it and exit.

Go to any website that gives you your IP address.
Just do a search in any Search Engine "Google, Bing, Yahoo" for what is my ip.

Write down the IP address and take it with you to the PC you wish to use to connect to the PC you made these changes to.

On your remote computer click on Start - Programs - Accessories and click on Remote Desktop Connection

In the window type in the IP address you got from what ever website you used to get What is my IP.
If you set it correct you will get a login screen and your now able to access your office or home PC from a remote location.

Now what if you want to have two or more PC's available in the same network remotely.

Well this requires a few more changes.
First you need to make a change to your Windows Registry.
Go to Start - Run and type in regedit.
You will need to navigate to the setting:

HKEY_LOCAL_MACHINE / System / CurrentControlSet / Control / TerminalServer / Winstations / RDP-TCP / PortNumber

The current setting for PortNumber will be 3389 when viewed in decimal - change this to 3390 decimal on the second PC you want to add as a remote access PC in the network and raise this number by one for each additional PC added. A third PC would have 3391 and so on.

Follow the same steps as above but the IP must be set to a different number and in the router you need to add a second port forward using 3390 as the port and the IP you set for this second PC.

To access these other PC's you need to add the port to your IP in the Remote Desktop Connection window. This is done by typing the IP + colon  + port number
Thus you would have 555.555.555.555:3390

For the PC that you have set to access.
If you have a Router it's best to turn off the windows firewall as all Routers have firewalls built in.
But if you have your windows firewall on then you need to go to Control Panel - Windows Firewall
Click on Exceptions Tab and click on add port button. Type in a port name - call it remote desktop and type in the port number.
You will need to do this for each PC you setup to access remotely.
Page 5 of 8