Tuesday, April 26, 2016

Getting Information About Public users IP Location

Imports System.IO
Imports System.Net
Imports System.String


 Dim strClientIP As String
        strClientIP = Request.UserHostAddress()

        Dim strComputerName As String
        Dim host As System.Net.IPHostEntry
        host = System.Net.Dns.GetHostEntry(Request.ServerVariables.Item("REMOTE_HOST"))
        strComputerName = host.HostName

        Dim ExternalIP As String
        ExternalIP = (New WebClient()).DownloadString("http://checkip.dyndns.org/")
        ExternalIP = (New Regex("\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}")) _
                     .Matches(ExternalIP)(0).ToString()

        Dim FILENAME As String = Server.MapPath("IP.txt")
        Dim objStreamWriter As StreamWriter
        objStreamWriter = File.AppendText(FILENAME)
        objStreamWriter.WriteLine("External IP    :" & " " & ExternalIP)
        objStreamWriter.WriteLine("Computer Name  :" & " " & strComputerName)
        objStreamWriter.WriteLine("Local IP       :" & " " & strClientIP)
        objStreamWriter.WriteLine("Date & Time    :" & " " & DateTime.Now)
        objStreamWriter.WriteLine("-----------------------------------------------------")
        objStreamWriter.Close()
        Dim objStreamReader As StreamReader
        objStreamReader = File.OpenText(FILENAME)
        Dim contents As String = objStreamReader.ReadToEnd()
        objStreamReader.Close()

Disable Copy Text From Web Pages

// copy paste this script inside  head section of page OR contentplaceholder's head content

<script type="text/javascript">

function disableSelection(target){
if (typeof target.onselectstart!="undefined") //IE route
target.onselectstart=function(){return false}
else if (typeof target.style.MozUserSelect!="undefined") //Firefox route
target.style.MozUserSelect="none"
else //All other route (ie: Opera)
target.onmousedown=function(){return false}
target.style.cursor = "default"
}

</script>

//Then copy paste these scripts according usage inside body section OR contentplaceholder

<script type="text/javascript">
disableSelection(document.body) //disable text selection on entire body of page
</script>
<script type="text/javascript">
var somediv=document.getElementById("mydiv")
disableSelection(somediv) //disable text selection within DIV with id="mydiv"
</script>
<script type="text/javascript">
var alltables=document.getElementsByTagName("table")
for (var i=0; i<alltables.length; i++)
disableSelection(alltables[i]) //disable text selection within all tables on the page
</script>

Disable Right Click On Web Pages

// copy and paste this code inside your body section OR contentplaceholder

<script language=JavaScript>
<!--

var message="";
///////////////////////////////////
function clickIE() {if (document.all) {(message);return false;}}
function clickNS(e) {if
(document.layers||(document.getElementById&&!document.all)) {
if (e.which==2||e.which==3) {(message);return false;}}}
if (document.layers)
{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}

document.oncontextmenu=new Function("return false")
// -->
</script>

Disable Right Click on Images

// copy and paste this script inside your body section OR contentplaceholder

<script>

document.oncontextmenu = function(e){
var target = (typeof e !="undefined")? e.target: event.srcElement
if (target.tagName == "IMG" || (target.tagName == 'A' && target.firstChild.tagName == 'IMG'))
return false
}

</script>

Tuesday, April 12, 2016

SQL- See Table RelationShips

//RUN QUERY IN SQL

SELECT
K_Table = FK.TABLE_NAME,
FK_Column = CU.COLUMN_NAME,
PK_Table = PK.TABLE_NAME,
PK_Column = PT.COLUMN_NAME,
Constraint_Name = C.CONSTRAINT_NAME
FROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS C
INNER JOIN INFORMATION_SCHEMA.TABLE_CONSTRAINTS FK ON C.CONSTRAINT_NAME = FK.CONSTRAINT_NAME
INNER JOIN INFORMATION_SCHEMA.TABLE_CONSTRAINTS PK ON C.UNIQUE_CONSTRAINT_NAME = PK.CONSTRAINT_NAME
INNER JOIN INFORMATION_SCHEMA.KEY_COLUMN_USAGE CU ON C.CONSTRAINT_NAME = CU.CONSTRAINT_NAME
INNER JOIN (
SELECT i1.TABLE_NAME, i2.COLUMN_NAME
FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS i1
INNER JOIN INFORMATION_SCHEMA.KEY_COLUMN_USAGE i2 ON i1.CONSTRAINT_NAME = i2.CONSTRAINT_NAME
WHERE i1.CONSTRAINT_TYPE = 'PRIMARY KEY'
) PT ON PT.TABLE_NAME = PK.TABLE_NAME

Friday, April 8, 2016

Link Any Type Of File as OBJECT

<object type="text/html" width=100% height="250" data="CONTENTS/Packaging South Asia.pdf">

</object>