Jump to content

dourvas

New Members
  • Posts

    6
  • Joined

  • Last visited

    Never

Everything posted by dourvas

  1. thank u very much for your answer. I think the a.php, b.php and c.php i built (previous post) are enough arguments to convince the server side. Iam waiting for their answer. I will post it here so if enyone have to deal with the same problem he ll find it helpfull..
  2. some new elements on my case. In case someone try to test the urls with the usename and password i wrote to my previous post he will find out that no such problem exists! and he would be rihgt! There are 1-2 hours that the page is working fine! I did nothing! It happened again. after a while the problems will begin again. i squeezed my head to figure out when this is happening. I found out that every 5 days for 3-4 hours the site is working fine. I imagine that something is happening from the server side. an automatic procedure doing something is curing temporary the problem i guess. What this would be? i wrote to the host and i am waiting for answear but as i mentioned before i have already ask them and they answear was to debug my code. So i have to be more specific about what i am asking for What do u thing is going on. What should i do????
  3. i know. no sense at all.... i tried it from many clients of course. it doesn t work. i also tried it to different server. it works fine!!! when i sent email to the company that hosts the page they anwear me that i should debug my code. I think they did not really look into the problem. The probably guessed that it is a coding error because it is more likely to be one... Do u thing that i should ask them for something specific to check for sure? What should i ask them for?? Are we sure that it not a bug coding problem? Do u need the url to check it yourself? i have it up to 2 urls. In the first works fine in the second no.... http://users.sch.gr/idourvas/ http://gym-kassiop.ker.sch.gr/ username: anonymous passwd: anonymous use it to both urls (now the code is not the same because i changed the one trying to solve this) The page belongs to the school i work. I have to deal with the complaints of the students every day. The site have been working fine for 2-3 months. its been 2 weeks i am trying to solve this. i dont have many experience to this because i learned php bulding this. The results was good so i show it to the school board and they decided to use it... You understand that i put myself into a very difficult position..
  4. it is driving me crazy! please somebody help!!! i made 3 simple php files a.php <?php session_start(); $_SESSION['name1'] = "john"; $_SESSION['name2'] = "mary"; echo '<a href="b.php">b</a>'; echo "<br>"; echo '<a href="c.php">c</a>'; ?> b.php <?php session_start(); echo "name1=".$_SESSION['name1']; echo "<br>"; echo '<a href="c.php">c</a>'; ?> c.php <?php session_start(); echo "name1=".$_SESSION['name1']; echo "<br>"; echo "name2=".$_SESSION['name2']; echo "<br>"; echo '<a href="b.php">b</a>'; ?> if i go straight to a.php and follow the link to b.php and from then to c.php and back works fine. if i go first to my index without log in to my system and then follow that route i described it works fine too. if i go to my index, log in to my system and follow the same route it works fine too if i go to my index log in then log out and then go to a.php and follow the rest of the route it does not work. the names does not show. if i keep go from c to b and vice versa it will show the names evantually sometime. (exacly the problem i am trying to solve..) does this help????? my logout php file <?php //Start session session_start(); //Unset the variables stored in session unset($_SESSION['loggedin']); unset($_SESSION['SESS_MEMBER_ID']); unset($_SESSION['SESS_FIRST_NAME']); unset($_SESSION['SESS_LAST_NAME']); unset($_SESSION['SESS_CLASS']); unset($_SESSION['SESS_FATHERSNAME']); unset($_SESSION['SESS_LOGIN']); session_destroy(); ?> <!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=windows-1253" /> <title>Logged Out</title> <link href="loginmodule.css" rel="stylesheet" type="text/css" /> </head> <body> <h1>ÁÐÏÓÕÍÄÅÓÇ </h1> <p align="center"> </p> <h4 align="center" class="err">ÁÐÏÓÕÍÄÅÈÇÊÁÔÅ.</h4> <p align="center"><a href="login-form.php">ÐÁÔÇÓÔÅ ÅÄÙ</a> ÃÉÁ ÍÁ ÓÕÍÄÅÈÅÉÔÅ</p> <p align="center"><a href="../index.php">ÐÁÔÇÓÔÅ ÅÄÙ</a> ÃÉÁ ÍÁ ÅÐÉÓÔÑÅØÅÔÅ ÓÔÇÍ ÁÑ×ÉÊÇ ÓÅËÉÄÁ</p> </body> </html>
  5. i would appreciate if you helped me to fix those errors. i am new at php you see. So, i started working on your notifications. i managed to hash my passwords using md5. In fact i tottaly changed the first file i posted. now is this: <?php session_start(); function checkUserPass($username, $password){ $username = str_replace("'","''",$username); $password = md5($password); // Verify that user is in database $q = "SELECT * FROM members WHERE login='$username' AND passwd='$password'"; $result = mysql_query($q); if(!$result || (mysql_numrows($result) < 1)){ return 1; //Indicates username failure } // Retrieve password from result $member = mysql_fetch_array($result); // Validate that password is correct if($password == $member['passwd']){ $_SESSION['SESS_MEMBER_ID'] = $member['member_id']; $_SESSION['SESS_FIRST_NAME'] = $member['firstname']; $_SESSION['SESS_LAST_NAME'] = $member['lastname']; $_SESSION['SESS_CLASS'] = $member['class']; $_SESSION['SESS_FATHERSNAME'] = $member['fathersname']; $_SESSION['SESS_LOGIN'] = $member['login']; return 0; //Success! Username and password confirmed } else{ return 1; //Indicates password failure } } include '../config_db.php'; //Sanitize the POST values $login = $_POST['login']; $password = $_POST['password']; if (checkUserPass($login, $password) == 0) { $_SESSION['loggedin'] = "ok"; //login ok header("location: ../index.php"); exit(); } else { //Login failed header("location: login-failed.php"); exit(); } ?> as you can see everytime anyone logs in the system redirects him to index page. it works. But the problems are the same. The welcome username message shows. if i refresh the page 1-2 times and the logged in message is gone (i am not logged in anymore). Another refresh may cause the logged in message to show again (logged in again). i am giving you the index page below. As you will see i ve made some changes you suggested <?php session_start(); //error_reporting(E_ALL ^ E_NOTICE); include 'config_paths.php'; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en" > <head> <meta http-equiv="Content-Type" content="text/html; charset=windows-1253" /> <!--CSS --> <link type="text/css" rel="stylesheet" href="screen1.css" media="screen,projection,tv" /> <!-- JAVASCRIPTS --> <script type="text/javascript" src="library.js" ></script> <title> <?php echo $nameofschool; ?> </title> </head> <body> <div id="pageWrapper"> <h1> <?php echo $nameofschool; ?> <span></span> </h1> <div class="mainmenu"> <?php echo $menu; if($_SESSION['loggedin'] !== "ok") { echo '<li class="li_hc"><a href="blog/blog1.php" target="_self" >(Blog)</a><ul class="ul_ch">'; } else { echo '<li class="li_hc"><a href="blog/blog.php" target="_self" > (Blog)</a><ul class="ul_ch">'; } ?> </ul> </div> <div id="container"> <div id="leftside"> <A HREF="javascript:doLink();" onMouseOver="status=url[ct];return true;" onMouseOut="status=''"> <IMG NAME="Ad_Image" SRC="images/image001.jpg" width="650" height= "320" BORDER=0> </A> </div> <div id="rightside"> <?php /*echo "<font face='verdana' size='0,5'>"; echo $nameofschool; echo "<br />"; echo "</font>";*/ ?> <img src="random/randim.php?folder=images" WIDTH="200" HEIGHT="150" alt="our place" /><br /><br /> <p> <?php if ($_SESSION['loggedin']=="ok") { echo "WELCOME.". $_SESSION['SESS_LAST_NAME']; echo "<br>"; echo '<a href="profil.php">PROFIL<br /> <img src="images/profil.gif" width="80" height="62" alt="profil" /> </a>'; if ($_SESSION['SESS_LAST_NAME'] == 'grammateas') { echo "<br><a href='admin/index.php'>ADMIN</a>"; } echo "<br>"; echo "<a href='login/logout.php'>LOGOUT</a>"; echo "<br>"; ?> <!-- GTranslate: http://edo.webmaster.am/gtranslate --> <a href="javascript:doGTranslate('el|en')" title="English" class="gflag" style="background-position:-0px -0px;"><img src="http://joomla-gtranslate.googlecode.com/svn/trunk/mod_gtranslate/tmpl/lang/blank.png" height="24" width="24" alt="English" /></a><a href="javascript:doGTranslate('el|fr')" title="French" class="gflag" style="background-position:-200px -100px;"><img src="http://joomla-gtranslate.googlecode.com/svn/trunk/mod_gtranslate/tmpl/lang/blank.png" height="24" width="24" alt="French" /></a><a href="javascript:doGTranslate('el|de')" title="German" class="gflag" style="background-position:-300px -100px;"><img src="http://joomla-gtranslate.googlecode.com/svn/trunk/mod_gtranslate/tmpl/lang/blank.png" height="24" width="24" alt="German" /></a><a href="javascript:doGTranslate('el|el')" title="Greek" class="gflag" style="background-position:-400px -100px;"><img src="http://joomla-gtranslate.googlecode.com/svn/trunk/mod_gtranslate/tmpl/lang/blank.png" height="24" width="24" alt="Greek" /></a> <style type="text/css"> <!-- a.gflag {font-size:24px;padding:1px 0;background-repeat:no-repeat;background-image:url('http://joomla-gtranslate.googlecode.com/svn/trunk/mod_gtranslate/tmpl/lang/24.png');} a.gflag img {border:0;} a.gflag:hover {background-image:url('http://joomla-gtranslate.googlecode.com/svn/trunk/mod_gtranslate/tmpl/lang/24a.png');} --> </style> <script type="text/javascript" src="http://www.google.com/jsapi"></script> <script type="text/javascript">google.load("jquery", "1.4.2");</script> <script type="text/javascript" src="http://joomla-gtranslate.googlecode.com/svn/trunk/mod_gtranslate/jquery-translate.js"></script> <script type="text/javascript"> //<![CDATA[ if(jQuery.cookie('glang') && jQuery.cookie('glang') != 'el') jQuery(function($){$('body').translate('el', $.cookie('glang'), {toggle:true, not:'.notranslate'});}); function doGTranslate(lang_pair) {if(lang_pair.value)lang_pair=lang_pair.value;var lang=lang_pair.split('|')[1];jQuery.cookie('glang', lang, {path: '/'});jQuery(function($){$('body').translate('el', lang, {toggle:true, not:'.notranslate'});});} //]]> </script> <?php } else { ?> <form method="post" action="login/login-exec.php" id="headerLogin"> <label for="login"><font face="verdana">¼íïìá ÷ñÞóôç:</font></label><br /> <input name="login" id="login" type="text" size="12" /><br /><br /> <label for="password"><font face="verdana">Êùäéêüò:</font></label><br /> <input id="password" name="password" type="password" size="12" /><br /> <input type="submit" name="Submit" class="submit" value="Ïê" /> <br /><br /> <!-- GTranslate: http://edo.webmaster.am/gtranslate --> <a href="javascript:doGTranslate('el|en')" title="English" class="gflag" style="background-position:-0px -0px;"><img src="http://joomla-gtranslate.googlecode.com/svn/trunk/mod_gtranslate/tmpl/lang/blank.png" height="24" width="24" alt="English" /></a><a href="javascript:doGTranslate('el|fr')" title="French" class="gflag" style="background-position:-200px -100px;"><img src="http://joomla-gtranslate.googlecode.com/svn/trunk/mod_gtranslate/tmpl/lang/blank.png" height="24" width="24" alt="French" /></a><a href="javascript:doGTranslate('el|de')" title="German" class="gflag" style="background-position:-300px -100px;"><img src="http://joomla-gtranslate.googlecode.com/svn/trunk/mod_gtranslate/tmpl/lang/blank.png" height="24" width="24" alt="German" /></a><a href="javascript:doGTranslate('el|el')" title="Greek" class="gflag" style="background-position:-400px -100px;"><img src="http://joomla-gtranslate.googlecode.com/svn/trunk/mod_gtranslate/tmpl/lang/blank.png" height="24" width="24" alt="Greek" /></a> <style type="text/css"> <!-- a.gflag {font-size:24px;padding:1px 0;background-repeat:no-repeat;background-image:url('http://joomla-gtranslate.googlecode.com/svn/trunk/mod_gtranslate/tmpl/lang/24.png');} a.gflag img {border:0;} a.gflag:hover {background-image:url('http://joomla-gtranslate.googlecode.com/svn/trunk/mod_gtranslate/tmpl/lang/24a.png');} --> </style> <script type="text/javascript" src="http://www.google.com/jsapi"></script> <script type="text/javascript">google.load("jquery", "1.4.2");</script> <script type="text/javascript" src="http://joomla-gtranslate.googlecode.com/svn/trunk/mod_gtranslate/jquery-translate.js"></script> <script type="text/javascript"> //<![CDATA[ if(jQuery.cookie('glang') && jQuery.cookie('glang') != 'el') jQuery(function($){$('body').translate('el', $.cookie('glang'), {toggle:true, not:'.notranslate'});}); function doGTranslate(lang_pair) {if(lang_pair.value)lang_pair=lang_pair.value;var lang=lang_pair.split('|')[1];jQuery.cookie('glang', lang, {path: '/'});jQuery(function($){$('body').translate('el', lang, {toggle:true, not:'.notranslate'});});} //]]> </script> </form> <?php } ?> </p> <br /> </div> </div> <div id="globalintro"> <br /> <div id="intro"> <div class="t"><div class="b"><div class="l"><div class="r"><div class="bl"><div class="br"><div class="tl"><div class="tr"> TEXT TEXT <br /><br /> <p align="center"><font color="red">ÌåôñçôÞò ÅðéóêÝøåùí:<br /> <SCRIPT LANGUAGE="Javascript" SRC="http://gym-kassiop.ker.sch.gr/gcount12/graphcount.php?page=index&style=led"><!-- //--></SCRIPT> </font></p> </div></div></div></div></div></div></div></div> </div> <br /> </div> <div align="center"> </div> <div id="container1"> <!-- /////////////////////////////////MAIN////////////////////////////////////////// --> <div id="leftside1"> <?php $today= date ("dm"); $qry="SELECT eortologio, date, apoufegmata, pliroforia FROM information WHERE date='$today'"; $result=mysql_query($qry); if($result) { while($grammh = mysql_fetch_array($result)) { echo "<font face='verdana' size='1'>"; echo "<b>ÅÏÑÔÏËÏÃÉÏ</b><br>"; echo $grammh['eortologio']; echo "<br /><br />"; echo "<hr>"; echo "<br /><br />"; echo "<b>Ç ÓÏÖÉÁ ÔÇÓ ÇÌÅÑÁÓ</b><br>"; echo $grammh['apoufegmata']; echo "<br /><br />"; echo "<hr>"; echo "<br /><br />"; echo "<b>Ç ÐËÇÑÏÖÏÑÉÁ ÔÇÓ ÇÌÅÑÁÓ</b><br>"; echo $grammh['pliroforia']; echo "</font>"; echo "<br /><br />"; echo "<hr>"; echo "<br />"; echo "<font face='verdana' size='0.5'>"; echo "ÅðéìåëÞèçêå ï ìáèçôÞò ÄçìÞôñéïò Ðñßöôçò."; echo "</font>"; } } ?> </div> <div id="rightside1"> <p align="center"><font face='verdana' size='1'><b>ÔÅËÅÕÔÁÉÁ ÍÅÁ</b></font></p> <br /> <?php //include 'config_db.php'; $qry="SELECT id, text, date FROM last_news order by id desc"; $result=mysql_query($qry); if($result) { while($grammh = mysql_fetch_array($result)) { echo "<ul>"; echo "<li>"; echo "<font face='verdana' size='1'> Çìåñïìçíßá Äçìïóßåõóçò<b> ".$grammh['date']."</b>."; echo " ".$grammh['text']; echo "</font>"; echo "<br><br>"; echo "</li>"; echo "</ul>"; } } ?> </div> </div> <div> <br /><br /> </div> <div id="profooter" > <br /> <script> //Live weather feeds by freemeteo.com //The use of this script is bound by Freemeteo’s Live Feed Service Agreement, as is published in the following url: http://www.freemeteo.com/default.asp?pid=178&la=1 // You are not allowed to change or delete any part of this script. // Main body background color : FFFFFF // Main body fonts color : 000000 // Header/Footer background color : 6699FF // Header/Footer fonts color : FFFFFF cIfrm="6"; gid="865276_20101213_225757"; </script> <script src="http://www.freemeteo.com/templates/default/HTfeeds.js" type="text/javascript"></script> <br /> </div> <div id="footer"><div> <p>Ï éóôüôïðïò êáôáóêåõÜóôçêå áðï ôïí åêðáéäåõôéêü ÐÅ20 ÉùÜííç Äïýñâá (A.M 210819)<br> Copyright 2010 - <?php echo date('Y') ?> © <a href="mailto:dourvas@gmail.com">ÉùÜííçò Äïýñâáò </a><br /><a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-nc-sa/3.0/88x31.png" /></a></p> <!-- div, #footer --></div></div> <!-- #pageWrapper --></div> <script language="JavaScript1.2"> /* Disable right click script II (on images)- By Dynamicdrive.com For full source, Terms of service, and 100s DTHML scripts Visit http://www.dynamicdrive.com */ var clickmessage="Ôï äåîß êëéê åßíáé áðåíåñãïðïéçìÝíï!" function disableclick(e) { if (document.all) { if (event.button==2||event.button==3) { if (event.srcElement.tagName=="IMG"){ alert(clickmessage); return false; } } } else if (document.layers) { if (e.which == 3) { alert(clickmessage); return false; } } else if (document.getElementById){ if (e.which==3&&e.target.tagName=="IMG"){ alert(clickmessage) return false } } } function associateimages(){ for(i=0;i<document.images.length;i++) document.images[i].onmousedown=disableclick; } if (document.all) document.onmousedown=disableclick else if (document.getElementById) document.onmouseup=disableclick else if (document.layers) associateimages() </script> </body></html>
  6. hallo there, i ve coded a login system using sessions (php - mysql). It was working fine for 2-3 months. Lately some errors are occuring. i can not understand why. when the user tries to login through a login form a query is executing searching into the database for both username and password. if the data are there i just put into sessions-variables some database data. i am giving the php file which executes the button login on the login form <?php session_start(); $errmsg_arr = array(); $errflag = false; include '../config_db.php'; //Function to sanitize values received from the form. Prevents SQL injection function clean($str) { $str = @trim($str); if(get_magic_quotes_gpc()) { $str = stripslashes($str); } return mysql_real_escape_string($str); } //Sanitize the POST values $login = clean($_POST['login']); $password = clean($_POST['password']); //Input Validations if($login == '') { $errmsg_arr[] = 'Login ID missing'; $errflag = true; } if($password == '') { $errmsg_arr[] = 'Password missing'; $errflag = true; } //If there are input validations, redirect back to the login form if($errflag) { $_SESSION['ERRMSG_ARR'] = $errmsg_arr; session_write_close(); header("location: login/login-form.php"); exit(); } //Create query $qry="SELECT * FROM members WHERE login='$login' AND passwd='$password'"; $result=mysql_query($qry); if($result) { if(mysql_num_rows($result) == 1) { //Login Successful session_regenerate_id(); $member = mysql_fetch_assoc($result); $_SESSION['login']= "ok"; $_SESSION['SESS_MEMBER_ID'] = $member['member_id']; $_SESSION['SESS_FIRST_NAME'] = $member['firstname']; $_SESSION['SESS_LAST_NAME'] = $member['lastname']; $_SESSION['SESS_CLASS'] = $member['class']; $_SESSION['SESS_FATHERSNAME'] = $member['fathersname']; session_write_close(); header("location: ../index.php"); exit(); }else { //Login failed header("location: login-failed.php"); exit(); } }else { die("Query failed"); } ?> every page on the site begins with starting a session and then checking if the visitor is logged in. If the visitor is logged in some different data appears in every session along with the message "welcome". i am giving u the starting code of a typical page of my site <?php session_start(); //error_reporting(E_ALL ^ E_NOTICE); if ($_SESSION['login'] == "ok") { $logggedin = true; } else { $logggedin = false; } include 'config_paths.php'; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en" ><head> <meta http-equiv="Content-Type" content="text/html; charset=windows-1253" /> <!-- EDW EINAI TO CSS ARXEIO POY PERIEXEI OLES TIS MORFOPOIHSEIS --> <link type="text/css" rel="stylesheet" href="screen.css" media="screen,projection,tv" /> <!-- EDW KALW OLA TA JAVASCRIPTS --> <script type="text/javascript" src="library.js" ></script> <title> <?php echo $nameofschool; ?> </title> </head> <body> <div id="pageWrapper"> <h1> <?php echo $nameofschool; ?> <span></span> </h1> <div class="mainmenu"> <?php echo $menu; if($logggedin == false) { echo '<li class="li_hc"><a href="blog/blog1.php" target="_self" >(Blog)</a><ul class="ul_ch">'; } else { echo '<li class="li_hc"><a href="blog/blog.php" target="_self" >(Blog)</a><ul class="ul_ch">'; } ?> </ul> </div> <div id="headerLogin"> <p> <?php if($logggedin) { echo "welcome.". $_SESSION['SESS_LAST_NAME']; echo "<br>"; echo "<a href='profil.php'>Ôï Ðñïößë ìïõ</a>"; if ($_SESSION['SESS_LAST_NAME'] == 'administrator') { echo "<br><a href='admin/index.php'>system</a>"; } echo "<br>"; echo "<a href='login/logout.php'>Áðïóõíäåóç</a>"; echo "<br>"; ?> ................................ Whats wrong? Sometimes when the login is fine but after a while (not standard time) it seems that the user is logged out (the session times out? i am not sure). if the user refresh the page from the browser sometimes more than 1 time it will show the user logged in again (the message welcome). Sometimes the login seems that was not happened but refreshing the page results the user s succesfull log in!!! Please help me
×
×
  • 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.