Jump to content

budimir

Members
  • Posts

    522
  • Joined

  • Last visited

Everything posted by budimir

  1. Thanks for your effort, guys! I will digg in to it.
  2. Hey guys, I'm totally new to ajax and I need your help. I tried to find a example on google, but I don't now what to search for. So, what I need is... I have two input boxes and when both of them get values entered by user I want AJAX to display a value. Text field + Text field = Total Value I would appreciate your help. You can point me to a web page, so I can take a look or give me an example. Thanks a lot.
  3. @Mchl I'm not quite sure. It's LG-Nortel LIP-6812D and other's are Cisco IP phones. As I see it it's possible to register the phone, because every phone has an IP adress. So, basiclly, we could register each phone buy recording it's IP adress. But I don't know how to register when a phone is ringing and how to display a number from which call is coming from. I would like to make like a network phonebook and when someone call's the number is displayed and everything is recorder in a database. Ideas??
  4. Hey guys, Is it possible to make a script which would register when an IP phone rings and showed a message! Did anyone tried something like this before??
  5. You have a problem here: $q = "SELECT * FROM pe WHERE staff_id='$staff_id' AND month like '%$month%' AND year like '$year%'"; It should be: $q = "SELECT * FROM pe WHERE staff_id='$staff_id' AND month like '%$month%' AND year like '%$year%'"; Also, try to echo your "q" query? I can't see from wher you are getting $staff_id??
  6. Well, actually I have set the session to last 3 mins, so i could test it. And it's working fine. When it's inactive for more then 3 mins, it goes to logoutd.php page. But the problem is that on logoutd.php page I'm setting some values to 0, and that query is not working. It's not getting username and password for some reason and I can't see why. Username and password I'm getting from session.php and on logoutd.php I'm including that file on top, but for reason it just want show any values??? I have posted both files. Session.php - Here I have user info and logout function. logoutd.php - Here I have a query for setting the values to 0. (for some reason it's not getting values from session.php) Help???
  7. Anyone?????
  8. OK, To sum up. The problem is: When a user is inactive for more then 30 mins he get's redirected to a page called logoutd.php where I'm setting some status. But the status is not set for some reason. I don't know why. Here is the session.php which is redirecting page to logoutd.php <?php session_start(); $session_id = session_id(); include("db.php"); $upit = "SELECT * FROM korisnici WHERE session_id = '$session_id' && aktivan_s = 'ON'"; $rezultat = mysql_query($upit,$veza) or die (mysql_error()); $broj = mysql_num_rows($rezultat); $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"]; $online_vrijeme = $row["online_vrijeme"]; $g_servis = $row["g_servis"]; $g_izvjestaji = $row["g_izvjestaji"]; $g_popis_servisa = $row["g_popis_servisa"]; $g_naljepnice = $row["g_naljepnice"]; $g_poruke = $row["g_poruke"]; $g_taskovi = $row["g_taskovi"]; $g_zadaci = $row["g_zadaci"]; $g_forum = $row["g_forum"]; $g_korisnici = $row["g_korisnici"]; $g_newsletter = $row["g_newsletter"]; $vrsta_korisnika = $row["vrsta_korisnika"]; $_SESSION['logged'] = TRUE; function isLogged(){ if($_SESSION['logged']){ # When logged in this variable is set to TRUE return TRUE; }else{ return FALSE; } } # Log a user Out function logOut(){ $_SESSION = array(); if (isset($_COOKIE[session_name()])) { setcookie(session_name(), '', time()-42000, '/'); } session_destroy(); } # Session Logout after in activity function sessionX(){ $logLength = 120; # time in seconds :: 1800 = 30 minutes $ctime = strtotime("now"); # Create a time from a string # If no session time is created, create one if(!isset($_SESSION['sessionX'])){ # create session time $_SESSION['sessionX'] = $ctime; } else { # Check if they have exceded the time limit of inactivity if(((strtotime("now") - $_SESSION['sessionX']) > $logLength) && isLogged()){ # If exceded the time, log the user out logOut(); # Redirect to login page to log back in header("Location: ../../logoutd.php"); exit; } else { # If they have not exceded the time limit of inactivity, keep them logged in $_SESSION['sessionX'] = $ctime; } } } # Ovo uzrokuje grešku sa beskonacnom petljom!!! (Provjeriti) //if ($broj == 1) //{ // header("Location:index_glavni.php"); // exit; //} else { // header("Location:logoutd.php"); // exit; //} # Run Session logout check sessionX(); ?> Here is the logoutd.php where I'm setting status: <?php include ("admin/servis/include/session.php"); $upit = "UPDATE korisnici SET session_id = '0', aktivan_s = 'OFF' WHERE korisnicko_ime='$korisnicko_ime' and lozinka='$lozinka'"; $rezultat = mysql_query($upit,$veza) or die (mysql_error()); session_destroy(); header("Location:index.php"); exit; ?> This is my last problem for loging out users. Help!!!
  9. You can use a query and select all users from the databse before insert function and then make na if statment where you will check if you already have this info in db. SELECT * FROM users if($_PST["username"] == $username && something else && something else ...){ echo "It's already in the db"; } else { Insert into DB } Hope, that helps!
  10. OK, So, finally the auto logout is working, but still a small problem. When a user is inactiv for 30 mins, it's redirected to logoutd.php page where I set all the status to 0 and then it's redirected to index.php for login. The problem is, the status are not set to 0. Here is the logoutd.php code: <?php include ("admin/servis/include/session.php"); $korisnicko_ime = $_GET["korisnicko_ime"]; $lozinka = $_GET["lozinka"]; $upit = "UPDATE korisnici SET session_id = '0', aktivan_s = 'OFF' WHERE korisnicko_ime='$korisnicko_ime' and lozinka='$lozinka'"; $rezultat = mysql_query($upit,$veza) or die (mysql_error()); session_destroy(); header("Location:index.php"); exit; ?>
  11. OK, I was able to make the script to wrok. But the problem is with redirecting the page!!! It's not redirecting, but show error message!!! This is the error message from Firefox 3: "REDIRECT LOOP. Firefox has detected that the server is redirecting the request for this address in a way that will never complete." I don't see what is causing this BUG. Here is the complete code: <?php session_start(); $session_id = session_id(); $_SESSION['logged'] = TRUE; function isLogged(){ if($_SESSION['logged']){ # When logged in this variable is set to TRUE return TRUE; }else{ return FALSE; } } # Log a user Out function logOut(){ $_SESSION = array(); if (isset($_COOKIE[session_name()])) { setcookie(session_name(), '', time()-42000, '/'); } session_destroy(); } # Session Logout after in activity function sessionX(){ $logLength = 120; # time in seconds :: 1800 = 30 minutes $ctime = strtotime("now"); # Create a time from a string # If no session time is created, create one if(!isset($_SESSION['sessionX'])){ # create session time $_SESSION['sessionX'] = $ctime; }else{ # Check if they have exceded the time limit of inactivity if(((strtotime("now") - $_SESSION['sessionX']) > $logLength) && isLogged()){ # If exceded the time, log the user out logOut(); # Redirect to login page to log back in header("Location: ../../logoutd.php"); exit; }else{ # If they have not exceded the time limit of inactivity, keep them logged in $_SESSION['sessionX'] = $ctime; } } } include("db.php"); $upit = "SELECT * FROM korisnici WHERE session_id = '$session_id' && aktivan_s = '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"]; $online_vrijeme = $row["online_vrijeme"]; $g_servis = $row["g_servis"]; $g_izvjestaji = $row["g_izvjestaji"]; $g_popis_servisa = $row["g_popis_servisa"]; $g_naljepnice = $row["g_naljepnice"]; $g_poruke = $row["g_poruke"]; $g_taskovi = $row["g_taskovi"]; $g_zadaci = $row["g_zadaci"]; $g_forum = $row["g_forum"]; $g_korisnici = $row["g_korisnici"]; $g_newsletter = $row["g_newsletter"]; $vrsta_korisnika = $row["vrsta_korisnika"]; if (!$user_id){ header("Location:logoutd.php"); exit; } # Run Session logout check sessionX(); ?>
  12. I tried moving it to the top, but still not working... I don't understand why... Any ideas?
  13. Yep, I have put it in a file called session.php which I include on top of eache page. Here is the code of session.php <?php session_start(); $session_id = session_id(); include("db.php"); $upit = "SELECT * FROM korisnici WHERE session_id = '$session_id' && aktivan_s = '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"]; $online_vrijeme = $row["online_vrijeme"]; $g_servis = $row["g_servis"]; $g_izvjestaji = $row["g_izvjestaji"]; $g_popis_servisa = $row["g_popis_servisa"]; $g_naljepnice = $row["g_naljepnice"]; $g_poruke = $row["g_poruke"]; $g_taskovi = $row["g_taskovi"]; $g_zadaci = $row["g_zadaci"]; $g_forum = $row["g_forum"]; $g_korisnici = $row["g_korisnici"]; $g_newsletter = $row["g_newsletter"]; $vrsta_korisnika = $row["vrsta_korisnika"]; function isLogged(){ if($_SESSION['logged']){ # When logged in this variable is set to TRUE return TRUE; }else{ return FALSE; } } # Log a user Out function logOut(){ $_SESSION = array(); if (isset($_COOKIE[session_name()])) { setcookie(session_name(), '', time()-42000, '/'); } session_destroy(); } # Session Logout after in activity function sessionX(){ $logLength = 120; # time in seconds :: 1800 = 30 minutes $ctime = strtotime("now"); # Create a time from a string # If no session time is created, create one if(!isset($_SESSION['sessionX'])){ # create session time $_SESSION['sessionX'] = $ctime; }else{ # Check if they have exceded the time limit of inactivity if(((strtotime("now") - $_SESSION['sessionX']) > $logLength) && isLogged()){ # If exceded the time, log the user out logOut(); # Redirect to login page to log back in header("Location: ../../index.php"); exit; }else{ # If they have not exceded the time limit of inactivity, keep them logged in $_SESSION['sessionX'] = $ctime; } } } if (!$user_id){ header("Location:logoutd.php"); exit; } # Run Session logout check sessionX(); ?>
  14. Hey The Little Guy, Can you give me a little help with that script. It's not working for me... I don't know why???
  15. Thanks, a lot!! I'll try it out!
  16. Hey guys, I need an idea how to do auto logout if user is inactive for more then 30 mins. I tried deifferent ways, but it's not working. Right now I'm using sessions. Is it a better idea to use cookies???? This is my login form now: <?php session_start(); include ("admin/servis/include/db.php"); $vrijeme = date("Y-m-d H:i:s"); // Define $myusername and $mypassword $myusername = mysql_real_escape_string($_POST['myusername'],$veza); $mypassword = mysql_real_escape_string($_POST['mypassword'],$veza); $sql="SELECT * FROM korisnici WHERE korisnicko_ime='$myusername' and lozinka='$mypassword' and aktivan = '1'"; $result=mysql_query($sql,$veza) 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_s = 'ON', online_vrijeme = '$vrijeme' WHERE korisnicko_ime='$myusername' and lozinka='$mypassword'"; mysql_query($upd,$veza) or die (mysql_error()); header("location:index_glavni.php"); exit; } else { header("Location:logoutn.php"); exit; } ?>
  17. Ihaaaaaaaaaa!!!!!! I got it. Thanks for your effort.
  18. OK, So here is the problem: When I try to echo the message which I'm trying to send in the email, it looks OK. When I send the email, the message is all messed up. The encoding I'm using is UTF-8 and it works perfectly, but it does not apply to the email message. Any ideas???
  19. Still not working, I tried that before. It's like it's ignoring the encoding. <?php // Podaci za email poruku $to = "[email protected]"; $subject = "Obavijest o reklamaciji br. XXX"; $headers .= "Content-type: text/plain; charset=utf-8\r\n"; $poruka = "Ovo je obavijest o zaprimljenoj, obraÄ‘enoj i odobrenoj reklamaciji broj XXXX. Dijelovi će biti danas poslani i moĹľete ih oÄŤekivati kroz nekoliko dana"; // Postavke email protokola ini_set('SMTP', 'server'); ini_set('smtp_port', 25); // Slanje emaila if(mail($to,$subject,$poruka,"FROM: [email protected]",$headers)){ echo "Poruka je uspješno poslana na @drezga.hr!"; } else { echo "Poruka nije poslana!"; } ?> Any more ideas??? It's killing me. I don't understand what's wrong. I have tried diferrent encoding types and nothing worked... ???
  20. Hey guys, Does anyone know how to change encoding when sending email with mail(). I'm from Croatia and we have some special characters. My pages display everything OK, but when I send an email with these special chaaracters I get some strange things. This is my code: <?php // Podaci za email poruku $to = "[email protected]"; $subject = "Obavijest o reklamaciji br. XXX"; $poruka = "Ovo je obavijest o zaprimljenoj, obraÄ‘enoj i odobrenoj reklamaciji broj XXXX. Dijelovi će biti danas poslani i moĹľete ih oÄŤekivati kroz nekoliko dana"; // Postavke email protokola ini_set('SMTP', 'server'); ini_set('smtp_port', 25); // Slanje emaila if(mail($to,$subject,$poruka,"FROM: [email protected]")){ echo "Poruka je uspješno poslana na @xx.hr!"; } else { echo "Poruka nije poslana!"; } ?> The result I'm getting is something you can see on the screen!! Does anyone know why is this happening and how to change it??? I really don't know what to do ... I tried everything I new ...
  21. You can try using non fixed width. For example: Instead of - witdth:"250" Use - width:"90%" ???
  22. This one could end up as a sticky. It helps a lot!! Her is another one: When you have a problem with the query, not doing anything and not reporting anything. Problem: $result = mysql_query($sql,$conn); Fix: $result = mysql_query($sql,$conn) or die (mysql_error());
  23. OK, to clarify a little bit more. I have 4 divs, and each one I want to put data I'm getting in this loop. while($row = mysql_fetch_array($rezultat)){ $opis_id = $row["opis_id"]; $opis = $row["opis"]; $datum = $row["datum"]; $unio = $row["unio"]; $lokacija = $row["lokacija"]; $zupanija = $row["zupanija"]; $drzava = $row["drzava"]; $kategorija = $row["kategorija"]; $link = $row["link"]; $naziv = $row["naziv"]; My problem is I wan't to put first row of DB to DIV1, second row of DB to DIV2, third row of DB to DIV3, fourth row of DB to DIV4. How can I tell the program which row need's to go where???
  24. Hey guys, How can I idnetify which row is which. I'm using this code: $upit = "SELECT * FROM opisi JOIN slike ON opisi.opis_id = slike.id ORDER BY datum DESC LIMIT 4"; $rezultat = mysql_query($upit,$veza) or die (mysql_error()); while($values = mysql_fetch_array($rezultat)){ How can I say.. Echo row1 Echo row2 ... Echo row4
  25. You rock guys!!!!!!!!!!!!!!!!! Awesome!!!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.