https://1drv.ms/w/s!AuGnVAC2uR23mTeBPVThcpSFlCDj
Networking ,programming & more....
Tuesday, April 16, 2019
Wednesday, June 22, 2016
File Upload in ASP.Net
protected void Button1_Click(object sender, EventArgs e)
{
//code to Insert into database
string nm = TextBox1.Text.Trim();
string usernm = TextBox2.Text.Trim();
string pass = TextBox3.Text.Trim();
string phone = TextBox4.Text.Trim();
if (FileUpload1.HasFile) {
string name=FileUpload1.PostedFile.FileName;
string ext=System.IO.Path.GetExtension(name);
if(!(ext==".jpg" || ext==".png" || ext == ".bmp")){
Label8.Text="Invalid File Type!! Only Images(jpg,bmp or png) allowed!";
return;
}
else if(FileUpload1.PostedFile.ContentLength > 100000){
Label8.Text="Image too large!! Only Upto 100Kb Allowed!!";
return;
}
string filename = DateTime.Now.ToFileTime() + usernm+ ext;
string ins = "insert into register(username,name,password,phone,image) values('"+usernm+"','"+name+"','"+pass+"','"+phone+"','"+filename+"')";
FileUpload1.SaveAs(Server.MapPath("Images") + "/"+filename);
int i = dbase.insert(ins);
if (i == 1) {
Label8.Text = "Registered successfully!!";
}
else
Label8.Text = "Error while saving!!!!";
}
}
{
//code to Insert into database
string nm = TextBox1.Text.Trim();
string usernm = TextBox2.Text.Trim();
string pass = TextBox3.Text.Trim();
string phone = TextBox4.Text.Trim();
if (FileUpload1.HasFile) {
string name=FileUpload1.PostedFile.FileName;
string ext=System.IO.Path.GetExtension(name);
if(!(ext==".jpg" || ext==".png" || ext == ".bmp")){
Label8.Text="Invalid File Type!! Only Images(jpg,bmp or png) allowed!";
return;
}
else if(FileUpload1.PostedFile.ContentLength > 100000){
Label8.Text="Image too large!! Only Upto 100Kb Allowed!!";
return;
}
string filename = DateTime.Now.ToFileTime() + usernm+ ext;
string ins = "insert into register(username,name,password,phone,image) values('"+usernm+"','"+name+"','"+pass+"','"+phone+"','"+filename+"')";
FileUpload1.SaveAs(Server.MapPath("Images") + "/"+filename);
int i = dbase.insert(ins);
if (i == 1) {
Label8.Text = "Registered successfully!!";
}
else
Label8.Text = "Error while saving!!!!";
}
}
Wednesday, June 15, 2016
DBASE Class
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.SqlClient;
using System.Data;
using System.Configuration;
///
/// Summary description for dbase
///
public class dbaseusing System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.SqlClient;
using System.Data;
using System.Configuration;
///
/// Summary description for dbase
///
{
public dbase()
{
//
// TODO: Add constructor logic here
//
}
public static DataSet select(string qu) {
try
{
DataSet ds = new DataSet();
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["conn"].ConnectionString);
SqlCommand cmd = new SqlCommand(qu, con);
con.Open();
SqlDataAdapter adp = new SqlDataAdapter(cmd);
adp.Fill(ds);
con.Close();
return ds;
}
catch (Exception exp)
{
return null;
}
}
public static int insert(string qu) {
try
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["conn"].ConnectionString);
SqlCommand cmd = new SqlCommand(qu, con);
con.Open();
int ans = cmd.ExecuteNonQuery();
con.Close();
return ans;
}
catch (Exception exp) {
return -1;
}
}
}
ASP.Net Edit Course Code
Edit Course Cs:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
public partial class admin_EditCourse : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
if (Request.QueryString["cid"] == null)
{
Response.Redirect("~/admin/ViewCourse.aspx", true);
}
string cid = Request.QueryString["cid"].ToString();
string qu = "select coursename from course where courseid=" + cid;
DataSet ds = dbase.select(qu);
if (ds != null && ds.Tables.Count == 1)
{
TextBox1.Text = ds.Tables[0].Rows[0]["coursename"].ToString();
RequiredFieldValidator1.InitialValue = TextBox1.Text;
}
lblCourseId.Text = cid;
}
}
protected void Button1_Click(object sender, EventArgs e)
{
string up = TextBox1.Text;
string qu = "update course set coursename='"+up+"' where courseid="+lblCourseId.Text;
int i = dbase.insert(qu);
if (i == 1) {
//Successful
ScriptManager.RegisterStartupScript(this, this.GetType(), "js1",
"alert('Saved Successfully!!');window.location='ViewCourse.aspx'", true);
}
else {
//Error unsuccesful
ScriptManager.RegisterStartupScript(this, this.GetType(), "js2",
"alert('Error While Saving. Try Again later');window.location='ViewCourse.aspx'", true);
}
}
protected void Button2_Click(object sender, EventArgs e)
{
Response.Redirect("~/admin/ViewCourse.aspx");
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
public partial class admin_EditCourse : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
if (Request.QueryString["cid"] == null)
{
Response.Redirect("~/admin/ViewCourse.aspx", true);
}
string cid = Request.QueryString["cid"].ToString();
string qu = "select coursename from course where courseid=" + cid;
DataSet ds = dbase.select(qu);
if (ds != null && ds.Tables.Count == 1)
{
TextBox1.Text = ds.Tables[0].Rows[0]["coursename"].ToString();
RequiredFieldValidator1.InitialValue = TextBox1.Text;
}
lblCourseId.Text = cid;
}
}
protected void Button1_Click(object sender, EventArgs e)
{
string up = TextBox1.Text;
string qu = "update course set coursename='"+up+"' where courseid="+lblCourseId.Text;
int i = dbase.insert(qu);
if (i == 1) {
//Successful
ScriptManager.RegisterStartupScript(this, this.GetType(), "js1",
"alert('Saved Successfully!!');window.location='ViewCourse.aspx'", true);
}
else {
//Error unsuccesful
ScriptManager.RegisterStartupScript(this, this.GetType(), "js2",
"alert('Error While Saving. Try Again later');window.location='ViewCourse.aspx'", true);
}
}
protected void Button2_Click(object sender, EventArgs e)
{
Response.Redirect("~/admin/ViewCourse.aspx");
}
}
Thursday, June 9, 2016
Sending Attachment through PHP mail function
Sending Attachment using mail() function :
// request variables // important
$from = $_REQUEST["from"];
$emaila = $_REQUEST["emaila"];
$filea = $_REQUEST["filea"];
if ($filea) {
function mail_attachment ($from , $to, $subject, $message, $attachment){
$fileatt = $attachment; // Path to the file
$fileatt_type = "application/octet-stream"; // File Type
$start = strrpos($attachment, '/') == -1 ?
strrpos($attachment, '//') : strrpos($attachment, '/')+1;
$fileatt_name = substr($attachment, $start,
strlen($attachment)); // Filename that will be used for the
file as the attachment
$email_from = $from; // Who the email is from
$subject = "New Attachment Message";
$email_subject = $subject; // The Subject of the email
$email_txt = $message; // Message that the email has in it
$email_to = $to; // Who the email is to
$headers = "From: ".$email_from;
$file = fopen($fileatt,'rb');
$data = fread($file,filesize($fileatt));
fclose($file);
$msg_txt="\n\n You have recieved a new attachment message from $from";
$semi_rand = md5(time());
$mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";
$headers .= "\nMIME-Version: 1.0\n" . "Content-Type: multipart/mixed;\n" . "
boundary=\"{$mime_boundary}\"";
$email_txt .= $msg_txt;
$email_message .= "This is a multi-part message in MIME format.\n\n" .
"--{$mime_boundary}\n" . "Content-Type:text/html;
charset = \"iso-8859-1\"\n" . "Content-Transfer-Encoding: 7bit\n\n" .
$email_txt . "\n\n";
$data = chunk_split(base64_encode($data));
$email_message .= "--{$mime_boundary}\n" . "Content-Type: {$fileatt_type};\n" .
" name = \"{$fileatt_name}\"\n" . //"Content-Disposition: attachment;\n" .
//" filename = \"{$fileatt_name}\"\n" . "Content-Transfer-Encoding:
base64\n\n" . $data . "\n\n" . "--{$mime_boundary}--\n";
$ok = mail($email_to, $email_subject, $email_message, $headers);
if($ok) {
echo "File Sent Successfully.";
unlink($attachment); // delete a file after attachment sent.
}else {
die("Sorry but the email could not be sent. Please go back and try again!");
}
}
move_uploaded_file($_FILES["filea"]["tmp_name"],
'temp/'.basename($_FILES['filea']['name']));
mail_attachment("$from", "youremailaddress@gmail.com",
"subject", "message", ("temp/".$_FILES["filea"]["name"]));
}
?>
// request variables // important
$from = $_REQUEST["from"];
$emaila = $_REQUEST["emaila"];
$filea = $_REQUEST["filea"];
if ($filea) {
function mail_attachment ($from , $to, $subject, $message, $attachment){
$fileatt = $attachment; // Path to the file
$fileatt_type = "application/octet-stream"; // File Type
$start = strrpos($attachment, '/') == -1 ?
strrpos($attachment, '//') : strrpos($attachment, '/')+1;
$fileatt_name = substr($attachment, $start,
strlen($attachment)); // Filename that will be used for the
file as the attachment
$email_from = $from; // Who the email is from
$subject = "New Attachment Message";
$email_subject = $subject; // The Subject of the email
$email_txt = $message; // Message that the email has in it
$email_to = $to; // Who the email is to
$headers = "From: ".$email_from;
$file = fopen($fileatt,'rb');
$data = fread($file,filesize($fileatt));
fclose($file);
$msg_txt="\n\n You have recieved a new attachment message from $from";
$semi_rand = md5(time());
$mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";
$headers .= "\nMIME-Version: 1.0\n" . "Content-Type: multipart/mixed;\n" . "
boundary=\"{$mime_boundary}\"";
$email_txt .= $msg_txt;
$email_message .= "This is a multi-part message in MIME format.\n\n" .
"--{$mime_boundary}\n" . "Content-Type:text/html;
charset = \"iso-8859-1\"\n" . "Content-Transfer-Encoding: 7bit\n\n" .
$email_txt . "\n\n";
$data = chunk_split(base64_encode($data));
$email_message .= "--{$mime_boundary}\n" . "Content-Type: {$fileatt_type};\n" .
" name = \"{$fileatt_name}\"\n" . //"Content-Disposition: attachment;\n" .
//" filename = \"{$fileatt_name}\"\n" . "Content-Transfer-Encoding:
base64\n\n" . $data . "\n\n" . "--{$mime_boundary}--\n";
$ok = mail($email_to, $email_subject, $email_message, $headers);
if($ok) {
echo "File Sent Successfully.";
unlink($attachment); // delete a file after attachment sent.
}else {
die("Sorry but the email could not be sent. Please go back and try again!");
}
}
move_uploaded_file($_FILES["filea"]["tmp_name"],
'temp/'.basename($_FILES['filea']['name']));
mail_attachment("$from", "youremailaddress@gmail.com",
"subject", "message", ("temp/".$_FILES["filea"]["name"]));
}
?>
Thursday, May 17, 2012
Indian Government Ordered to Block many music sites
The Indian Music Industry (IMI), an industry consortium of 142 music ompanies, has obtained orders from the Calcutta High Court directing all Internet Service Providers (387 ISPs) to block 104 music sites. Court orders were obtained on 27th of January, 6th February, and the 1st and 2nd of March 2012. ISPs have been directed by the court to block all 104 sites within 36 hours. It essentially has the order against Songs.pk as a sample. Apurv Nagpal, CEO of Saregama, told MediaNama that the first order was against songs.pk, and subsequent court orders covered the rest of the sites. The IMI made a case against each website, he added, with proof of piracy of content from labels by each site.
Indian content businesses have increasingly been taking the legal route to combat piracy: T-Series filed lawsuits against several major companies like YouTube (which was later settled), MySpace, Yahoo and Ibibo, and even got the founders of Guruji.com arrested. Reliance BIG Pictures began getting generic “John Doe” orders trying to force filesharing sites to prevent movie uploads, and getting some of them blocked. This is by far the biggest anti-piracy initiative till date.
How They Will Block
The court has asked ISPs to block the sites using any of the three methods:
1. DNS Name blocking: which ISPs use to for looking up IP addresses corresponding to domain names. However, it is possible for filesharing sites to change their domain name: as we reported earlier,like Songs.pk renamed as Songspk.pk
2. IP Address blocking using routers: IP address blocking using routers. However, it is possible for sites to be hosted on alternate servers, once blocked, so this might not entirely address the issue.
3. DPI based URL blocking: “This mechanism involves configuring the ISP’s network management system to monitor traffic by means of Deep Packet Inspection (DPI) and reset or block a customer’s connection to specific Uniform Resource Locators (URLs) as defined in the network management system’s Access Control Lists” DPI-based URL blocking is necessary can be used to block only a portion of a website, for example, “www.example.com/home.html” only, instead of “www.example.com.”
What This Means
The information docket lists each of the 387 ISPs in India, all the 104 music sites, and certain legitimate sites in India, which provide legal options for consumers: Saregama, Nokia Music, Flipkart, Cyworld, 7digital, Gaana*, In, IndiaONE, Meridhun, MyBand, Raaga, Radio One, Saavn, Dhingana, Artist Aloud and Telugu One.
The intent is evident – at one end, IMI is using legal means to stop illegal downloads, and at the other, it is propping up legal businesses. This could act as a fillip for legal sites – perhaps users might choose to stream music over the cloud or buy it online instead of downloading for free. On the other hand, they could find alternate means, through file sharing sites and torrents. Nagpal told that the IMI will go after filesharing sites next, so it appears that the battle against online piracy of Indian music is well and truly on now, and music labels are beginning to take online revenues a lot more seriously.
This might be a consequence of changes in mobile marketing and mobile ringbacktone subscription policies, enforced by the TRAI, which might have impacted mobile revenues.
Here is the list of the sites which IMI wants to block via court orders. Some have been banned and some will be banned:
2. absongs.com
3. apniisp.com
4. apunkabollywood.com
5. bollyextreme.com
6. bollymaza.com
7. bollywood-hits.com
8. bollywoodmp4.com
9. bollywoodstop.com
10. coolgoose.com
11. dacoolsite.com
12. desibajao.net/desihits.net
13. desifunda.net
14. desisong.com
15. dhakdhakradio.com
16. downloadming.com
17. freeindisongs.com
18. funmaza.com
19. gogrumogru.com/songs.ind.in
20. karachimag.com
21. koolfree.com
22. lovepaki.com
23. mastmag.com
24. mobraja.com
25. mp3fundoo.com
26. mp3paradice.com
27. musicduniya.com
28. musiqbuzz.com
29. muskurahat.com
30. netmasty.com
31. pakfellows.com
32. paktimes.com
33. playlist.pk
34. punjabcentral.com
35. radioreloaded.com
36. radiorhythmz.fm
37. radiorocking.com
38. rkmania.com
39. songbox.pk
40. songsinn.com
41. songsnonstop.com
42. songsrack.com
43. songsrip.com
44. songzila.com
45. topupmp3.com
46. town67.com
47. 100india.com
48. musicindiaonline.com
49. aflatune.com
50. bharatlover.com
51. cckerala.com
52. centralmusiq.com
53. chimatamusic.com
54. desimusic.com
55. desishock.net
56. dhool.com
57. dishant.com
58. filmicafe.com
59. filmimusic.com
60. fun1001.com
61. hindimirchi.com
62. sunomusic.com
63. telugufm.com
64. yolike.com
65. andhravilas.com
66. smashits.com
67. songdad.com
68. songslover.net
69. ragalahari.com
70. rameshmusic.com
71. freeplaymp3songdownload.com
72. freefundoo.com
73. desijammers.com
74. thenisai.com
75. mp3feelings.com
76. mazafm.com/hindimirchi.com
77. kjyesudas.com
78. jaanfm.com
79. gr8click.com
80. funscrape.com
81. chirkutonorkut.com
82. tamilmaalai.com
83. tamilkey.info
84. vmusiq.com
85. sevanthi.com
86. tamilwire.com
87. a2ztamilsongs.com
88. mymaza.com
89. germantamilan.com
90. 123music.mobi
91. desiden.mobi
92. longmp3.mobi
93. krazywap.com
94. mobile-zon.com
95. mymp3.mobi
96. samwep.com
97. spicyfm.com
98. wapindia.net
99. wapmaza.mobi
100. waprocks.in
101. mobidreamz.com
102. waptamil.net
103. zinkwap.com
104. songs.pk
Source: Internet
Thursday, December 8, 2011
Subscribe to:
Posts (Atom)