Haiku OS Israel Arab

PHP for ASP programmers

Bookmark and Share

If you know ASP and want to know the PHP equivalent commands than this should prove useful. You can either scan the page manually are use the search function (Ctrl+f) of your browser to find what you are looking for.
PLEASE HELP by updating this page. Simply click 'Add New Row' to add new function or click to edit an existing row.
To contact me, email me at adinaronson-at-hotmail-dot-com.

Please Make sure the command doesn't already exist
Edit
Delete
What ASP.NET / VB.NET ASP / VB JSP / JAVA PHP

Includess  Look up Web User Controls (*.ascx); 
or 
<!-- #include file="PageToInclude.aspx" 
<!--#INCLUDE file="PageToInclude.asp"-->
or
<!--#INCLUDE virtual="PageToInclude.asp"-->
or
<%server.execute("PageToInclude.asp")%> 
<%@ include file="PageToInclude.jsp"%>
or
<%@ include file="PageToInclude.html"%> 
<? include ("PageToInclude.php");?>
or
<? require ("PageToInclude.php");?>
or
<? include_once ("PageToInclude.php");?>
or
<? require_once ("PageToInclude.php");?> 

Buffer page content before sending  <%Response.Buffer = true%>  <%Response.Buffer = true%>  <%@ page buffer="8kb" %>  <? php ob_start(); ?> 

Set page timeout  Current.Server.ScriptTimeout(1000)  <%Server.ScriptTimeout(1000) %>  <? set_time_limit(1000); ?>  

Create ADODB connection object  "not relevant" /yea  Set objConn = server.CreateObject("ADODB.Connection")  $objConn = new COM("ADODB.Connection") or die("Cannot start ADO"); 
Edit
Delete
What ASP.NET / VB.NET ASP / VB JSP / JAVA PHP

print text to output  response.write "blah blah"
to use response.write

Function print(ByVal txt)
  Response.Write(txt)
End Function 
response.write "blah blah" also
<%= "Blah blah" %> 
out.println("xxx");
also
<%="xxx"%> 
echo "blah blah"; 
also 
print "blah blah"; 
also 
<?= "jomama" ?> also print_r($arrArray); 

stop processing  response.end

Function die(Optional ByVal txt = "")
  Response.Write(txt)
  Response.End()
End Function 
Response.End
wscript.Quit (WSH) 
out.close();
return; 
// just exit
exit;

// or
die();

// print message, then exit
die("Why?"); 

Using Session level variable  Session.Add and
Session.Get 
Session("SessionVarName") = varName
varName = Session("SessionVarName") 
session.setAttribute("SessionVarName",varName);
varName = session.getAttribute("SessionVarName") 
$_SESSION["SessionVarName"] = $varName;
$varName = $_SESSION["SessionVarName"];

// $_SESSION is simply an array that holds session values. 

Redirect to new page  Response.Redirect("http://www.yahoo.com/")  Response.Redirect("http://www.yahoo.com")
Response.Redirect("mypage.asp")

Server.Transfer("mypage.asp") '(serverside redirect) 
response.sendRedirect("www.yahoo.com");  die(header("Location: http://www.yahoo.com/"));

Make sure to place any header() statements like
this one above every other echo/print or HTML.
Not even whitespace may occur before usage of
header(). If you really need to use
echo/print/HTML before header(), put 'ob_start();'
at the top of the page BEFORE any whitespace. 

Encode text to URL safe text  System.Web.HttpUtility.UrlEncode(userinput)  Server.urlencode(userinput)
There are also the escape and unescape commands 
java.net.URLEncoder.encode(userinput);
In Javascript see escape/unescape commands 
urlencode($userinput);  
Edit
Delete
What ASP.NET / VB.NET ASP / VB JSP / JAVA PHP

Encode text to HTML safe text  HttpUtility.HtmlEncode("The image tag: <img>")   Server.HTMLEncode("The image tag: <img>")   java.net.URLDecoder.decode("The image tag: <img>");  htmlentities("The image tag: <img>");  

Set content type  Response.ContentType  <% Response.ContentType = "text/html" %>   <%@ page contentType="text/html" %>  <? header("Content-type: text/html"); ?>  

Get value from POST/GET  Request.Form("{your param name}") for POST 
Request.QueryString("{your param name}") for GET

Request!{your param name} for both
Request("{your param name}") for both 
'POST
Request.form("ID")
'GET (URL STRING VARIABLES)
Request.querystring("ID") 
request.getParameter("myVar")  $_POST["here_the_form_element_name"];
$_GET["here_the_form_element_name"];

// if you want to get all get and post variables automatically as normal variables use:
if(!empty($_POST)) while(list($name, $value) = each($_POST)) $$name = addslashes($value);
if(!empty($_GET)) while(list($name, $value) = each($_GET)) $$name = addslashes($value);
 

Get physical path to a file  Server.MapPath("../../index.aspx")  server.MapPath("../../index.asp")  request.getRealPath("index.jsp")  realpath("../../index.php");
dirname("../../index.php"); 

Is value a number  isNumeric(MyString)  isNumeric(MyString)  try {   System.out.println(Integer.parseInt(myString)); 
} catch (NumberFormatException numberFormatException) { 
  System.out.println("myString is not a number"); 

(See Double.parseDouble() too) 

OR

char c = '5'; 
boolean isANumber = Character.isDigit(c);  
is_numeric($MyString) 
Edit
Delete
What ASP.NET / VB.NET ASP / VB JSP / JAVA PHP

Replace text inside a string  *var*.Replace(oldChar, newChar) or
*var*.Replace(oldString, newString) 
Replace(StringToSearch,StringToReplace,NewString)  StringToSearch.replaceAll(StringToReplace,NewString)  str_replace($StringToReplace,$NewString,$StringToSearch);
str_ireplace - Same as str_replace but case insensitive 

Make string uppercase  *var.ToUpper()  Ucase(String)  String.toUpperCase()  strtoupper($String); 

Make string lowercase  *var*.ToLower()  Lcase(String)  String.toLowerCase()  strtolower($String); 

Cast to string  (String)MyVar or
MyVar.ToString() 
Cstr(MyVar)  strval($MyVar);  strval($MyVar); 

String length  *var*.Length  Len(MyVar)  String.length()  strlen($MyVar); 
Edit
Delete
What ASP.NET / VB.NET ASP / VB JSP / JAVA PHP

Find location of string inside string  *var*.IndexOf(stringToFind)  Instr(String2Search, String2Search4)  String2Search.indexOf(String2Search4)  strpos( $String2Search , $String2Search4 ) 

Location of string in string from end  *var*.LastIndexOf(stringToFind)  InstrRev(String2Search, String2Search4)  String2Search.lastindexOf(String2Search4)  strrpos( $String2Search , $String2Search4 ) 

Return ascii value of character  asc("a")
Convert.ToInt32(a); (c#) 
asc("a")  (int)'a';  ord("a"); 

Return character from ascii num  chr(208)
(char)208 (c#) 
chr(208)  (char)208  chr(208); 

Case / Switch  Select Case foo 
     case "bar1" 
       foobar = "fooey" 
     case "bar2" 
         foobar = "fooey2" 
     case "bar3" 
         foobar = "fooey3" 
     case else 
        foobar = "NoBar" 
End Select  
Select Case foo
     case "bar1"
       foobar = "fooey"
     case "bar2"
         foobar = "fooey2"
     case "bar3"
         foobar = "fooey3"
     case else
        foobar = "NoBar"
End Select 
switch (i) {
     case 0:
         print "i equals 0";
         break;
     case 1:
         print "i equals 1";
         break;
     default:
         print "i equals non of the above";
         break;
switch ($i) {
     case 0:
         print "i equals 0";
         break;
     case 1:
         print "i equals 1";
         break;
     default:
         print "i equals non of the above";
         break;
Edit
Delete
What ASP.NET / VB.NET ASP / VB JSP / JAVA PHP

Pass date & return in a specific format  {DateTime variable}.ToString("{format template}")

Check {format template} at http://tinyurl.com/mv4a4 
format(now(),"DD/MM/YYYY HH:nn:SS")    new java.text.SimpleDateFormat("dd/MM/yyyy HH:mm:ss").format(new java.util.Date())  date("d/m/Y H:i:s",time());
^-- the time() function isn't necessary, date if 
not passed a specific date will do it for now().

so date("d/m/Y H:i:s"); 
will suffice. 

format a number  FormatNumber(2000,2)  FormatNumber(2000,2)  DecimalFormat  number_format 

New line  Environment.NewLine
vbNewLine 
vbCrLf
vbNewLine 
\n  \n
\r\n = Carriage Return and Line Feed (hex 0D0A). 

Show Popup  Can't show a popup on the client using server code.
Again: you're in a client/server environment, so you can't 
issue server commands for the client.
You could write JavaScript to show a popup, but not use 
intrinsic server functionality.

This applies to all languages. 
Msgbox("Hello")
or
x = MsgBox("xxx", vbYesNoCancel)

Technically no!

Using VBScript in the browser this will work.
This will not work when writing ASP Pages. 
ASP Pages are run on the server with no visual interface 
import javax.swing.JOptionPane; JOptionPane.showMessageDialog(null,"Hello");
or
int x = JOptionPane.showConfirmDialog(null,"Are you sure?"); 

Print to output  System.Diagnostics.Debug.Print("Hello")  Debug.Print("Hello")  System.out.println("Hello");  echo "Hello"; 
Edit
Delete
What ASP.NET / VB.NET ASP / VB JSP / JAVA PHP

Count number of strings in string  "This is a test".split("is").length-1  UBound(Split("This is a test", "is"))  int count(String base, String searchFor) {
int len = searchFor.length();
int result = 0;
if (len > 0) { // search only if there is something
  int start = base.indexOf(searchFor);
  while (start != -1) {
    result++;
    start = base.indexOf(searchFor, start+len);
  }
}
return result;
substr_count("This is a test", "is"); 

Set cursor location in recordset  myRecordSet.AbsolutePosition = adPosEOF
myRecordSet.AbsolutePosition = adPosBOF 
myResultSet.afterLast();
myResultSet.beforeFirst(); 

Move cursor in recordset  myRecordSet.MoveNext
myRecordSet.MovePrevious 
myResultSet.next();
myResultSet.previous(); 
$rs->MoveNext(); 

Change cursor position in recordset  myRecordSet.AbsolutePosition = 4  myResultSet.absolute(4);  mysql_data_seek($myResultSet,4); 

Move cursor in recordset  myRecordSet.MoveLast
myRecordSet.MoveFirst 
myResultSet.first();
myResultSet.last(); 
Edit
Delete
What ASP.NET / VB.NET ASP / VB JSP / JAVA PHP

Get position of cursor in recordset  x = myRecordSet.AbsolutePosition  x = myResultSet.getRow(); 

Add new row to recordset  myRecordSet.AddNew
myRecordSet.Fields("NAME").Value = "Kona"
myRecordSet.UpdateBatch 
myResultSet.moveToInsertRow();
myResultSet.updateString("NAME", "Kona");
myResultSet.insertRow(); 

JDBC stuff  Code showing how to connect using jdbc and doing various things:

import javax.swing.*;
import java.sql.*;
import com.borland.jbcl.layout.*;

   String driverName = "com.borland.datastore.jdbc.DataStoreDriver";
   String dataStoreName = "C:\\myProject\\Adin.jds";
   String url = "jdbc:borland:dslocal:" + dataStoreName;
   try {
     Class.forName(driverName);
   }
   catch (ClassNotFoundException ex) {
   }
   try {
     Connection con = DriverManager.getConnection(url, "DataStoreExplorer", "");
     //Creat Table:
     String createTableCoffees = "CREATE TABLE COFFEES " +
       "(COF_NAME VARCHAR(32), SUP_ID INTEGER, PRICE FLOAT, " +
       "SALES INTEGER, TOTAL INTEGER)";
     Statement stmt = con.createStatement();
     Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
                    ResultSet.CONCUR_UPDATABLE);
     stmt.executeUpdate(createTableCoffees);

   //Select from Table:
     ResultSet rs = stmt.executeQuery("SELECT COF_NAME, PRICE FROM COFFEES");
     while (rs.next())
     {
       String s = rs.getString("COF_NAME");
       String n = rs.getString("PRICE");
       System.out.println(s + "   " + n + "a");
     }
     while (rs.previous())
     {
       String s = rs.getString("COF_NAME");
       String n = rs.getString("PRICE");
       System.out.println(s + "   " + n + "a");
     }

     rs.absolute(1);
     int s = rs.getRow();
     String n = rs.getString("PRICE");
     System.out.println(s + "   " + n + "a");

     //Update field
     rs.updateFloat("PRICE", 10);
     rs.updateRow();
     System.out.println(rs.getString("PRICE"));

     //Add new row to table
     rs.moveToInsertRow();
     rs.updateString("COF_NAME", "Kona");
     rs.updateDouble("PRICE", 10.15);
     rs.insertRow();

     rs.close();
     con.close();

   }
   catch (SQLException ex1) {
     //ex1.toString()
     JOptionPane.showMessageDialog(null,ex1.toString());
   }  

substring  *stringName*.Substring(start, length)  mid("hello world",Start)
or
mid("hello world",Start,length) 
String mystring;
mystring = new String("hello world");
mystring.substring(int start, int length); 
substr($string, int start, int length); 

String compare  myString.Equals(string)

Also:

public static System.Int32 Compare (
         System.String strA, 
         System.String strB, 
         System.Boolean ignoreCase )

   Member of System.String

Summary:
 Compares two specified System.String 
 objects, ignoring or honoring their case.  

Parameters:
strA: The first System.String.
strB: The second System.String.
ignoreCase: A System.Boolean indicating a 
            case-sensitive or insensitive 
            comparison. 
(true indicates a case-insensitive comparison.)

Returns:
A 32-bit signed integer indicating the 
lexical relationship between the two comparands.
Value Meaning    
  Less than zero  strA is less than strB.
  Zero  strA equals strB.
  Greater than zero  strA is greater than strB. 
If MyString = OtherString Then...

or

strComp:
If (StrComp(MyString,OtherString) = 0) Then 
if (myString.equals(otherString)) ... also
if (myString.equalsIgnoreCase(otherString))  
if (strcmp ($string1, $string3) == 0) 
Edit
Delete
What ASP.NET / VB.NET ASP / VB JSP / JAVA PHP

Get current folder of program  Environment.CurrentDirectory  App.Path  \\Returns location where program was started 
java.io.File x = new java.io.File(""); 
System.out.println(x.getAbsolutePath()); 
// Path to public /temp.php 
$_SERVER['PATH_INFO']

// Full Path: /home/users/htdocs/temp.php
$_SERVER['PATH_TRANSLATED']
 

Using Application level variable  Application.Add 
and 
Application.Get 
Application("ApplicationVarName") = varName 
varName = Application("ApplicationVarName") 
application.setAttribute("ApplicationVarName",varName); 
varName = application.getAttribute("ApplicationVarName") 
$_APP["ApplicationVarName"] = $varName; 
if (!isset($_APP["ApplicationVarName"]))... 

Modulus (Mod)  VB: FirstNum Mod SecondNum 
C#: FirstNum  % SecondNum 
 
FirstNum Mod SecondNum  firstNum  % secondNum  $firstNum % $secondNum 

Split string into array  Split(theString,",")  Split(theString,",")  st=StringTokenizer(theString,",")
while (st.hasMoreTokens)
{
 Str=st.nextToken()
}
 
explode(",",$theString) 

Test type or instance of a object  If (TypeOf myObject Is String) Then

if isnumeric(num) then
if cint(num) = num then
response.write "num is an int"
end if
end if 
Syntax
IsArray(variable) 

Parameter Description 
variable Required. Any variable 
 
if (myObject instanceof String) {  Lots of functions in PHP for that:
is_array(object)
is_bool(object)
is_double(object)
is_float(object)
is_int(object)
is_integer(object)
is_long(object)
is_numeric(object)
is_object(object)
is_real(object)
is_resource(object)
is_scalar(object)
is_string(object)
Todas devuelven TRUE o FALSE. 
Edit
Delete
What ASP.NET / VB.NET ASP / VB JSP / JAVA PHP

extract part of a string  myString.Substring(intStart,[intLenght])  mid(myString, intStart, [intLenght])   myString.substring(intStart,[intLenght])   substr($myString, IntStart, [IntLenght]) 

Get path of current script  Request.PhysicalPath  request.servervariables("SCRIPT_NAME")  $_SERVER['PHP_SELF'] 

open close tags for language  <%

Asp script

%> 
<%

Asp script

%> 
JSP has 5 different tags:

<%   Scriptlet Tag %>
<%@  Directive/Include Tag %>
<%!  Declaration Tag %>
<%-- Comment Tag --%>
<%=  Expression Tag %> 
<?
Php script
?>
OR
<?php
Php script
?>
OR 
<?=
Php output
?> 

Indicating whether a variable is defined  IsNothing(x) where x is the variable within question

if IsNothing(x) Then
    response.write ("This variable is NOT defined")
else
    response.write ("This variable is defined")
End If 
isnull(x) where x is the variable within question 

if isnull(x) Then 
    response.write ("This variable is NOT defined") 
else 
    response.write ("This variable is defined") 
End If

This is not quite true because a variable can be set to NULL, 
thus it's value is null. 
<?php

if (isset($x))
    echo "This variable is defined";
else
    echo "This variable is NOT defined";

?> 

Expiration  <%Response.Expire=0%>  <%Response.Expire=0%>  <% response.setHeader("Cache-Control","no-cache"); %>
<% response.setHeader("Cache-Control","max-age=0"); %>
 
<? header("Expires: 0");?> 
Edit
Delete
What ASP.NET / VB.NET ASP / VB JSP / JAVA PHP

Prompt message (See Show Popup above)  alert("xxxx"); 

get host ip address  Request.UserhostAddress  request.ServerVariables("REMOTE_ADDR")  request.getRemoteAddr()  getenv("REMOTE_ADDR") 
or
$_SERVER['REMOTE_ADDR'] has it already in variable form for you. 

Background color  Your background color is very horrible.  OK, i removed the background image.
Note that when clicking on a row it 
changes so it is easy to scroll sideways 
and not lose your place

I'm the webmaster. 
I'm not so keen either. 
It kinda makes everything that much more 
difficult to read!

Apart from that, although I didn't find what I 
was looking for, this page is a genius idea! 
setting table width to 100% besides 
changing the background would be easier to see all the 5 columns together

you could alto let the user select which languages he wanna see comparison
 

date manipulation  myDate = dateAdd("YYYY",1,now())  $myYear = date('Y',now());
$myDate = date('strToTime'


should be possible using php date() function 

 

server variable logon user  <% Request.ServerVariables("LOGON_USER") %>  <? $_SERVER["LOGON_USER"] ?> 
Edit
Delete
What ASP.NET / VB.NET ASP / VB JSP / JAVA PHP

print text  Response.write("Text")  response.write "adin and liora"

or

<%="adin and liora"%> 
out.println("Akhil...");  echo "abdalqoudous and waseem"; 
echo("echo can look like a function
a new line in the () is also a new line in the html"); 
print "abdalqoudous and waseem"; 

or shortcut for in page where 
$var = "abdalqoudous and waseem"; 
<?=$var;?> 

delete extra spaces  ASP.Net(Code behind VB.Net)-->
dim test as String
test = "  Abcd  " 
test = test.Trim() 
Var = "      lalalala   "
Var = Trim(Var)
'now Var will be: "lalalala" 
String VAR = "   lalalala   ";
VAR = VAR.trim();
//now VAR will be: "lalalala"; 
$var = "      lalalala   ";
$var = trim($var);
//now $var will be: "lalalala" 

UTF8 encoding  <%@codePage = 65001%>  response.Charset = "utf-8"  String value = new String( str.getBytes("ISO-8859-1"), "UTF-8");  utf8_enconde($str) 

compare two dates  C#:
DateTime d1 = new DateTime();
DateTime d2 = DateTime.Now;

TimeSpan t = d2-d1;

int WholeSeconds = t.Seconds;
double Seconds = t.TotalSeconds;

int WholeMinutes = t.Minutes; 
See DateDiff function  Date x1 = new Date();
Date x2 = new Date();
Diff in seconds: (x1.getTime()-x2.getTime())/(1000)
Diff in minutes: (x1.getTime()-x2.getTime())/(1000*60)
 
seconds = strtotime("2007-11-11") - strtotime("2008-12-11") 

modulus function   x mod y   $x % $y; 
Edit
Delete
What ASP.NET / VB.NET ASP / VB JSP / JAVA PHP

phpinfo  <%
for each thing in request.servervariables
tempvalue=request.servervariables(thing)
response.write thing & "=" & tempvalue & "<br>"
next
%> 
<%
for each thing in request.servervariables
tempvalue=request.servervariables(thing)
response.write thing & "=" & tempvalue & "<br>"
next
%> 
not available  phpinfo(); 

ftping a file to another server  <?

 copy(".htpasswd","ftp://user:pass@server/dir/file");
?>

 

Print to console (in debugger)  Console.Write("Hello dude");
Console.WriteLine("Hello dude");
The above will print to the Output window in Visual Studio 
Debug.Print (VB6)  System.out.print("Hello dude");
System.out.println("Hello dude"); 

Send an Email  <%@ Page Language="C#" Debug="true" %>
<%@ Import Namespace="System" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OleDb" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<%@ Import Namespace="System.Drawing" %>
<%@ Import Namespace="System.Drawing.Design" %>
<%@ Import Namespace="System.Drawing.Drawing2D" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.Web.Mail" %>

<script runat="server">

   // Main
   // by deerme.org XD
   //String servidorsaliente = "localhost";
   
   protected void Page_Load(object sender, EventArgs e)
   {

        MailMessage mail = new MailMessage();   
mail.To = "[email protected]";
mail.From = "[email protected]";
mail.BodyFormat = MailFormat.Html;
mail.Subject = "Correo de Contacto";
mail.Body = " Un Visitante ha llenado el Formulario de Contacto. <br><br>Nombre: " + Request.Form["nombre"] + 
"<br>Email:  " + Request.Form["email"]  +  "<br>Fono:   " + Request.Form["fono"]  +  "<br>Comentario: " + 
Request.Form["comentario"]  +  "<br>";
/*
mail.Fields["http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"] = 1;
mail.Fields["http://schemas.microsoft.com/cdo/configuration/sendusername"] = "usuario";
mail.Fields["http://schemas.microsoft.com/cdo/configuration/sendpassword"] = "clave";
*/
SmtpMail.SmtpServer = "localhost";
        SmtpMail.Send(mail);


     
       
       
       
       
                  
   }
   
  
    
</script> 
Using CDONTS:
    dim objCdoConfig, objNewMail', Flds
    Set objCdoConfig = Server.CreateObject("CDO.Configuration")
    Set Flds = objCdoConfig.Fields
    With Flds
        .Item(cdoSendUsingMethod) = cdoSendUsingPort
        .Item(cdoSMTPServer) = "mail-fwd"
        .Item(cdoSMTPServerPort) = 25
        .Item(cdoSMTPconnectiontimeout) = 10
        .Update
    End With
    
    Set objNewMail = Server.CreateObject("CDO.Message")    
    Set objNewMail.Configuration = objCdoConfig

    objNewMail.To       = "[email protected]"
    objNewMail.From     = "[email protected]"
    objNewMail.Subject  = "Mail Subject"
    objNewMail.TextBody = "EMailBody"
on error resume next
    objNewMail.Send

    'report the success or failure of the send 
    If Err.number <> 0 then
        Response.Write "Error"
    else
        Response.Write "OK"
    end if 
mail($to, $subject, "", $header); 

Get buffer contents  No Way...   $aBuff = ob_get_contents(); 
Edit
Delete
What ASP.NET / VB.NET ASP / VB JSP / JAVA PHP

Do magic  <?php
magic();
?> 

create folder  My.Computer.FileSystem.CreateDirectory("C:\NewDirectory")   Dim vFso
Set vFso = Server.CreateObject("Scripting.FileSystemObject")  
vFso.CreateFolder "c:\folder"
set vFso = nothing 
mkdir( "C:\\folder"); 

If there exists a file or directory exis  Dim fileExists As Boolean
fileExists = My.Computer.FileSystem.FileExists("C:\Test.txt")

Dim folderExists As Boolean
folderExists = My.Computer.FileSystem.DirectoryExists("C:\TestDirectory") 
'check file

Set objFS = Server.CreateObject("Scripting.FileSystemObject")
If objFS.FileExists( Server.MapPath("file.txt") ) Then
  Response.Write "file exists"
Else
  Response.Write "file not exists"
End If
Set objFS = Nothing

'check folder
Set objFS = Server.CreateObject("Scripting.FileSystemObject")
If objFS.FolderExists(Server.MapPath( "directory" ) ) Then
  Response.Write "directory exists"
Else
  Response.Write "directory not exists"
End if
Set objFS = Nothing 
// To serve both files when to directories

file_exists("c:\\teste.txt") 

get type of file  typename()  gettype() 

Prevent multiple calls to piece of code  See Lock Statement 
(lock ensures that one thread does not enter a
critical section while another thread is in the
critical section of code. If another thread
attempts to enter a locked code, it will wait
(block) until the object is released.) 
See synchronized Method
(When one thread is executing a synchronized method
for an object, all other threads that invoke
synchronized methods for the same object
block (suspend execution) until the first
thread is done with the object.) 
Edit
Delete
What ASP.NET / VB.NET ASP / VB JSP / JAVA PHP

if u want 2 add header.ascx 2 ur index  Step 1: place into top of ur index.aspx
<%@ Register TagPrefix="Header" TagName="TagHeaderIndex" src="includes/header.ascx" %>

step 2: Specify loc for display at index.aspx
<Header:TagHeaderIndex ID="Header" Runat="Server"></Header:TagHeaderIndex>

step3 : finally ur header.ascx file something like this
<%@ Control Language="vb" AutoEventWireup="false" Codebehind="header.ascx.vb" Inherits="machtel.header" 
 TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %>
<table class="module"><tr><td class="tp_image"></td><td>&nbsp;</td></tr>
</table>
 
<!--#include virtual="/includes/header.asp"-->  <? include("./includes/header.php"); ?> 

format string to currency  FormatCurrency(20000)
see http://www.w3schools.com/Vbscript/func_formatcurrency.asp 
String.Format("{0:C}", 20000);
or
String.Format("{0:n2}", 20000);
 

open a file or a URL file  fopen() 

Send an Email  <%@ Page Language="C#" Debug="true" %>
<%@ Import Namespace="System" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OleDb" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<%@ Import Namespace="System.Drawing" %>
<%@ Import Namespace="System.Drawing.Design" %>
<%@ Import Namespace="System.Drawing.Drawing2D" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.Web.Mail" %>

<script runat="server">

   // Main
   // by deerme.org XD
   //String servidorsaliente = "localhost";
   
   protected void Page_Load(object sender, EventArgs e)
   {

        MailMessage mail = new MailMessage();   
mail.To = "[email protected]";
mail.From = "[email protected]";
mail.BodyFormat = MailFormat.Html;
mail.Subject = "Correo de Contacto";
mail.Body = " Un Visitante ha llenado el Formulario de Contacto. <br><br>Nombre: " + Request.Form["nombre"] + 
"<br>Email:  " + Request.Form["email"]  +  "<br>Fono:   " + Request.Form["fono"]  +  "<br>Comentario: " + 
Request.Form["comentario"]  +  "<br>";
/*
mail.Fields["http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"] = 1;
mail.Fields["http://schemas.microsoft.com/cdo/configuration/sendusername"] = "usuario";
mail.Fields["http://schemas.microsoft.com/cdo/configuration/sendpassword"] = "clave";
*/
SmtpMail.SmtpServer = "localhost";
        SmtpMail.Send(mail);

   }

</script> 
<%
Dim objCdoConfig, objNewMail', Flds
Set objCdoConfig = Server.CreateObject("CDO.Configuration")
Set Flds = objCdoConfig.Fields
With Flds
    .Item(cdoSendUsingMethod) = cdoSendUsingPort
    .Item(cdoSMTPServer) = "mail-fwd"
    .Item(cdoSMTPServerPort) = 25
    .Item(cdoSMTPconnectiontimeout) = 10
    .Update
End With
    
Set objNewMail = Server.CreateObject("CDO.Message")    
Set objNewMail.Configuration = objCdoConfig

objNewMail.To       = "[email protected]"
objNewMail.From     = "[email protected]"
objNewMail.Subject  = "Mail Subject"
objNewMail.TextBody = "EMailBody"

On Error Resume Next
objNewMail.Send

'report the success or failure of the send
Err.clear
If Err.number <> 0 Then
    Response.Write "Error"
Else
    Response.Write "OK"
End If
%> 
<%@ page import="sun.net.smtp.SmtpClient, java.io.*" %>
<%
 String from="[email protected]";
 String to="[email protected]";
 try{
     SmtpClient client = new SmtpClient("mail.xxxxx.xxx");
     client.from(from);
     client.to(to);
     PrintStream message = client.startMessage();
     message.println("To: " + to);
     message.println("Subject:  Mail Subject");
     message.println("EMailBody");
     message.println();     
     message.println();
     client.closeServer();
  }
  catch (IOException e){
     System.out.println("ERROR SENDING EMAIL:"+e);
  }
%> 
<?php
$to = "[email protected]";
$from = "[email protected];
$subject = "Mail Subject";
$header = "From: $from\r\n";
$body = "My message body."
$mailsent = @mail($to, $subject, $body, $header);
?> 

Please Make sure the command doesn't already exist

Adin's Blog


eXTReMe Tracker