Search the Community
Showing results for tags 'session'.
-
Hi, I am using following function to get online users count. But it appears that there is no permission for reading content of that dir. Can you help me please? Server: tommy function onlineUsers() { $i = 0; $path = session_save_path(); if (trim($path)=="") { return FALSE; } $d = dir($path); while (false !== ($entry = $d->read())) { if ($entry!="." and $entry!="..") { if (time()- filemtime($path."/$entry") < 1 * 60) { $i++; } } } $d->close(); return $i; }
-
Hi, I just transferred my local files to the server. But it seems my sessions are not working. But all of them work fine in the localhost. So, I'm sure the code works fine. But only problem is that those working sessions are not working in the server. Event the header('location: ../index.php'); didn't work please help me. Thanks.
-
Hello, I've done a lot of research but cannot figure out how to make session variables created on one subdomain or root domain accessible to all other subdomains of that root domain. For example, if I login to my account on https://valid.studius.gq, the login php script sets the session variable "logged_in" to true. This allows access to all pages that are protected within the subdomain. However, the same session variable is not valid at https://matic.studius.gq and it redirects back to the login page. Any and all suggestions are appreciated. Thank you.
-
when i execute code on my localhost and on 000webhost then it works fine but shows error on this host . my php file's php code is this <?php // define variables and set to empty values $email = $password = ""; $errors = array(); if ($_SERVER["REQUEST_METHOD"] == "POST") { $con=mysqli_connect("localhost","deep958","<removed>"); mysqli_select_db($con,"deep958_togetherwe"); if (empty($_POST["email"])) { $errors['email'] = "Email is required"; } else { $email = test_input($_POST["email"]); // check if e-mail address is well-formed if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { $errors['email'] = "Invalid email format"; } else{ $a="select * from signup where email= '$email'"; $aresult=mysqli_query($con,$a); $anum=mysqli_num_rows($aresult); $b="select * from login where email= '$email'"; $bresult=mysqli_query($con,$; $bnum=mysqli_num_rows($bresult); if($anum==1) {$errors['email'] = "This email is not verified.Click <a href='\New folder\confirmation.php'>here</a> to verify it.";} elseif($bnum==0) {$errors['email'] = "This email doesn't exist. Plz click <a href='\New folder\signup.php'>here</a> to sign up";} } } if (empty($_POST["password"])) { $errors['password'] = "Password is required"; } else { $password = $_POST["password"]; // check if password is well-formed if (!preg_match_all('$\S*(?=\S{6,})(?=\S*[a-z])(?=\S*[A-Z])(?=\S*[\d])(?=\S*[\W])\S*$', $password)){ $errors['password'] = "Invalid password"; } else{ $row=mysqli_fetch_array($bresult); $bpassword=$row['password']; if($password != $bpassword) $errors['password']= "password is incoreecrt"; } } if(count($errors)==0) { session_start(); $_SESSION['user']="$email"; header("Location: /public_html/New folder/videos.php"); exit(); } } function test_input($data) { $data = trim($data); $data = stripslashes($data); $data = htmlspecialchars($data); return $data; } ?> and errors that it is showing is in the image