how to access profile after login?
im having trouble accessing profile page after login and I also have
another problem I have login data such as email and password in a
different database and table name profile information is in another
database and table name how can they be connected to retrieve profile
information how can these problems be resolved?
here is my login php
<?php
include('com.php');
// Connect to server and select databse.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
// username and password sent from form
$email=$_POST['email'];
$password=$_POST['password'];
// To protect MySQL injection (more detail about MySQL injection)
$email = stripslashes($email);
$password = stripslashes($password);
$email = mysql_real_escape_string($email);
$password = mysql_real_escape_string($password);
$sql="SELECT * FROM $tbl_name WHERE email='$email' and
password='$password'";
$result=mysql_query($sql);
// Mysql_num_row is counting table row
$count=mysql_num_rows($result);
// If result matched $email and $password, table row must be 1 row
if($count==1){
// Register $email, $password and redirect to file "report.php"
session_register("email");
session_register("password");
header("location:profile.php");
}
else {
echo "Wrong Username or Password";
}
?>
Monday, 2 September 2013
ajaxContact form responseText smooth fade in
ajaxContact form responseText smooth fade in
Iam setting up this contact form and I need it to behave the same way as
other elements so my question is, how can I ad a smooth fade-in of the
responseText in this script?
$(document).ready(function() {
var options = {
target: '#contact-response',
beforeSubmit: showRequest,
success: showResponse
};
$('#contactForm').ajaxForm(options);
});
function showRequest(formData, jqForm, options) {
var queryString = $.param(formData);
return true;
}
function showResponse (responseText, statusText) {
}
$.fn.clearForm = function() {
return this.each(function() {
var type = this.type, tag = this.tagName.toLowerCase();
if (tag == 'form')
return $(':input',this).clearForm();
if (type == 'text' || type == 'password' || tag == 'textarea')
this.value = '';
else if (type == 'checkbox' || type == 'radio')
this.checked = false;
else if (tag == 'select')
this.selectedIndex = -1;
});
};
Thank you
Iam setting up this contact form and I need it to behave the same way as
other elements so my question is, how can I ad a smooth fade-in of the
responseText in this script?
$(document).ready(function() {
var options = {
target: '#contact-response',
beforeSubmit: showRequest,
success: showResponse
};
$('#contactForm').ajaxForm(options);
});
function showRequest(formData, jqForm, options) {
var queryString = $.param(formData);
return true;
}
function showResponse (responseText, statusText) {
}
$.fn.clearForm = function() {
return this.each(function() {
var type = this.type, tag = this.tagName.toLowerCase();
if (tag == 'form')
return $(':input',this).clearForm();
if (type == 'text' || type == 'password' || tag == 'textarea')
this.value = '';
else if (type == 'checkbox' || type == 'radio')
this.checked = false;
else if (tag == 'select')
this.selectedIndex = -1;
});
};
Thank you
ActiveReport Truncate A Text
ActiveReport Truncate A Text
I make a Report in ActiveReport3.0 which has a Subreport. In my subreport,
in the Detail part actually, I have a textbox , that I bind my value to
the textbox.datafield. my value is a text in persian and it is also
long(about 8000 words).( I read the Value from Sql).I set the alignment of
the textbox to "rtl" because my text is in persian. then when I run my
app, the activereport truncate my text in persian (truncate it from left
and right of the textbox not at the bottom).what is the problem?
I make a Report in ActiveReport3.0 which has a Subreport. In my subreport,
in the Detail part actually, I have a textbox , that I bind my value to
the textbox.datafield. my value is a text in persian and it is also
long(about 8000 words).( I read the Value from Sql).I set the alignment of
the textbox to "rtl" because my text is in persian. then when I run my
app, the activereport truncate my text in persian (truncate it from left
and right of the textbox not at the bottom).what is the problem?
image upload by webcam in php
image upload by webcam in php
<form action="<?php echo $_SERVER["PHP_SELF"];?>" method="post">
<input type="text" name="myname" id="myname">
<input type="submit" name="send" id="send">
</form>
<script type="text/javascript" src="webcam.js"></script>
<script language="JavaScript">
document.write( webcam.get_html(320, 240) );
</script>
<form>
<input type=button value="Configure..." onClick="webcam.configure()">
<input type=button name="img" value="Take Snapshot"
onClick="take_snapshot()">
</form>
<script language="JavaScript">
document.write( webcam.get_html(320, 240) );
</script>
<script language="JavaScript">
webcam.set_api_url( 'test.php' );
webcam.set_quality( 90 ); // JPEG quality (1 - 100)
webcam.set_shutter_sound( true ); // play shutter click sound
webcam.set_hook( 'onComplete', 'my_completion_handler' );
function take_snapshot(){
// take snapshot and upload to server
document.getElementById('upload_results').innerHTML =
'<h1>Uploading...</h1>';
webcam.snap();
}
function my_completion_handler(msg) {
// extract URL out of PHP output
if (msg.match(/(http\:\/\/\S+)/)) {
// show JPEG image in page
document.getElementById('upload_results').innerHTML
='<h1>Upload Successful!</h1>';
// reset camera for another shot
webcam.reset();
}
else {alert("PHP Error: " + msg);
}
</script>
<div id="upload_results" style="background-color:#eee;"></div>
I am working in the php language , I am trying to upload the image from
webcam and want to save it on my pc , webcam is working fine it is opening
the webcom but i click on the take_snapshot , it does nothing ........I
having a problem in understanding the java script part and what is
happening when take_snapshot button is clicked
<form action="<?php echo $_SERVER["PHP_SELF"];?>" method="post">
<input type="text" name="myname" id="myname">
<input type="submit" name="send" id="send">
</form>
<script type="text/javascript" src="webcam.js"></script>
<script language="JavaScript">
document.write( webcam.get_html(320, 240) );
</script>
<form>
<input type=button value="Configure..." onClick="webcam.configure()">
<input type=button name="img" value="Take Snapshot"
onClick="take_snapshot()">
</form>
<script language="JavaScript">
document.write( webcam.get_html(320, 240) );
</script>
<script language="JavaScript">
webcam.set_api_url( 'test.php' );
webcam.set_quality( 90 ); // JPEG quality (1 - 100)
webcam.set_shutter_sound( true ); // play shutter click sound
webcam.set_hook( 'onComplete', 'my_completion_handler' );
function take_snapshot(){
// take snapshot and upload to server
document.getElementById('upload_results').innerHTML =
'<h1>Uploading...</h1>';
webcam.snap();
}
function my_completion_handler(msg) {
// extract URL out of PHP output
if (msg.match(/(http\:\/\/\S+)/)) {
// show JPEG image in page
document.getElementById('upload_results').innerHTML
='<h1>Upload Successful!</h1>';
// reset camera for another shot
webcam.reset();
}
else {alert("PHP Error: " + msg);
}
</script>
<div id="upload_results" style="background-color:#eee;"></div>
I am working in the php language , I am trying to upload the image from
webcam and want to save it on my pc , webcam is working fine it is opening
the webcom but i click on the take_snapshot , it does nothing ........I
having a problem in understanding the java script part and what is
happening when take_snapshot button is clicked
Sunday, 1 September 2013
JSON-SIMPLE Can't cast to object to read through array
JSON-SIMPLE Can't cast to object to read through array
I'm trying to use JSON-Simple to read a configuration file that's in JSON
using the following code
File f = new File("config.json");
JSONParser parser = new JSONParser();
try {
int i;
StringBuilder out = new StringBuilder();
FileReader reader = new FileReader(f);
while ((i = reader.read()) != -1) {
out.append((char) i);
}
JSONArray array = (JSONArray) JSONValue.parse(out.toString());
} catch (Exception e) {
System.out.println(e.toString());
}
or
File f = new File("config.json");
JSONParser parser = new JSONParser();
try {
Object obj = parser.parse(new FileReader(f));
JSONObject jsonObject = (JSONObject) obj;
JSONArray array = (JSONArray) jsonObject.get("module");
Iterator<String> itreator = array.iterator();
while (itreator.hasNext()) {
System.out.println(itreator.next());
}
} catch (FileNotFoundException fnf) {
fnf.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
but both are returning the error
org.json.simple.JSONObject cannot be cast to org.json.simple.JSONArray
however when doing
File f = new File("config.json");
try {
System.out.println(JSONValue.parse(new FileReader(f)));
} catch (Exception e) {
System.out.println(e.toString());
}
it returns the file's contents.
The config file can be seen here: http://pastebin.com/5xJTHSwj
I'm trying to use JSON-Simple to read a configuration file that's in JSON
using the following code
File f = new File("config.json");
JSONParser parser = new JSONParser();
try {
int i;
StringBuilder out = new StringBuilder();
FileReader reader = new FileReader(f);
while ((i = reader.read()) != -1) {
out.append((char) i);
}
JSONArray array = (JSONArray) JSONValue.parse(out.toString());
} catch (Exception e) {
System.out.println(e.toString());
}
or
File f = new File("config.json");
JSONParser parser = new JSONParser();
try {
Object obj = parser.parse(new FileReader(f));
JSONObject jsonObject = (JSONObject) obj;
JSONArray array = (JSONArray) jsonObject.get("module");
Iterator<String> itreator = array.iterator();
while (itreator.hasNext()) {
System.out.println(itreator.next());
}
} catch (FileNotFoundException fnf) {
fnf.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
but both are returning the error
org.json.simple.JSONObject cannot be cast to org.json.simple.JSONArray
however when doing
File f = new File("config.json");
try {
System.out.println(JSONValue.parse(new FileReader(f)));
} catch (Exception e) {
System.out.println(e.toString());
}
it returns the file's contents.
The config file can be seen here: http://pastebin.com/5xJTHSwj
Jquery applying class and removing class
Jquery applying class and removing class
The code which changes the active class to the currently clicked
pagination class. Removing it works but adding the new class doesn't work.
http://jsfiddle.net/spadez/qKyNL/35/
$('a').click(function(event){
event.preventDefault();
var number = $(this).attr('href');
$.ajax({
url: "/ajax_json_echo/",
type: "GET",
dataType: "json",
timeout: 5000,
beforeSend: function () {
$('#content').fadeTo(500, 0.5);
},
success: function (data, textStatus) {
// TO DO: Load in new content
$('html, body').animate({
scrollTop: '0px'
}, 300);
// TO DO: Change URL
$('#pagination li.active').removeClass("active");
$(this).parent().addClass("active");
},
error: function (x, t, m) {
if (t === "timeout") {
alert("Request timeout");
} else {
alert('Request error');
}
},
complete: function () {
$('#content').fadeTo(500, 1);
}
});
});
Can anyone please tell me where I am going wrong?
The code which changes the active class to the currently clicked
pagination class. Removing it works but adding the new class doesn't work.
http://jsfiddle.net/spadez/qKyNL/35/
$('a').click(function(event){
event.preventDefault();
var number = $(this).attr('href');
$.ajax({
url: "/ajax_json_echo/",
type: "GET",
dataType: "json",
timeout: 5000,
beforeSend: function () {
$('#content').fadeTo(500, 0.5);
},
success: function (data, textStatus) {
// TO DO: Load in new content
$('html, body').animate({
scrollTop: '0px'
}, 300);
// TO DO: Change URL
$('#pagination li.active').removeClass("active");
$(this).parent().addClass("active");
},
error: function (x, t, m) {
if (t === "timeout") {
alert("Request timeout");
} else {
alert('Request error');
}
},
complete: function () {
$('#content').fadeTo(500, 1);
}
});
});
Can anyone please tell me where I am going wrong?
Using a Usercontrol inside Datatemplate
Using a Usercontrol inside Datatemplate
I have a datatemplate like this: <DataTemplate x:Key="TplFullImages"
DataType="{x:Type cControl:FullVisableImageControl}"> </DataTemplate>
cControl:FullVisableImageControl is my usercontrol However I still need
the Usercontrol to have the parameters when it initialises. How can I
achieve this? Or what options do I have?
I have a datatemplate like this: <DataTemplate x:Key="TplFullImages"
DataType="{x:Type cControl:FullVisableImageControl}"> </DataTemplate>
cControl:FullVisableImageControl is my usercontrol However I still need
the Usercontrol to have the parameters when it initialises. How can I
achieve this? Or what options do I have?
Subscribe to:
Posts (Atom)