Sunday, August 5, 2012

Testing HTML And other code

Thsi is some simple text now i will hilight some html code gievn below

this is PHP Code:

<?php $sms = file_get_contents('http://www.alfredfrancis.in/alfasmsapi/?uname=80896*****pass=******&to=8714349616&mess=It works&gateway=way2sms'); echo $sms; ?>

another piece of code:



<?php include("alfa.sms.php"); $result=alfasms("receptiant_mobile_number","Message");   if($result==true)  {  echo "Message sent !";  }  else  {  echo $error;  } ?>

Thsi si c# Code:

private void cmdRegister_Click(object sender, EventArgs e)
        {
            Data.validError =false;
            if (con.State == ConnectionState.Closed) { con.Open(); }
            Data.validate(txtName, "Name", "Required");
            Data.validate(txtUser, "User Name", "Required");
            Data.validate(txtPassword, "Password", "Required");
            Data.validate(cmbLanguage, "Language", "ComboSelect");
            Data.validate(cmbPermission, "Permission", "ComboSelect");
            //Data.validate(cmbClass, "Class", "ComboSelect");
            string query = "";

            if (Data.validError == false)
            {
                if (cmbClass.CheckedItems.Count <= 0)
                {
                    MessageBox.Show("Select at least one class", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    cmbClass.Focus();
                    return;
                }

                string task = "added";
                //Classes
                string currentClass = "";
                foreach (object itemChecked in cmbClass.CheckedItems)
                {
                    currentClass = currentClass + "," + itemChecked;
                }
                currentClass = currentClass.Remove(0, 1);

                if (cmdRegister.Text == "Add User")
                {
                    query = "INSERT INTO tbl_users (name,permission,username,pass,currentclass,userlanguage) values ('" +
                               Data.TitleCase(txtName.Text) + "','" +
                               cmbPermission.Text + "','" +
                               txtUser.Text + "','" +
                               txtPassword.Text + "','" +
                               currentClass + "','" +
                               cmbLanguage.Text + "')";
                }
                else
                {
                    task = "updated";
                    query = "update tbl_users set " +
                            "name='" + txtName.Text + "'," +
                            "permission='" + cmbPermission.Text + "'," +
                            "username='" + txtUser.Text + "'," +
                            "pass='" + txtPassword.Text + "'," +
                            "currentclass='" + currentClass + "'," +
                            "userlanguage='" + cmbLanguage.Text + "'" +
                            " where id=" + editId;
                }
               
                OleDbCommand cmd = new OleDbCommand(query, con);
                if (cmd.ExecuteNonQuery() >= 1)
                {
                    if (task == "updated")
                    {
                        cmdRegister.Text = "Add User";
                        cmdCancel.Visible = false;

                        //If admin chage his own settings
                        if (Data.CurrentUser == txtName.Text)
                        {
                            MessageBox.Show("You changed settings for your own account. Please logout and login again to get effect your new settings", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                        else
                        {
                            MessageBox.Show("User updated successfully", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                    }
                    else
                    {
                        MessageBox.Show("User added successfully", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }

                    //grdResults.Columns["currentclass"].HeaderText = "Class";
                    //txtUser.Text = "";
                    //txtPassword.Text = "";
                    //txtName.Text = "";
                    //cmbClass.Text = "Select CurrentClass";

                    setDefaults();
                    frmUsers_Load(sender, e);
                }
                cmd.Dispose();
            }
            con.Close();
        }

No comments:

Post a Comment