|
what should be the value of it?
Technology News @ www.JassimRahma.com
|
|
|
|
|
time()...But it's should be a one-time initialization...
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
|
|
|
|
|
Problem solved.
Thanks guys
Technology News @ www.JassimRahma.com
|
|
|
|
|
You're welcome!
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
|
|
|
|
|
Guys
I have one more question of you don't mind...
The code I have mentioned will kill the session after specific time, let's say 10minutes regardless of what the user is doing.
Is it possible to have the same code but only when the website is idle (user had no activity on the website)?
Thanks,
Jassim
Technology News @ www.JassimRahma.com
|
|
|
|
|
You can achieve that by updating $_SESSION["timeout"] on any incoming request...
Question: Why you don't using the session timeout feature of your web server?
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
modified 5-May-14 4:18am.
|
|
|
|
|
You can achieve that by updating $_SESSION["timeout"] on any incoming request...
but this will not help if the user didn't post or if the user is typing an long article and still typing until 10 minutes?
Why you don't using the session timeout feature of your web server?
How please?
Technology News @ www.JassimRahma.com
|
|
|
|
|
Jassim Rahma wrote: typing an long article That's an other story! You are talking about while user still on the client side...For that you must have some JavaScript that calls the server in certain intervals (using AJAX probably) to let server know that user still on...Google can find you a lot os samples for that...
Setting session timeout is depends on the web server you are using - see the documentation for your web server...
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
|
|
|
|
|
Ok. I am hosting with Dreamhost.
I will check with them
Thank you so much
Technology News @ www.JassimRahma.com
|
|
|
|
|
You're welcome!
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
|
|
|
|
|
The exit() function stops the script, but does not destroy the Session.
If you intend to destroy the session, use session_destroy(). If you are using cookies to propagate the session, follow with setcookie() to clear the session Id from the user cookie.
Eric Crane
Non Profit Software Corporation
|
|
|
|
|
Hi,
I have a field called created_date in MySQL with UTC_TIMESTAMP values in it
I want to know how can I display the records for that field in the local date/time of the user depends on where he?
Thanks
Jassim
Technology News @ www.JassimRahma.com
|
|
|
|
|
Hi,
I have the following code to check if the user is_administrator then show the two menu items, otherwise of course it won't show... kindly simple! but the problem is.... when I uploaded the pages to my web host, even if the user is not administrator the menu items are shown! the value for is_administrator in MySQL is a bit = 0 but when I do a var_dump I get bool(true) although I get the correct var_dump and behavior on my local pc string(1) "0"
this is the menu items:
<?php if ((bool)$_SESSION["blended_learning_is_administrator"] = true) { ?>
<tr><td><button id="btnManageUsers" type="button" style="width: 100%;">Manage Users</button></td></tr>
<tr><td><button id="btnNewUser" type="button" style="width: 100%;">New User</button></td></tr>
<?php } ?>
and this is the is_administrator:
while ($mysql_row = $mysql_query->fetch())
{
$_SESSION["blended_learning_user_name"] = $mysql_row["user_name"];
$_SESSION["blended_learning_is_administrator"] = $mysql_row["is_administrator"];
exit(header("Location: " . $_SESSION["blended_learning_domain_name"] . "mypage"));
}
Technology News @ www.JassimRahma.com
|
|
|
|
|
I think you need to use the '==' double equals sign to check for equality. One equals sign will assign the value to the variable.
vbmike
|
|
|
|
|
Well, your problem is that you assign the value true to $_SESSION["blabla"] . I.e. it cannot work!
SolutionA:
<?php
if($_SESSION["blended_learning_is_administrator"] == true) {
}
SolutionB:
<?php
if($_SESSION["blended_learning_is_administrator"] === true) {
}
The difference between SolutionA and B is, that B also checks if $_SESSION["bla"] is of the same type as true, i.e. bool/boolean.
|
|
|
|
|
Hi,
I have an Online PHP project which will use both MySQL and Oracle databases.
Which linux distribution you recommend?
Thanks
Jassim
Technology News @ www.JassimRahma.com
|
|
|
|
|
|
how can i check the email is real or not in php?
real not valid ok?
|
|
|
|
|
The simplest way would be to authenticate the given address via a confirmation mail. But even then you cannot be sure that the given address is a "real" one. There are enough throwaway mail providers out there, to make your head spin.
|
|
|
|
|
use php preg
"|^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$|"
|
|
|
|
|
The author was looking for a way to check if the given email address was real. Not for a pattern to validate the string.
|
|
|
|
|
i am working on a project and on a page i get this error.
Parse error: parse error in C:\wamp\www\RMS\comresult.php on line 143
line 143 is the last line of my code.
Please i need help.
Here is my code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Welcome :: Result Portal</title>
<link href="style.css" rel="stylesheet" type="text/css" />
<style type="text/css">
body {
background-color: #FFF;
}
</style>
<script type="text/javascript">
function bk(){
location.assign(document.referrer);
}
var state = true;
function getstate(){
return state;
}
</script>
</head>
<body onload="print()">
= $mysqli-real_escape_string(trim($_GET['lev']));
$sem = $mysqli->real_escape_string(trim($_GET['sem']));
$prog = $mysqli->real_escape_string(trim($_GET['prog']));
$sess = $mysqli->real_escape_string(trim($_GET['sess']));
$sql = "SELECT * FROM course_tb WHERE level LIKE '".$level."' AND semester LIKE '".$sem."'";
if($result = $mysqli->query($sql)){
if($result->num_rows > 0){
$sel = "SELECT DISTINCT regno FROM st_result_data WHERE level LIKE '".$level."' AND semester LIKE '".$sem."' AND programme LIKE '".$prog."'";
if($res = $mysqli->query($sel)){
if($res->num_rows > 0){
//$sel2 = "SELECT * FROM st_result_data WHERE regno LIKE '".$row['regno']."' AND level LIKE '".$level."' AND semester LIKE '".$sem."' AND programme LIKE '".$row['programme']."'";
//if($res2 = $mysqli->query($sel2)){
//if($res2->num_rows > 0){
?>
<table width="700" border="0" cellpadding="0" >
<tr>
<td align="center" style="border-bottom: 1px dashed #CCC;"></td>
</tr>
<tr>
<td height="27" style="border-bottom: 1px dashed #CCC;">
<table width="600" border="0" align="center" cellpadding="0">
<tr>
<td align="center"><h4> SEMESTER RESULT SESSION </h4></td>
</tr>
</table>
<span id="regerr"></span></td>
</tr>
<tr>
<td height="27" style="border-bottom: 1px dashed #CCC;"><table width="650" border="0" align="center" cellpadding="0">
<tr>
<td style="border-bottom: 1px dashed #CCC;">Regno</td>
<td style="border-bottom: 1px dashed #CCC;">Name</td>
<td style="border-bottom: 1px dashed #CCC;">
=$result-fetch_array()){
?>
<table>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
</table>
</td>
</tr>
= $res2-fetch_array()){
?>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table></td>
</tr>
<tr>
<td style="border-bottom: 1px dashed #CCC;"><table width="600" border="0" align="center" cellpadding="0">
<tr>
<td width="177">No of courses:</td>
<td width="417"> </td>
</tr>
<tr>
<td>No of fail:</td>
<td> </td>
</tr>
</table></td>
</tr>
<tr>
<td align="center"> </td>
</tr>
<tr>
<td align="center"><input type="button" name="button" id="button" value="Print" onclick="print()" /></td>
</tr>
</table>
error;
//}
}
}
}
}echo $mysqli->error;
}
?>
</body>
</html>
|
|
|
|
|
|
pls i want to know how to go about how my webpage can respond to sms sent to it from a mobile device
|
|
|
|
|