Saturday, 31 August 2013

How to enable Gzip on your website

Enable Gzip Compression

Compression is enabled by adding some code to a file called .htaccess on your web host/server. This means going to the file manager (or wherever you go to add or upload files) on your webhost. The .htaccess file controls many important things for your site. If you are not familiar with the .htaccess file.


<IfModule mod_mime.c>
 AddType application/x-javascript .js
 AddType text/css .css
</IfModule>
<IfModule mod_deflate.c>
 AddOutputFilterByType DEFLATE text/css application/x-javascript text/x-component text/html text/richtext image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon application/javascript
 <IfModule mod_setenvif.c>
  BrowserMatch ^Mozilla/4 gzip-only-text/html
  BrowserMatch ^Mozilla/4\.0[678] no-gzip
  BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
 </IfModule>
 <IfModule mod_headers.c>
  Header append Vary User-Agent env=!dont-vary
 </IfModule>
</IfModule>


Enable compression on Apache webservers

The instructions above will work on Apache.

Monday, 8 July 2013

Most Useful CMS in dot net

Most Useful CMS in dot net

Microsoft ASP.NET

Composite C1 

History

Composite C1 development began mid-2007, it reached version 1.0 in January 2009 and until September 2010 was sold as a commercially licensed product, primarily to customers in northern Europe.
On 29 September, 2010, Composite released C1 version 2.0 as free open source software under the Mozilla Public License, pledging to continue development on the free core and providing paid services.
In October 2010, Composite C1 was added to the .NET 4 enabled parts of Microsoft's Web App Gallery (Web Platform Installer 3 and WebMatrix).
In March 2011, Composite C1 version 2.1 was released, making SQL Server support part of the open source project.
In December 2011, Composite C1 version 3.0 was released, improving on the developer and content editor user experience and adding ASP.NET Razor as a layout template technology option.

Website : http://www.composite.net

Source code and community ratings

The source code, issue tracker and forum for Composite C1 is hosted at http://CompositeC1.codeplex.com/ - the CodePlex site also contain user ratings and reviews that can not be moderated.

Modules (C1 packages)

Content versioning
Newsletters
Extranet
Page comments
Issuu reader
RSS / Twitter / YouTube feed readers
XML to SQL Server migration
Google Search (CSE) integration
Microsoft Search Server integration
Package Creator
Data Forms Renderer
ASP.NET MVC Player
Social Media integrations (Facebook, Twitter, Google+)



Features

Multilingual, UNICODE support
Multiple document interface
Publishing workflow
Content security
WYSIWYG editor
XHTML compatible
XSLT developer tooling
.NET 4 and ASP.NET 4 based
Transparent XML and SQL Server support via LINQ
Side-by-side support for both ASP.NET Razor, ASP.NET Web Forms and ASP.NET MVC
Support for templating using plain HTML, ASP.NET Razor, ASP.NET Master Pages and XSLT
Run on Internet Information Services (IIS) 6, 7 and 7.5, WebMatrix, Visual Studio 2010, Windows Azure
Support for Mozilla Firefox, Internet Explorer, Google Chrome. Firefox users have spell check features.



DotNetNuke

DotNetNuke is a web content management system based on Microsoft .NET. The Community Edition is open source.
DotNetNuke was written in VB.NET, though the developer has shifted to C# since version 6.0. It is distributed under both a Community Edition MIT license  and commercial proprietary licenses as the Professional and Enterprise Editions.

DotNetNuke Community Edition

The DotNetNuke content management system is intended to allow management of websites without much technical language, and to be extensible through a large number of third-party apps to provide functionality not included in the DotNetNuke core modules.
Skins can be used to change the look of a website using DotNetNuke.
The DotNetNuke Corporation is the steward of the DotNetNuke open source project. The open source version of DotNetNuke is called the Community Edition and is available as a free download. The Community Edition includes access to the source code of the framework and standard installation modules, and an MIT license allowing modification and distribution rights. The Community Edition is a popular web content management (WCM) system and application development framework for ASP.NET, with over 6,000,000 downloads and 600,000 production web sites as of October 2010. The most recent version of the Community Edition (7.0.0) was published in January 2013.

website : http://www.dotnetnuke.com/

Modules

The default functionality of DotNetNuke can be expanded by adding third-party modules, either from an existing library of modules, or through in-house development of custom functionality. The DotNetNuke framework provides basic functionality such as security, user administration and content management, while modules are used to tailor the web site for specific deployment needs.
A set of primary modules are included with the core DotNetNuke distribution. These modules provide the functionality required to create an e-commerce system, an intranet, a public web site or a custom web application. They are maintained by a volunteer team community on the DotNetNuke Community Forge.

A module can be uploaded and automatically installed on a DotNetNuke installation through the administration pages of DotNetNuke. Once a module is added by the administrator, it can be placed on any of the pages in the web site and custom access permissions can be configured for it.

Skins

A skinning architecture provides a separation between design and content, enabling a web designer to develop skins without requiring any specialist knowledge of development in ASP.NET: only knowledge of HTML and an understanding of how to prepare and package the skins themselves is required. Skins consist of basic HTML files with placeholders (tokens) for content, menus and other functionality, along with support files such as images, style sheets and JavaScript, packaged in a ZIP file.[citation needed]
Upon Microsoft's release of the .NET Framework version 2, Microsoft had included functionality known as master pages. The principal idea behind master pages was to encourage code recycling and consistent design and aesthetics throughout a site by creating a master page with placeholders, which at runtime would be compiled and replaced by content.





Umbraco


Umbraco is an open source content management system (CMS) platform for publishing content on the World Wide Web and intranets. It is written in C# and deployed on Microsoft based infrastructure. The open source backend is released under an MIT License while the UI is released under the Umbraco license.
Umbraco was developed by Niels Hartvig in 2000 and released as open source software in 2004.[4] In 2009, CMS Wire described it as one of the leading .NET-based open source CMS systems. In 2010, with 1000 downloads a day, Umbraco was in the Top 5 most popular downloads via the Microsoft Web Platform Installer, two places below its main rival DotNetNuke and was the 12th most downloaded application from Codeplex, six places below DotNetNuke and 13 places higher than mojoPortal.


Releases
Version 4.1 Beta II was released on 16 February 2010 which refactors a number of key components of the framework,[7] including the UI tree control to improve performance and the user experience and parts of the data access layer to reduce the number of database calls.
Version 5 (codenamed "Jupiter") is a rewrite of the framework, built using ASP.NET MVC,[15] published in January 2012. Problems (performance and code complexity) inherent in the architecture of the new Version 5 data access layer  led to Version 5 being dropped in June 2012 despite having been released on a commercial licence, and development efforts refocused on integrating selected Version 5 front end enhancements into Version 4.


mojoPortal


mojoPortal is an open source, cross-platform, content management system (CMS) for ASP.NET which is written in the C# programming language. The CMS supports plugins and has built-in support for, among others, forums, blogs, event calendars, photo galleries, and an e-commerce feature.The project was awarded an Open Source Content Management System Award by Packt in 2007 saying that the "ease of use, set of relevant tools and plugins and also the fact that it is cross platform, made it stand out above the rest".

Awards

Best Non-PHP Open Source Content Management System in the 2007 CMS Awards by Packt Publishing[4]
3rd place in the 2009 CMS Awards by Packt Publishing, in the Non-PHP category



Key features

Cross-platform - Runs under Windows/IIS or Mono/Apache with most GNU/Linux distributions or Mac OS X
Works with MS SQL Server, SqlAzure, MySQL, PostgreSQL, Firebird Sql, and SQLite databases
Supports multiple sites on one installation and database
XHTML or HTML 5 compliant Content Management with support for work flow and approval/publishing process
Custom Skinning with support for user selectable skins and individual skins per page
Supports TinyMCE, FCKeditor, CKeditor or XStandard HTML WYSIWYG
Easily Customizable User Profile System
Member List
Bread Crumbs
Flexible Menu system
Localizable, currently translated into 10 languages
Passwords encryption
SSL support for the whole website or per page
URL re-writing
Error logging and optional debug logging
Authenticate against the database, LDAP, Active Directory, Windows NTLM, OpenID, or Windows Live ID
Content Workflow
Content Versioning
Content Template System
Content Style Template System
Content Widgets
Built in SEO (Search Engine Optimization)
301 Redirect Manager
Integrated Google Analytics
Support for Artisteer templates


Orchard

Orchard is a free, open source, community-focused content management system written in ASP.NET platform using the ASP.NET MVC framework. Its vision is to create shared components for building ASP.NET applications and extensions, and specific applications that leverage these components to meet the needs of end-users, scripters, and developers.
Orchard is delivered as part of the ASP.NET Open Source Gallery under the OuterCurve Foundation. It is licensed under a New BSD license, which is approved by the Open Source Initiative (OSI).
As per Orchard's codeplex page, the intended output of the Orchard project is three-fold:
Individual .NET-based applications that appeal to end-users, scripters, and developers
A set of re-usable components that makes it easy to build such applications
A vibrant community to help define these applications and extensions

Monday, 8 April 2013

301 redirect HTTPS to HTTP on Apache server

Redirecting https to http site-wide using the .htaccess file would be done through:



Options +FollowSymlinks
RewriteEngine on
RewriteBase /
RewriteCond %{SERVER_PORT} ^443$ [OR]
RewriteCond %{HTTPS} =on
RewriteRule ^(.*)$ http://yousitename.com/$1 [R=301,L]


One way is as in this example:


RewriteEngine on
#this page has to be on https
RewriteCond %{SERVER_PORT} !^443$
RewriteCond %{HTTPS} !on
RewriteCond %{REQUEST_URI} ^/secure-page1.php$ [NC]
RewriteRule ^(.*)$ https://
yousitename.com/$1 [L,R=301]

#this page has to be on https
RewriteCond %{SERVER_PORT} !^443$
RewriteCond %{HTTPS} !on
RewriteCond %{REQUEST_URI} ^/secure-page2.php$ [NC]
RewriteRule ^(.*)$ https://example.com/$1 [L,R=301]

#all other pages have to be on http
RewriteCond %{SERVER_PORT} ^443$  [OR]
RewriteCond %{HTTPS} on
RewriteCond %{REQUEST_URI} !^/secure-page1.php$ [NC]
RewriteCond %{REQUEST_URI} !^/secure-page2.php$ [NC]
RewriteRule ^(.*)$ http://
yousitename.com/$1 [L,R=301]


So assuming you have a good reason to want some urls as https AND have them indexed, then you can add php scripting to each page and determine whether it has to be http or https.
To permit the use of php on pages suffixed as .html you need to add an Apache handler in the .htaccess file:


# parsing html as php
AddHandler application/x-httpd-php .html 
NB: The above directiove can vary greatly depending on the rexact server configuration. It can be any of the below directives (or none for that matter):
Addhandler application/x+https-php5 .html
or
AddType application/x-httpd-php5 .html
or another combination like that.  It's bewildering how many different Apache server configuraiotns the can be and how much basic directievs can differ. The trouble is if yuo use the wrong one, you get a 500 error. So it ends up being trial and error all the way.

 php script to be added at the top of every page where you need to 301 redirect from https to http, before any other line of source code would be: 



<?php
if  ( $_SERVER['HTTPS'] )
        {
                $host = $_SERVER['HTTP_HOST'];
                $request_uri = $_SERVER['REQUEST_URI'];
                $good_url = "http://" . $host . $request_uri; 

                header( "HTTP/1.1 301 Moved Permanently" );
                header( "Location: $good_url" );
                exit;
        }
?> 




Facebook-style tooltip plugin for jQuery





Tipsy is a jQuery plugin for creating a Facebook-like tooltips effect based on an anchor tag's title attribute.

Examples & Usage
Basic
By default, tooltips will appear centred underneath their anchor:

Hover over me

Basic example:
$('#example-1').tipsy();
Gravities
Using the gravity parameter, it's possible to control the positioning of the tooltip relative to the pointee:

Northwest North Northeast
West East
Southwest South Southeast
Gravity example:
$('#foo').tipsy({gravity: 'n'}); // nw | n | ne | w | e | sw | s | se
As of version 0.1.3, it's possible to use a callback function to set the gravity dynamically at hover-time. Within the callback, this refers to the active element, and the function should return the calculated gravity as a string. Two demo callbacks are supplied - $.fn.tipsy.autoNS and $.fn.tipsy.autoWE - which select north/south and west/east gravity, respectively, based on the element's location in the viewport.

Here's an example (scroll the page to see the effect):

Dynamic Gravity
Dynamic gravity example:
$('#foo').tipsy({gravity: $.fn.tipsy.autoNS});
Fading
For full Wob2.0 compliance, you must fade these badboys in:

Hover over me

Fade example:
$('#example-fade').tipsy({fade: true});
Bonus Feature
You can EVEN COMBINE FADE AND GRAVITY! (exercise for reader)

Slightly Advanced Usage
Tooltip text can be set based on any attribute, not just title:

Hover over me

Custom attribute example:
$('#example-custom-attribute').tipsy({title: 'id'});
If any attribute isn't good enough, you may pass a callback function instead. It should return the tooltip text for this element:

Hover over me

Callback example:
$('#example-callback').tipsy({title: function() { return this.getAttribute('original-title').toUpperCase(); } });
Finally, it is possible to specify a fallback tooltip for any element which does not have any tooltip text:

Hover over me

Fallback example:
$('#example-fallback').tipsy({fallback: "Where's my tooltip yo'?" });
If your tooltip content contains HTML, set the html option to true (relies on invalid HTML, sorry):

Hover over me

HTML example:
$('#example-html').tipsy({html: true });
Show/Hide Delay
Delay example:
$('#example-delay').tipsy({delayIn: 500, delayOut: 1000});
Hover and wait

Dynamically Updating Text
Tipsy tooltips are 'live' - if the source attribute's value changes, the tooltip text will be updated the next time the tooltip is shown. There's one caveat - if you wish to remove the tooltip by setting the title attribute to an empty string, set the original-title attribute instead (this only applies if you're using the title attribute).



Form input tooltips code:
<script type='text/javascript'>
  $(function() {
    $('#focus-example [title]').tipsy({trigger: 'focus', gravity: 'w'});
  });
</script>
Manually Triggering a Tooltip
It's possible to disable hover events and instead trigger tooltips manually:

Manual triggering example:
My tooltip is manually triggered | Show it | Hide it
Code for manual triggering:
<p id='manual-example'>
  <a rel='tipsy' title='Well hello there'>My tooltip is manually triggered</a>
  <a href='#' onclick='$("#manual-example a[rel=tipsy]").tipsy("show"); return false;'>Show</a>
  <a href='#' onclick='$("#manual-example a[rel=tipsy]").tipsy("hide"); return false;'>Hide</a>
</p>

<script type='text/javascript'>
  $('#manual-example a[rel=tipsy]').tipsy({trigger: 'manual'});
</script>

Friday, 15 February 2013

multiple file attachment in php script and sending mail


<html>
<head>
<title>GLobal web solution Tutorial</title>
</head>
<body>
<form action="php_sendmail_multiple_upload2.php" method="post" name="form1" enctype="multipart/form-data">
<table width="343" border="1">
<tr>
<td>To</td>
<td><input name="txtTo" type="text" id="txtTo"></td>
</tr>
<tr>
<td>Subject</td>
<td><input name="txtSubject" type="text" id="txtSubject"></td>
</tr>
<tr>
<td>Description</td>
<td><textarea name="txtDescription" cols="30" rows="4" id="txtDescription"></textarea></td>
</tr>
<tr>
<td>Form Name</td>
<td><input name="txtFormName" type="text"></td>
</tr>
<tr>
<tr>
<td>Form Email</td>
<td><input name="txtFormEmail" type="text"></td>
</tr>
<tr>
 <td>Attachment</td>
 <td>
<input name="fileAttach[]" type="file"><br>
<input name="fileAttach[]" type="file"><br>
<input name="fileAttach[]" type="file"><br>
<input name="fileAttach[]" type="file"><br>
<input name="fileAttach[]" type="file"><br>
<input name="fileAttach[]" type="file"><br>
 </td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input type="submit" name="Submit" value="Send"></td>
</tr>
</table>
</form>
</body>
</html>







<html>
<head>

</head>
<body>
<?
$strTo = $_POST["txtTo"];
$strSubject = $_POST["txtSubject"];
$strMessage = nl2br($_POST["txtDescription"]);

//*** Uniqid Session ***//
$strSid = md5(uniqid(time()));

$strHeader = "";
$strHeader .= "From: ".$_POST["txtFormName"]."<".$_POST["txtFormEmail"].">\nReply-To: ".$_POST["txtFormEmail"]."";

$strHeader .= "MIME-Version: 1.0\n";
$strHeader .= "Content-Type: multipart/mixed; boundary=\"".$strSid."\"\n\n";
$strHeader .= "This is a multi-part message in MIME format.\n";

$strHeader .= "--".$strSid."\n";
$strHeader .= "Content-type: text/html; charset=utf-8\n";
$strHeader .= "Content-Transfer-Encoding: 7bit\n\n";
$strHeader .= $strMessage."\n\n";

//*** Attachment ***//
for($i=0;$i<count($_FILES["fileAttach"]["name"]);$i++)
{
if($_FILES["fileAttach"]["name"][$i] != "")
{
$strFilesName = $_FILES["fileAttach"]["name"][$i];
$strContent = chunk_split(base64_encode(file_get_contents($_FILES["fileAttach"]["tmp_name"][$i])));
$strHeader .= "--".$strSid."\n";
$strHeader .= "Content-Type: application/octet-stream; name=\"".$strFilesName."\"\n";
$strHeader .= "Content-Transfer-Encoding: base64\n";
$strHeader .= "Content-Disposition: attachment; filename=\"".$strFilesName."\"\n\n";
$strHeader .= $strContent."\n\n";
}
}


$flgSend = @mail($strTo,$strSubject,null,$strHeader);  // @ = No Show Error //

if($flgSend)
{
echo "Mail send completed.";
}
else
{
echo "Cannot send mail.";
}
?>
</body>
</html>

Thursday, 24 January 2013

PHP MAIL() FUNCTION NOT WORKING IN WINDOWS SERVER

When your mail goes to anyone who uses a Windows mail server (comcast, gmail, and maybe aol), the recipients won’t get it.

To test if mail() function exist in your server you can try this few lines of codes.


<?php
if ( function_exists( 'mail') )
   echo 'mail() is enable';
else
   echo 'mail() has been disabled';
?>

If the result above is false/mail is disabled then maybe you need to add the solution I’ve provided below or else of course your mail() code does not formatted correctly

First Steps:


<?php
   // Add this code before mail() function.
  ini_set('SMTP','localhost'); 
   ini_set("sendmail_from", "info@example.com");
?>

Second Steps:


If first steps doesn’t work for you then you need to look a bit in your code header area.
From
$headers .= 'From:  Name <address@example.com>'. "\r\n";
To
$headers .= 'From:  address@example.com'. "\r\n";