-
Posts
522 -
Joined
-
Last visited
Everything posted by budimir
-
OK, that's good. Now, remove your die; from the script. And echo the $num_rows to see if you getting the correct number of records. Also if( $num_rows > 0 ) { $_SESSION['username'] = $username; //redirect $data = mysql_fetch_array($results); echo "$data['company']"; //take this so we could see if your getting the correct value header("Location: {$data['company']}.php"); }
-
OK, so can you repeat your question??? I'm confused a little bit!!
-
No, you need to put it outside an if statment. Put it immediatly after this line: $sql = "SELECT * FROM access WHERE username='" . $username . "' and company = '" . $company . "'"; echo "$sql"; //This will show the query die; // This will stop the script from executing further on and it will be easier to see the result of the query $result = mysql_query($sql,$link) or die(mysql_error()); $num_rows = mysql_num_rows($result);
-
No, you need, include( 'sessions.php' ); , on every page after a user has been loged in. In this file you can keep all the data about your user and the session.
-
OK, so let's rework your code a little bit! Do it like this: $sql = "SELECT * FROM access WHERE username='" . $username . "' and company = '" . $company . "'"; $result = mysql_query($sql,$link) or die(mysql_error()); $num_rows = mysql_num_rows($result); and then you put: echo "$sql"; So we could see what is happening with you query and then will see if you're getting the correct values.
-
Can you echo your query, so we could see if it's getting all the variables it needs?? Also, remove include ('sessions.php'); form loign check page, you don't need it there since you didn't start you're session yet. Also check if your getting anything in variables $username and $company!!!
-
You need to put this include( 'sessions.php' ); in every page of your site! (at the top!!!!)
-
Click on Topic solved!!!
-
Hey, yes he meant to put both codes to one page, but that could be confusing. Try to do it like this, it will be much easier and easier to track the problems. 1.) Create a login.php page where a User needs to put his username and pass 2.) Create a checklogin.php page where you will check if the user was found and redirect him to the page where he needs to go 3.) Create a session.php page where you will start your session() and kepp all the info about the session for that user (you need to include session.php to the top of each page and then when someone wnats to copy and paste the link it will be redirected to the logout page) I hope it gave I little bit clearer picture!
-
You need to put valign to DIV.
-
It's this peace of coed that is reporting that! error_reporting(E_ALL); It's not a big deal, just turn of error reporting and everything will be fine! You will see alot of times Undefined index. == is eqaual to != is not equal to
-
Do you have the privilegies to do the mysqldump?????
-
OK, I think I get where is the problem. The script can't be in the same file from which I'm calling the redirect. I need to take it to another file, than it's working. So, it would be. Index.php -> resolution.php -> index_h.php or index_l.php
-
The files a re in the same dir. I think the problem is that it can't load the file in which is this script. The file name that has the script is index.php!
-
Hey guys, Why isn't this script working? It's a script for redirecting to antoher file depending on the resoultion. But when I load a file it just does nothing. <SCRIPT language="JavaScript"> <!-- if ((screen.width >= 1024) && (screen.height >= 768)) { window.location="index.php"; } else { window.location="index_glavni_m.php"; } //--> </SCRIPT> Help, please!!!!!
-
OK, It's now what I was actually looking for, but I did get an idea. Thanks, guys.
-
Hey Guys, Does anyone have an idea, how could I display how many users is connected to a mysql database? All of them who are runing queries on the database.
-
how to enable windows login dialog in php/apache
budimir replied to sunilvadranapu's topic in PHP Coding Help
I don't think that is possible in Apache! -
how to enable windows login dialog in php/apache
budimir replied to sunilvadranapu's topic in PHP Coding Help
You're posting your question on a wrong forum. You have a section for this. I assume that you are asking how to protect access to the phpmyadmin, or something like that For phpmyadmin, you need to access config.inc.php and change line number 71 to $cfg['Servers'][$i]['auth_type'] = 'http'; So when you try to access phpmyadmin it will pop up a window and ask you for the username and password. Correct me if I have missunterstood? -
You can not echo a connection to the DB! The error message you can put $epikcon = mysql_pconnect($hostname_epikcon, $username_epikcon, $password_epikcon) or die (mysql_error()); So, if the program doesn't stop here, your connection is successfull.
-
Yes, in a little bit diferent way than I wanted. I'm loging out everyone after 3 hours. Still nothing hapening when I close web browser. Can't figure out why.
-
I've done that too.
-
Yes, I have even restarted my computer to be sure!
-
No, I'm not doing that! I start clean FireFox and session is still in. Same thing happens with the IE7.
-
Here is my check_login.php <?php session_start(); include ("admin/servis/include/db.php"); // Define $myusername and $mypassword $myusername=$_POST['myusername']; $mypassword=$_POST['mypassword']; $sql="SELECT * FROM korisnici WHERE korisnicko_ime='$myusername' and lozinka='$mypassword'"; $result=mysql_query($sql) or die (mysql_error()); // Mysql_num_row is counting table row $count=mysql_num_rows($result); // If result matched $myusername and $mypassword, table row must be 1 row if($count==1){ $upd = "UPDATE korisnici SET session_id='".session_id()."', aktivan = 'ON' WHERE korisnicko_ime='$myusername' and lozinka='$mypassword'"; mysql_query($upd) or die (mysql_error()); header("location:index_glavni.php"); exit; } else { echo "Upisali ste krivo Korisničko ime ili Lozinku!"; } ?> And here is my session.php <?php session_start(); $session_id = session_id(); include("db.php"); $upit = "SELECT * FROM korisnici WHERE session_id = '$session_id' && aktivan = 'ON'"; $rezultat = mysql_query($upit,$veza) or die (mysql_error()); $row = mysql_fetch_array($rezultat); $user_id = $row["id"]; $ime = $row["ime"]; $korisnicko_ime = $row["korisnicko_ime"]; $prezime = $row["prezime"]; $userData["status"] = $row["status"]; $lozinka = $row["lozinka"]; $status = $row["status"]; $aktivan = $row["aktivan"]; $sesija_id = $row["session_id"]; if (!$user_id){ header("Location:../../logoutd.php"); exit; } $_SESSION['session_time'] = time(); //got the login time for user in second $session_logout = 90; //it means 15 minutes. //and then cek the time session if($session_logout >= $_SESSION['session_time']){ //user session time is up // update status $upit = "UPDATE korisnici SET session_id = '0', aktivan = 'OFF' WHERE korisnicko_ime='$korisnicko_ime' and lozinka='$lozinka'"; $rezultat = mysql_query($upit,$veza) or die (mysql_error()); //destroy the session session_destroy(); //redirect to login page header("Location:../../../index.php"); exit; } ?> Why is not loging out, when I close my browser????