Friday, July 18, 2014

Configuration Code for MySql In php

<?php
// db constants
defined('DB_SERVER') ? NULL : define("DB_SERVER", 'localhost');
defined('DB_USER') ? NULL : define("DB_USER", 'root');
defined('DB_PASS') ? NULL : define("DB_PASS", '');
defined('DB_NAME') ? NULL : define("DB_NAME", 'DataBase Name');
 ?>

Initializing Website With PHP

<?php

// Define the core paths
// Define them as absolute paths to make sure that require_once works as expected

// DIRECTORY_SEPARATOR is a PHP pre-defined constant
// (\ for Windows, / for Unix)
defined('DS') ? null : define('DS', '/');

defined('SITE_ROOT') ? null :
define('SITE_ROOT', DS.'wamp'.DS.'www'.DS.'folderName');

defined('LIB_PATH') ? null : define('LIB_PATH', SITE_ROOT.DS.'Folder Containing other files');

// load config file first
require_once(LIB_PATH.DS.'config.php');


Wednesday, July 9, 2014

Making Pdf format class in php

<?php
/*
This class is an extension to the fpdf class using a syntax that the original reports were written in
(the R &OS pdf.php class) - due to limitation of this class for foreign character support this wrapper class
was written to allow the same code base to use the more functional fpdf.class by Olivier Plathey

* Wrapper for use R&OSpdf API with fpdf.org class
* Janusz Dobrowolski <janusz@iron.from.pl>
* David Luo <davidluo188@yahoo.com.cn>
extended for Chinese/Japanese/Korean support by Phil Daintree
*/

Uses of fonts in php

<?php
$type='Type1';
$name='Helvetica-Bold';
$desc=array('Ascent'=>718,'Descent'=>-207,'CapHeight'=>718,'Flags'=>32,'FontBBox'=>'[-170 -228 1003 962]','ItalicAngle'=>0,'StemV'=>140);
$up=-100;
$ut=50;
$cw=array(
chr(0)=>600,chr(1)=>600,chr(2)=>600,chr(3)=>600,chr(4)=>600,chr(5)=>600,chr(6)=>600,chr(7)=>600,chr(8)=>600,chr(9)=>600,chr(10)=>600,chr(11)=>600,chr(12)=>600,chr(13)=>600,chr(14)=>600,chr(15)=>600,chr(16)=>600,chr(17)=>600,chr(18)=>600,chr(19)=>600,chr(20)=>600,chr(21)=>600,
chr(22)=>600,chr(23)=>600,chr(24)=>600,chr(25)=>600,chr(26)=>600,chr(27)=>600,chr(28)=>600,chr(29)=>600,chr(30)=>600,chr(31)=>600,'

LogIn code in PHP

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<?php
session_start();
$UserName=$_POST['txtUser'];
$Password=$_POST['txtPass'];
$UserType=$_POST['cmbUser'];
if($UserType=="Administrator")
{

PHP code for Registration

<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="cs" lang="cs">
<head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <meta http-equiv="content-language" content="cs" />
    <meta name="robots" content="all,follow" />

    <meta name="author" content="All: ... [Nazev webu - www.url.cz]; e-mail: info@url.cz" />
    <meta name="copyright" content="Design/Code: Vit Dlouhy [Nuvio - www.nuvio.cz]; e-mail: vit.dlouhy@nuvio.cz" />
 

Connection code in PHP

<?php
# FileName="Connection_php_mysql.htm"
# Type="MYSQL"
# HTTP="true"
$hostname_name = "localhost";
$database_name = "name";
$username_name = "root";
$password = "";
$job = mysql_pconnect($hostname_name, $username_name, $password) or trigger_error(mysql_error(),E_USER_ERROR);
?>

PHP code To update


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>

Insert Code In PHP


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<?php

PHP Code To Edit

<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="cs" lang="cs">
<head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <meta http-equiv="content-language" content="cs" />
    <meta name="robots" content="all,follow" />

    <meta name="author" content="All: ... [Nazev webu - www.url.cz]; e-mail: info@url.cz" />
    <meta name="copyright" content="Design/Code: Vit Dlouhy [Nuvio - www.nuvio.cz]; e-mail: vit.dlouhy@nuvio.cz" />
 

Delet Data In PHP

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<?php

Monday, June 2, 2014

Master Page code in ASP.NET

<%@ Master Language="C#" AutoEventWireup="true" CodeFile="MainMaster.master.cs" Inherits="MainMaster" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
        <title>BlueWhale</title>
    <link rel="stylesheet" type="text/css" href="css/reset.css" media="screen" />
    <link rel="stylesheet" type="text/css" href="css/text.css" media="screen" />
    <link rel="stylesheet" type="text/css" href="css/grid.css" media="screen" />
    <link rel="stylesheet" type="text/css" href="css/layout.css" media="screen" />
    <link rel="stylesheet" type="text/css" href="css/nav.css" media="screen" />
    <!--[if IE 6]><link rel="stylesheet" type="text/css" href="css/ie6.css" media="screen" /><![endif]-->
    <!--[if IE 7]><link rel="stylesheet" type="text/css" href="css/ie.css" media="screen" /><![endif]-->
    <link rel="stylesheet" type="text/css" href="css/jquery.jqplot.min.css" />
    <asp:ContentPlaceHolder id="head" runat="server">
    </asp:ContentPlaceHolder>

Saturday, May 31, 2014

Sample code that change Background color On selection of color of own choice

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>HELLO WORLD:</title>
    <style type="text/css">
    h1
    {
        color:Blue;
        }
    h2
    {
        color:Red;
     
        }
    </style>

    <script type="text/javascript">

Code To display data in grid view from Database

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DALBlueWhale.Entities;
using System.Data;

public partial class ManageEmployees : System.Web.UI.Page
{
    Employee _employee;
    DataTable _table;
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)

        {
            LoadData();
        }
    }

Gridview Property In ASP.NET

<%@ Page Title="" Language="C#" MasterPageFile="~/MainMaster.master" AutoEventWireup="true" CodeFile="ManageEmployees.aspx.cs" Inherits="ManageEmployees" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <div class="box round first fullpage">

Database Entities Classes

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace DALBlueWhale.Entities
{
    public class Employee
    {
        DBWrapper _db;
        DataTable _table;

ASP.NET form to Add new Users

<%@ Page Title="BlueWhale | Add Employee" Language="C#" MasterPageFile="~/MainMaster.master" AutoEventWireup="true" CodeFile="AddEmployee.aspx.cs" Inherits="AddEmployee"%>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<asp:TextBox ID ="txtState" runat ="server" Visible="false" ViewStateMode="Enabled"></asp:TextBox>
<asp:TextBox ID ="txtEmpId" runat ="server" Visible="false" ViewStateMode="Enabled"></asp:TextBox>
  <div class="box round first fullpage">

DBWrapper Class In C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using System.Data;

namespace DALBlueWhale
{
    public class DBWrapper
    {
        ConnectionProvider _connProvider;
        SqlConnection _sqlConnection;
        SqlDataAdapter _da;

Code To Add New Users and Get Data fro drop down List

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using DALBlueWhale.Entities;
using System.Data.SqlClient;
using DALBlueWhale;

public partial class AddEmployee : System.Web.UI.Page
{
    Employee _employee;
    DataTable _dtDepartment , _dtDsignation;
    DataSet _ds;
    DBWrapper _dbwrapper;

Configuration Setting For Form Authentication In web.config file In Asp.net

<?xml version="1.0"?>
<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=169433
  -->
<configuration>
  <connectionStrings>

    <add name="ConnStr" connectionString="Data Source = inayat; Initial Catalog = HR; User ID=sa; Password=jan5562"/>
    <add name="xyz" connectionString="xyz"/>
  </connectionStrings>

LogIn Page Authentication In ASP.NET

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using DALBlueWhale.Entities;
using System.Data.SqlClient;
using DALBlueWhale;
using System.Web.Security;

Monday, March 10, 2014

Debug and trace in C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Diagnostics; // need this to use the Debug class

namespace DebugAndTrace
{
    class Program
    {
        static void Main(string[] args)
        {
            // create a path to the My Documents folder and the file name
            string filePath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) +
                                Path.DirectorySeparatorChar + "examplefile.txt";

Garbage collection in c#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace GarbageCollection
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Allocated memory is: {0}", GC.GetTotalMemory(false));
            Console.WriteLine();
            Console.ReadLine();

Variable Param in c#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace VariableParams
{
    class Program
    {
        static void Main(string[] args)
        {
            int result;

            result = addNumbers(4, 6, 8);
            Console.WriteLine("result is {0}", result);

            result = addNumbers(12, 20, 31, 5, 7, 9);
            Console.WriteLine("result is {0}", result);

            Console.ReadLine();
        }

        static int addNumbers(params int[] nums)
        {
            int total = 0;

            foreach (int x in nums)
            {
                total += x;
            }

            return total;
        }
    }
}

Using Events iN C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace UsingEvents
{
    public delegate void myEventHandler(string newValue);

    class EventExample
    {
        private string theValue;
        public event myEventHandler valueChanged;

        public string Val
        {
            set
            {
                this.theValue = value;
                this.valueChanged(theValue);
            }
        }
    }

    class Program
    {
        static void Main(string[] args)
        {
            EventExample myEvt = new EventExample();

            myEvt.valueChanged += new myEventHandler(myEvt_valueChanged);

            string str;
            do
            {
                str = Console.ReadLine();
                if (!str.Equals("exit"))
                    myEvt.Val = str;

            } while (!str.Equals("exit"));
        }

        static void myEvt_valueChanged(string newValue)
        {
            Console.WriteLine("The value changed to {0}", newValue);
        }
    }
}

Using Delegates in C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


namespace UsingDelegates
{
    public delegate int NumberFunction (int x);

    class Program
    {
        static void Main(string[] args)
        {
            NumberFunction f = Square;
            Console.WriteLine("result of the delegate is {0}", f(5));

            // now change the delgate
            f = Cube;
            Console.WriteLine("result of the delegate is {0}", f(5));

            Console.ReadLine();
        }

        static int Square(int num)
        {
            return num * num;
        }

        static int Cube(int num)
        {
            return num * num * num;
        }
    }
}

Namespaces and Optional Params iN C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace NamedOptionalParams
{
    class Program
    {
        static void Main(string[] args)
        {
            // call the Named parameters example
            myNamedParamExample(stateName: "Washington", zipCode: 98121, cityName: "Seattle");
            myNamedParamExample(cityName: "San Francisco", zipCode: 94109, stateName: "California");
            myNamedParamExample(zipCode: 94109, cityName: "New York", stateName: "New York");

            // call the Optional parameters example
            myOptionalParamFunc(15);
            myOptionalParamFunc(10, 2.71828d);
            myOptionalParamFunc(10, 2.71828d, "a different string");
            // myOptionalParamFunc(10, "a different string");

            // Now do both
            myOptionalParamFunc(10, param3: "named and optional in same call!");

            Console.ReadLine();
        }

        static void myOptionalParamFunc(int param1, double param2 = 3.14159d, string param3 = "placeholder string")
        {
            Console.WriteLine("Called with: \n\tparam1 {0}, \n\tparam2 {1}, \n\tparam3 {2}",param1, param2, param3);
        }

        static void myNamedParamExample(string cityName, string stateName, int zipCode)
        {
            Console.WriteLine("Arguments passed: \n\tcityName is {0}, \n\tstateName is {1}, \n\tzipCode is {2}",
                        cityName, stateName, zipCode);
        }
    }
}

Functions Param Modifiers in C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace FuncParamModifiers
{
    class Program
    {
        static void SquareAndRoot(double num, out double sq, out double sqrt)
        {
            sq = num * num;
            sqrt = Math.Sqrt(num);
        }

        static void Main(string[] args)
        {
            double n = 9.0;
            double theSquare, theRoot;

            SquareAndRoot(n, out theSquare, out theRoot);
            Console.WriteLine("The square of {0} is {1} and its square root is {2}", n, theSquare, theRoot);
           
            Console.ReadLine();
        }
    }
}

ReadingWritingData

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace ReadingWritingData
{
    class Program
    {
        static void Main(string[] args)
        {
            // create a path to the My Documents folder and the file name
            string filePath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) +
                                Path.DirectorySeparatorChar + "examplefile.txt";

            // if the file doesn't exist, create it by using WriteAllText
            if (!File.Exists(filePath))
            {
                string content = "This is a text file." + Environment.NewLine;
                Console.WriteLine("Creating the file...");
                File.WriteAllText(filePath, content);
            }

            // Use the AppendAllText method to add text to the content
            string addedText = "Text added to the file" + Environment.NewLine;
            Console.WriteLine("Adding content to the file...");
            File.AppendAllText(filePath, addedText);
            Console.WriteLine();

            // Read the contents of the file
            Console.WriteLine("The current contents of the file are:");
            Console.WriteLine("-------------------------------------");

            // Read the contents of the file using ReadAllText
            string currentContent = File.ReadAllText(filePath);
            Console.Write(currentContent);
            Console.WriteLine();

            // Read the contents of the file using ReadAllLines
            /*
            string[] contents = File.ReadAllLines(filePath);
            foreach (string s in contents)
            {
                Console.WriteLine(s);
            }
            Console.WriteLine();
            */

            Console.ReadLine();
        }
    }
}

PathOperations

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO; // need this for file and directory information

namespace PathOperations
{
    class Program
    {
        static void Main(string[] args)
        {
            // get the path to the documents folder from the Environment class
            string thePath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
            thePath += @"\testfile.txt";

            // Exercise the Path class methods
            Console.WriteLine("The directory name is {0}", Path.GetDirectoryName(thePath));
            Console.WriteLine("The file name is {0}", Path.GetFileName(thePath));
            Console.WriteLine("File name without extension is {0}", Path.GetFileNameWithoutExtension(thePath));
            Console.WriteLine("Random file name for path is {0}", Path.GetRandomFileName());
        }
    }
}

namespace ExistingDir

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO; // need this namespace to work with files and directories

namespace ExistingDir
{
    class Program
    {
        static void Main(string[] args)
        {
            string thePath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);

            // Check to see if a directory exists
            bool dirExists = Directory.Exists(thePath);
            if (dirExists)
                Console.WriteLine("The directory exists.");
            else
                Console.WriteLine("The directory does not exist.");
            Console.WriteLine();

            // Write out the names of the files in the directory
            string[] files = Directory.GetFiles(thePath);
            foreach (string s in files)
            {
                Console.WriteLine("Found file: " + s);
            }
            Console.WriteLine();

            // Get information about each fixed disk drive
            Console.WriteLine("Drive Information:");
            foreach (DriveInfo d in DriveInfo.GetDrives())
            {
                if (d.DriveType == DriveType.Fixed)
                {
                    Console.WriteLine("Drive Name: {0}", d.Name);
                    Console.WriteLine("Free Space: {0}", d.TotalFreeSpace);
                    Console.WriteLine("Drive Type: {0}", d.DriveType);
                    Console.WriteLine();
                }
            }

            Console.ReadLine();
        }
    }
}

namespace Existing

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO; // we need to add this reference to use Files and Directory information

namespace Existing
{
    class Program
    {
        static void Main(string[] args)
        {
            bool fileExists = false;
            string thePath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
            string theFile = thePath + @"\testfile.txt";

            fileExists = File.Exists(theFile);

            if (fileExists)
            {
                Console.WriteLine("The file exists");
            }
            else
            {
                Console.WriteLine("The file does not exist, creating it");
                File.Create(theFile);
            }

            if (fileExists)
            {
                Console.WriteLine("It was created on {0}", File.GetCreationTime(theFile));
                Console.WriteLine("It was last accessed on {0}", File.GetLastAccessTime(theFile));

                Console.WriteLine("Moving the file...");
                File.Move(theFile, thePath + @"\newfile.txt");
            }

            Console.ReadLine();
        }
    }
}

Wednesday, February 12, 2014

Using Exceptions In C#

RethrowingExceptions in C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace RethrowingExceptions
{
    class Program
    {
        static void DoSomeMath()
        {
            int x = 10, y = 0;
            int result;

            try
            {
                result = x / y;
                Console.WriteLine("Result is {0}", result);
            }
            catch
            {
                Console.WriteLine("Error in DoSomeMath()");
                throw new ArithmeticException();
            }
        }

        static void Main(string[] args)
        {
            try
            {
                DoSomeMath();
            }
            catch (ArithmeticException e)
            {
                Console.WriteLine("Hmm, there was an error in there, be careful!");
            }

            Console.ReadLine();
        }
    }
}

Exception Objects In C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ExceptionObject
{
    class Program
    {
        static void Main(string[] args)
        {
            int x = 10;
            int y = 0;
            int result;

            try
            {
                result = x / y;
                Console.WriteLine("The result is: {0}", result);
            }
            catch (System.DivideByZeroException e)
            {
                Console.WriteLine("Whoops! You tried to divide by zero!");
                Console.WriteLine(e.Message);
            }
            finally
            {
                Console.WriteLine("Just proving that this code always runs.");
            }

            Console.ReadLine();
        }
    }
}

Custome Exceptions iN C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CustomExceptions
{
    public class NoJoesException : Exception
    {
        public NoJoesException() : base("We don't allow no Joes in here!")
        {
            this.HelpLink = "http://www.joemarini.com/";
        }
    }

    class Program
    {
        static string GetName()
        {
            string s = Console.ReadLine();
            if (s.Equals("Joe"))
                throw new NoJoesException();

            return s;
        }

        static void Main(string[] args)
        {
            string theName;

            try
            {
                theName = GetName();
                Console.WriteLine("Hello {0}", theName);
            }
            catch (NoJoesException nje)
            {
                Console.WriteLine(nje.Message);
                Console.WriteLine("For help, visit: {0}", nje.HelpLink);
            }
            finally
            {
                Console.WriteLine("Have a nice day!");
            }

            Console.ReadLine();
        }
    }
}

Using Struct inC#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace UsingStructs
{
    public struct Point
    {
        private int xCoord;
        private int yCoord;

        public Point(int x, int y)
        {
            xCoord = x;
            yCoord = y;
        }

        public int x
        {
            get { return xCoord; }
            set { xCoord = value; }
        }

        public int y
        {
            get { return xCoord; }
            set { xCoord = value; }
        }
    }

    class Program
    {
        static void Main(string[] args)
        {
        }
    }
}

Using Interfaces In C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace UsingInterfaces
{
    interface ITalkative
    {
        void SayHello();
        void SayGoodBye();
    }

    class myExampleClass : ITalkative
    {
        public myExampleClass()
        {
        }

        public void SayHello()
        {
            Console.WriteLine("Saying hello!");
        }

        public void SayGoodBye()
        {
            Console.WriteLine("Saying goodbye!");
        }
    }

    class Program
    {
        static void Main(string[] args)
        {
            myExampleClass myEC = new myExampleClass();

            myEC.SayHello();
            myEC.SayGoodBye();

            Console.ReadLine();
        }
    }
}

Sealed Classes Representation In C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SealedClasses
{
    class myExampleClass
    {
        public static string myMethod(int arg1)
        {
            return String.Format("You sent me the number {0}", arg1);
        }
    }

    class mySubClass : myExampleClass
    {
    }

    class Program
    {
        static void Main(string[] args)
        {
        }
    }
}

Method Overriding In C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MethodOverriding
{
    class baseClass
    {
        public virtual void doSomething()
        {
            Console.WriteLine("This is the baseClass saying hi!");
        }
    }

    class subClass : baseClass
    {
        public override void doSomething()
        {
            base.doSomething();
            Console.WriteLine("This is the subClass saying hi!");
        }
    }

    class Program
    {
        static void Main(string[] args)
        {
            baseClass obj1 = new subClass();

            obj1.doSomething();

            Console.ReadLine();
        }
    }
}

Method Overloading In C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MethodOverloading
{
    class Wine
    {
        public int Year;
        public string Name;
        public decimal price;

        public Wine(string s)
        {
            Name = s;
        }
        public Wine(string s, int y)
        {
            Name = s;
            Year = y;
        }
        public Wine(string s, decimal p, int y)
        {
            Name = s;
            price = p;
            Year = y;
        }
    }

    class Program
    {
        static void Main(string[] args)
        {
            Wine w1 = new Wine("Charles Shaw Merlot");
            Wine w2 = new Wine("Mark Ryan Dissident", 2004);
            Wine w3 = new Wine("Dom Perignon", 120.00m, 1994);

            Console.WriteLine("{0}", w1.Name);
            Console.WriteLine("{0} {1}", w2.Year, w2.Name);
            Console.WriteLine("{0} {1} {2}", w3.Year, w3.Name, w3.price);

            Console.ReadLine();
        }
    }
}

Abstract classes in C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AbstractClasses
{
    abstract class myBaseClass
    {
       public abstract int myMethod(int arg1, int arg2);
    }

    class myDerivedClass : myBaseClass
    {
        public override int myMethod(int arg1, int arg2)
        {
            return arg1 + arg2;
        }
    }

    class Program
    {
        static void Main(string[] args)
        {
        }
    }
}

Stack In C#(How it works)

using System;
using System.Collections; // we need to add this reference to use Files and Directory information
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Stacks
{
    class Program
    {
        static void Main(string[] args)
        {
            Stack myStack = new Stack();

            myStack.Push("item 1");
            myStack.Push("item 2");
            myStack.Push("item 3");
            Console.WriteLine("{0} Items on the stack", myStack.Count);

            // Have a peek at the top item
            Console.WriteLine("{0}", myStack.Peek());

            myStack.Pop(); // pops "item 3" off the top
            // now "item 2" is the top item
            Console.WriteLine("{0}", myStack.Peek());

            myStack.Clear(); // get rid of everything
            Console.WriteLine("{0} Items on the stack", myStack.Count);

            Console.ReadLine();
        }
    }
}

Tuesday, February 4, 2014

Ques in C#

using System;
using System.Collections; // we need to add this reference to use Files and Directory information
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Queues
{
    class Program
    {
        static void Main(string[] args)
        {
            Queue myQ = new Queue();

            myQ.Enqueue("item 1");
            myQ.Enqueue("item 2");
            myQ.Enqueue("item 3");
            myQ.Enqueue("item 4");

            Console.WriteLine("There are {0} items in the Queue", myQ.Count);

            while (myQ.Count > 0)
            {
                string str = (string)myQ.Dequeue();
                Console.WriteLine("Dequeueing object {0}", str);
            }

            Console.ReadLine();
        }
    }
}

Array List In C#

using System;
using System.Collections; // we need to add this reference to use Files and Directory information
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ArrayLists
{
    class Program
    {
        static void Main(string[] args)
        {
            ArrayList myAL = new ArrayList();
            myAL.Add("one");
            myAL.Add(2);
            myAL.Add("three");
            myAL.Add(4);
            myAL.Insert(0, 1.25f);

            foreach (object o in myAL)
            {
                if (o is int)
                    Console.WriteLine("{0}", o);
            }
            Console.ReadLine();
        }
    }
}

Value And Reference Types in C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ValAndRefTypes
{
    public class Point
    {
        public int x;
        public int y;
    }

    class Program
    {
        static void testFunc1(int arg1)
        {
            arg1 += 10;
            Console.WriteLine("arg1 is {0}", arg1);
        }

        static void testFunc2(Point pt)
        {
            Console.WriteLine("pt.x is {0}", pt.x);
            pt.x += 10;
            Console.WriteLine("pt.x is {0}", pt.x);
        }

        static void Main(string[] args)
        {
            var i = 10;

            testFunc1(i);
            Console.WriteLine("i is {0}", i);
            Console.WriteLine();

            Point p = new Point();
            p.x = 10;
            p.y = 10;
            Console.WriteLine("p.x is {0}", p.x);
            testFunc2(p);
            Console.WriteLine("p.x is {0}", p.x);

            Console.ReadLine();
        }
    }
}

Defining properties in C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DefiningProperties
{
    class Wine
    {
        private string Name;
        private int year;
        private string Apellation;
        private decimal wholesalePrice;
        private const decimal retailMarkup = 1.35m;

        public decimal Price
        {
            get
            {
                return wholesalePrice * retailMarkup;
            }
            set
            {
                wholesalePrice = value;
            }
        }

        public string MenuDescription
        {
            // only a getter for this property, which is generated from private fields
            get { return year.ToString() + " " + Name + ", " + Apellation; }
        }

        public Wine(int y, string sName, string sApp, decimal wp)
        {
            Name = sName;
            year = y;
            Apellation = sApp;
            wholesalePrice = wp;
        }
    }

    class Program
    {
        static void Main(string[] args)
        {
            // Create some new Wine objects
            Wine w1 = new Wine(2003, "Chateau Ste. Michelle Merlot", "Seven Hills", 23.50m);
            Wine w2 = new Wine(2005, "Mark Ryan Dissident", "Ciel du Cheval", 40.00m);

            // Write out the property values
            // Note that in these cases we are using the property getters
            Console.WriteLine("Wine 1: {0}, {1}", w1.MenuDescription, w1.Price);
            Console.WriteLine("Wine 2: {0}, {1}", w2.MenuDescription, w2.Price);
            Console.WriteLine();

            // change the wholesale price of one of the wines using the setter
            w2.Price = 45.0m;

            // write out the wine description, note how the retail price automatically changes
            Console.WriteLine("Wine 2: {0}, {1}", w2.MenuDescription, w2.Price);

            Console.ReadLine();
        }
    }
}

Defining Class Cont.......

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DefiningAClass
{
    class MyClass
    {
        int myInteger;
        string myMessage;

        void myFunction()
        {
            Console.WriteLine("In my function");
        }

        public MyClass() {
            myInteger = 0;
            myMessage = "";
        }
    }
}

Defining Class In C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DefiningAClass
{
    class MyClass
    {
        int myInteger;
        string myMessage;
        public static int myStaticInt = 100;

        public int myFunction()
        {
            return myInteger;
        }

        public MyClass()
        {
            myInteger = 50;
            myMessage = "This is a string";
        }
    }

    class Program
    {
        static void Main(string[] args)
        {
            MyClass myC = new MyClass();

            Console.WriteLine("Calling myFunction: {0}", myC.myFunction());
            Console.WriteLine("Using a static member: {0}", MyClass.myStaticInt);

            Console.ReadLine();
        }
    }
}

Variable scope

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace VariableScope
{
    class Program
    {
        static void Main(string[] args)
        {
           
            for (int i = 0; i < 10; i++)
            {
                int var1 = 20;
                Console.WriteLine("The value of var1 at pass {0} is {1} ", i, var1);
            }

            //Console.WriteLine("{0}", var1);
           
            Console.ReadLine();
        }
    }
}

Loops In C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Loops
{
    class Program
    {
        static void Main(string[] args)
        {
            int myVal = 15;

            // basic while loop
            Console.WriteLine("Basic while() loop:");
            while (myVal < 20) {
                Console.WriteLine("myVal is currently {0}", myVal);
                // careful! Always make sure that the loop has some way to exit
                // or you'll end up with an Infinite Loop!
                myVal += 3;
            }
            Console.WriteLine();

            // the do-while loop
            Console.WriteLine("The  do-while() loop:");
            do
            {
                Console.WriteLine("myVal is currently {0}", myVal);
                myVal += 3;
            } while (myVal < 20);
            Console.WriteLine();

            // the for loop
            Console.WriteLine("The for loop:");
            for (int i = 0; i < myVal; i += 5)
            {
                Console.WriteLine("i is currently {0}", i);
            }
            Console.WriteLine();

            // using the continue and break keywords
            Console.WriteLine("Using break and continue :");
            for (int i = 0; i < 10; i++)
            {
                if (i == 5)
                    continue; // skip the rest of the loop

                if (i == 9)
                    break;

                Console.WriteLine("i is currently {0}", i);
            }

            Console.ReadLine();
        }
    }
}

Function And Methods

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace FuncsAndMethods
{
    class Program
    {
        static void Main(string[] args)
        {
            int result1;

            result1 = formula(14);
            Console.WriteLine("The result is: {0}", result1);

            Console.ReadLine();
        }

        static int formula(int theVal)
        {
            return (theVal * 2) / 3 + 15;
        }
    }
}

TypeCasting in C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TypeCasting
{
    class Program
    {
        static void Main(string[] args)
        {
            Program objProg = new Program();
            objProg.MyMethod("I am Inayat");

            Console.ReadKey();
         



   
        }
        void MyMethod(object obj)
        {
            if (obj is int)
            {

                Console.WriteLine("this is a int");
            }

            else if (obj is string)
            {
                Console.WriteLine("this is a string");

            }


        }
       


    }

}

Usin loops and printin Shape

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SwitchStatmnt
{
    class Program
    {
        static void Main(string[] args)
        {

            for (int i= 1;i <= 10; i++)
            {
                for (int j = 1; j<=i; j++)
                {

                    Console.Write("*");

               
               
                }
                Console.WriteLine("");




            }
            for (int i = 1; i <= 10; i++)
            {
                for (int j = i; j <= 10; j++)
                {

                    Console.Write("*");



                }
                Console.WriteLine("");




            }



            Console.ReadKey();


        }
   
         



            }
        }
   

Rectangleapplication: it returns the lenght and width

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Rectangleapplication
{
    class Rectangle
    {
        double length;
        double width;
        public void AcceptDetails()
        {
            length = 4.6;
            width = 3.8;
        }
        public double GetArea()
        {
            return width * length;
        }
        public void DisPlay()
        {
            Console.WriteLine("length: {0}", length);
            Console.WriteLine("Width : {0}", width);
            Console.WriteLine("Area:{0}", GetArea());
        }
    }

    class ExcuteTactangle
    {
        static void Main(string[] args)
        {
           Rectangle p = new Rectangle();
            p.AcceptDetails();
            p.DisPlay();
            p.GetArea();
            Console.ReadLine();


        }
    }
}

Is Operator in C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace IsOperatorSample
{
    public class Animal
    {
    }

    public class Vehicle
    {
    }

    public class Car : Vehicle
    {
    }

    class Program
    {
        static void Main(string[] args)
        {
            Vehicle v = new Vehicle();
            Animal a = new Animal();
            Car c = new Car();

            if (c is Vehicle)
            {
                Vehicle newV = (Vehicle)c;
                Console.WriteLine(c.ToString() + " is a Vehicle. ");
            }
            else
            {
                Console.WriteLine(c.ToString() + " is NOT a Vehicle. ");
            }


         
         
     

            Console.ReadLine();
        }
    }
}

ExplicitConversion

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ExplicitConversion
{
    class Program
    {
        static void Main(string[] args)
        {
            double d = 656.67;
            int i;

            i = (int)d;
            Console.WriteLine(i);
            Console.ReadKey();
        }
    }
}

DoubleVsDecimal in C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DoubleVsDecimal
{
    class Program
    {
        static void Main(string[] args)
        {

            float fnum1 = 2.6f;
            float fnum2 = 4.0f;
            Console.WriteLine("{0}" , fnum2/fnum1);

            double istnum = 2.6d;
            double secndnum = 4.0d;

            Console.WriteLine("{0}" , secndnum / istnum);
            decimal  num1 = 2.6m;
            decimal num2 = 2.9m;
            Console.WriteLine("{0}" , num2 / num1 );
           
           
            Console.ReadKey();


        }
    }
}

Const And Enums in C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConstAndEnum
{
    public enum weekdays
    {
        sunday,
        monday
   
    }

    // demonstrates how to use the enum

    class Program
    {
        static void Main()
        {
            // create and initialize
            // instance of enum type
            //Volume myVolume = Volume.High;
            weekdays wK = weekdays.monday;

            // make decision based
            // on enum value
            switch (wK)
            {
                case weekdays.sunday:
                    Console.WriteLine("the day isa sunday.");
                    break;
                case weekdays.monday:
                    Console.WriteLine("The day is monday.");
                    break;
               
            }
            Console.ReadLine();
        }
    }
}

ArthematicOperators in C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ArthematicOperators
{
    class Program
    {
        static void Main(string[] args)
        {
            int num1, num2;
            int add, sub, mul;
            float div;

            //Accepting Values from users
            Console.Write("Enter first number\t\t");
            num1 = Convert.ToInt32(Console.ReadLine());

            Console.Write("\n\nEnter second number\t\t");
            num2 = Convert.ToInt32(Console.ReadLine());

            //Processing Values
            //Used + operator for adding values
            add = num1 + num2;
            //Used - operator for subtracting values
            sub = num1 - num2;
            //Used * operator for multiplying values
            mul = num1 * num2;
            //Used / operator for dividing values
            div = (float)num1 / num2;

            //Displaying Output
            Console.WriteLine("\n\n=====================\n");
            Console.WriteLine("Addition\t\t{0}", add);
            Console.WriteLine("Subtraction\t\t{0}", sub);
            Console.WriteLine("Multiplication\t\t{0}", mul);
            Console.WriteLine("Division\t\t{0}", div);
            Console.WriteLine("\n=======================\n");

            Console.ReadLine();
        }
    }
}

Multiple Cases. Falling Through!

<html>
<head>
<title></title>
</head>
<body>
    <?php
    $i = 5;
   
    switch ($i) {
        case 0:
            echo '$i is 0.';
            break;
        case 1:
        case 2:
        case 3:
        case 4:
        case 5:
            echo '$i is somewhere between 1 and 5.';
            break;
        case 6:
        case 7:
            echo '$i is either 6 or 7.';
            break;
        default:
            echo "I don't know how much \$i is.";
    }
    ?>
    </body>
</html>

Monday, January 13, 2014

PHP code To make Gallery

<?php
# SETTINGS
$max_width = 100;
$max_height = 100;

function getPictureType($ext) {
if ( preg_match('/jpg|jpeg/i', $ext) ) {
return 'jpg';
} else if ( preg_match('/png/i', $ext) ) {
return 'png';
} else if ( preg_match('/gif/i', $ext) ) {
return 'gif';
} else {
return '';
}
}

function getPictures() {
global $max_width, $max_height;
if ( $handle = opendir(".") ) {
$lightbox = rand();
echo '<ul id="pictures">';
while ( ($file = readdir($handle)) !== false ) {
if ( !is_dir($file) ) {
$split = explode('.', $file);
$ext = $split[count($split) - 1];
if ( ($type = getPictureType($ext)) == '' ) {
continue;
}
if ( ! is_dir('thumbs') ) {
mkdir('thumbs');
}
if ( ! file_exists('thumbs/'.$file) ) {
if ( $type == 'jpg' ) {
$src = imagecreatefromjpeg($file);
} else if ( $type == 'png' ) {
$src = imagecreatefrompng($file);
} else if ( $type == 'gif' ) {
$src = imagecreatefromgif($file);
}
if ( ($oldW = imagesx($src)) < ($oldH = imagesy($src)) ) {
$newW = $oldW * ($max_width / $oldH);
$newH = $max_height;
} else {
$newW = $max_width;
$newH = $oldH * ($max_height / $oldW);
}
$new = imagecreatetruecolor($newW, $newH);
imagecopyresampled($new, $src, 0, 0, 0, 0, $newW, $newH, $oldW, $oldH);
if ( $type == 'jpg' ) {
imagejpeg($new, 'thumbs/'.$file);
} else if ( $type == 'png' ) {
imagepng($new, 'thumbs/'.$file);
} else if ( $type == 'gif' ) {
imagegif($new, 'thumbs/'.$file);
}
imagedestroy($new);
imagedestroy($src);
}
echo '<li><a href="'.$file.'" rel="lightbox['.$lightbox.']">';
echo '<img src="thumbs/'.$file.'" alt="" />';
echo '</a></li>';
}
}
echo '</ul>';
}
}
?>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=UFT-8" />
<title>Pictures</title>
<link rel="stylesheet" href="css/lightbox.css" type="text/css" media="screen" />
<style type="text/css">
#pictures li {
float:left;
height:<?php echo ($max_height + 10); ?>px;
list-style:none outside;
width:<?php echo ($max_width + 10); ?>px;
text-align:center;
}
img {
border:0;
outline:none;
}
</style>
</head>
<body>

<?php getPictures(); ?>


<script type="text/javascript" src="js/prototype.js"></script>
<script type="text/javascript" src="js/scriptaculous.js?load=effects,builder"></script>
<script type="text/javascript" src="js/lightbox.js"></script>
</body>
</html>

Php Code For Payment Process

<?php session_start() ?>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>tameraplazainn</title>
<link href="css/main.css" rel="stylesheet" type="text/css" />
<?php
$errmsg_arr = array();

$errflag = false;
if(empty($_SESSION['6_letters_code'] ) ||
 strcmp($_SESSION['6_letters_code'], $_POST['6_letters_code']) != 0)
{
//Note: the captcha code is compared case insensitively.
//if you want case sensitive match, update the check above to
// strcmp()
$errmsg_arr[] = 'invalid code';
$errflag = true;
}
if($errflag) {
$_SESSION['ERRMSG_ARR'] = $errmsg_arr;

session_write_close();
header("location: personnalinfo.php");
exit();
}
?>
<?php
if (!isset($_POST['submit'])) {




$errmsg_arr = array();

$errflag = false;

$con = mysql_connect("localhost","root","");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("argie_tamera", $con);

function createRandomPassword() {



    $chars = "abcdefghijkmnopqrstuvwxyz023456789";

    srand((double)microtime()*1000000);

    $i = 0;

    $pass = '' ;



    while ($i <= 7) {

        $num = rand() % 33;

        $tmp = substr($chars, $num, 1);

        $pass = $pass . $tmp;

        $i++;

    }



    return $pass;



}
$confirmation = createRandomPassword();
$arival = $_POST['start'];
$departure = $_POST['end'];
$adults = $_POST['adult'];
$child = $_POST['child'];
$nroom = $_POST['n_room'];
$roomid = $_POST['rm_id'];
$result = $_POST['result'];
$name = $_POST['name'];
$last = $_POST['last'];
$address = $_POST['address'];
$city = $_POST['city'];
$zip = $_POST['zip'];
$country = $_POST['country'];
$password = $_POST['password'];
$email = $_POST['email'];
$cnumber = $_POST['cnumber'];
$stat= 'Active';
$result1 = mysql_query("SELECT * FROM room where room_id='$roomid'");
while($row = mysql_fetch_array($result1))
  {
  $rate=$row['rate'];
  $type=$row['type'];
 
  }
  $payable= $rate*$result*$nroom;



//send the email
$to = $email;
$subject="Reservation notification From Tamera Plaza Inn";
$from = 'tameraplazainn@gmail.com';
$body = "First Name: $name\n".
"Last Name: $last\n".
"Email: $email \n".
"City: $city \n".
"Zip Code: $zip \n".
"Country: $country \n".
"Contact Number: $cnumber \n".
"Password: $password \n".
"Check In: $arival\n ".
"Check Out: $departure\n ".
"Number of Adults: $adults\n ".
"Number of child: $child\n ".
"Total nights of stay: $result\n ".
"Room Type: $type\n ".
"Number of rooms: $nroom\n ".
"Payable amount: $payable\n ".
"Confirmation Number: $confirmation\n ";

$headers = "From: $from \r\n";
$headers .= "Reply-To: $$from \r\n";

mail($to, $subject, $body,$headers);

$sql="INSERT INTO reservation (arrival, departure, adults, child, result, room_id, no_room, firstname, lastname, city, zip, province, country, email, contact, password, payable, confirmation)
VALUES
('$arival','$departure','$adults','$child','$result','$roomid','$nroom','$name','$last','$city','$zip','$address','$country','$email','$cnumber','$password','$payable','$confirmation')";
mysql_query("INSERT INTO roominventory (arrival, departure, qty_reserve, room_id, confirmation, status) VALUES ('$arival','$departure','$nroom','$roomid','$confirmation','$stat')");
if (!mysql_query($sql,$con))
  {
  die('Error: ' . mysql_error());
  }

}
mysql_close($con)



?>
</head>

<body>
<div class="mainwrapper">
  <div class="leftother">
    <div class="l"></div>
<div class="r">




<div class="right3">
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr"  method="post">
        <!-- the cmd parameter is set to _xclick for a Buy Now button -->
       
<div class="reservation" style="margin-left: 176px; width: 400px;">
 <div align="center" style="padding-top: 7px; font-size:24px;"><strong>RESERVATION  DETAILS</strong></div>
<div style="margin-top: 14px;">
<label style="margin-left: 73px;">Check In Date : <?php echo $arival; ?></label><br />
<label style="margin-left: 58px;">Check Out Date : <?php echo $departure; ?></label><br />
<label style="margin-left: 130px;">Adults : <?php echo $adults; ?></label><br />
<label style="margin-left: 137px;">Child : <?php echo $child; ?></label><br />
<label style="margin-left: 42px;">Number of Rooms : <?php echo $nroom; ?></label><br />
<label style="margin-left: 110px;">Room ID : <?php echo $roomid; ?></label><br />
<label style="margin-left: 52px;">Number of nights : <?php echo $result; ?></label><br />
<label style="margin-left: 101px;">Firstname : <?php echo $name; ?></label><br />
<label style="margin-left: 102px;">Lastname : <?php echo $last; ?></label><br />
<label style="margin-left: 114px;">Address : <?php echo $address; ?></label><br />
<label style="margin-left: 146px;">City : <?php echo $city; ?></label><br />
<label style="margin-left: 108px;">ZIP Code : <?php echo $zip; ?></label><br />
<label style="margin-left: 117px;">Country : <?php echo $country; ?></label><br />
<label style="margin-left: 133px;">Email : <?php echo $email; ?></label><br />
<label style="margin-left: 56px;">Contact Number : <?php echo $cnumber; ?></label><br />      <BR />
  </div>

<input type="hidden" name="cmd" value="_xclick" />
        <input type="hidden" name="business" value="jpabs78@gmail.com" />
        <input type="hidden" name="item_name" value="<?php echo $type; ?>" />
        <input type="hidden" name="item_number" value="<?php echo $nroom; ?>" />
        <input type="hidden" name="amount" value="<?php echo $payable; ?>" />
        <input type="hidden" name="no_shipping" value="1" />
        <input type="hidden" name="no_note" value="1" />
        <input type="hidden" name="currency_code" value="PHP" />
        <input type="hidden" name="lc" value="GB" />
        <input type="hidden" name="bn" value="PP-BuyNowBF" />
        <input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-but23.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!" style="margin-left: 157px;" />
        <img alt="fdff" border="0" src="https://www.paypal.com/en_GB/i/scr/pixel.gif" width="1" height="1" />
        <!-- Payment confirmed -->
        <input type="hidden" name="return" value="https://www.chmscians.com/paypal/showconfirm.php" />
        <!-- Payment cancelled -->
        <input type="hidden" name="cancel_return" value="http://www.chmscians.com/paypal/cancel.php" />
        <input type="hidden" name="rm" value="2" />
        <input type="hidden" name="notify_url" value="http://www.chmscians.com/paypal/ipn.php" />
        <input type="hidden" name="custom" value="any other custom field you want to pass" />
      </form>
</div>
</div>









</div>
  </div>
 
 
 
 
 
 
  <div class="rightother">
 
 
 
 
  </div>
 
 
 
 
 
 
</div>




</body>
</html>