Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About hariskar

  • Rank
  • Birthday 05/20/1970

Contact Methods

  • Website URL

Profile Information

  • Location

Recent Profile Visitors

7,145 profile views
  1. With php registered users have access, each to their own results when they click to www.site.com/results. The results are pdf. So when a user clicks on results he can see a page with the links to all the pdf of his results. The problem is that if someone copies and pastes this link he can also see the results even if he is not registered. How could I avoid this? Here is the code: Thank you! <?php if ($_SESSION['username']=="user1") { readfile("https://www.site.com/results/user1.html"); } elseif($_SESSION['username']=="user2") { readfile("https://www.site.com/results/user2"); } else { ?> <p>Αν θέλετε να μπορείτε να βλέπετε τα αποτελέσματά σας online και να τα κατεβάζετε σε μορφή pdf παρακαλώ <b>ενημερώστε μας</b> προφορικά, με email ή συμπληρώνοντας τη <a href="forma -epikoinonias">φόρμα επικοινωνίας</a> και <a href="https://www.site.com/user/register">εγγραφείτε στην ιστοσελίδα μας</a>.</p> <?php } ?>
  2. I was not very clear: Problem solved. I have one db connection in included file and a second in the main file. I had to put $db->exec("SET CHARACTER SET utf8;"); in both files after each connection to solve the problem.
  3. In included config.php I changed $db->exec("SET NAMES 'utf8';"); to $db->exec("SET CHARACTER SET utf8;"); but the problem remains: Greek username is correct in mysql with Greek characters being correctly displayed, but last_login still does not update for usernames in Greek. Edit: I had to put it again, because I had a 2nd connection to the db. Thank you!
  4. Thank you but I can not understand what is happening: since there is $db->exec("SET NAMES 'utf8';"); in the included file, the username registers correctly in mysql and login/php works fine. The only problem is that when a user with Greek username logs in last_login in mysql does not update. Is there anything wrong with this line? : $sql = "UPDATE members SET last_login=now() WHERE username='$username' ";
  5. last_login in mysql is updated correctly when username is in Latin characters but not updated when in Greek. Here is the code: <?php //include config require_once('includes/config.php'); $username = $_POST['username']; $password = $_POST['password']; if($user->login($username,$password)){ $servername = "xxx"; $dbuser = "xxx"; $dbpass = "xxx"; $dbname = "xxx"; $conn = new mysqli($servername, $dbuser, $dbpass, $dbname); $sql = "UPDATE members SET last_login=now() WHERE username='$username' "; if ($conn->query($sql) === FALSE) {echo "Error updating record: " . $conn->error;}} //check if already logged in move to home page if( $user->is_logged_in() ){ header('Location: register'); } //process login form if submitted if(isset($_POST['submit'])){ $username = $_POST['username']; $password = $_POST['password']; if($user->login($username,$password)){ $_SESSION['username'] = $username; header('Location: /apotelesmata'); exit; } else { $error[] = 'Λάθος όνομα χρήστη ή κωδικός ή ο λογαριασμός σας δεν έχει ενεργοποιηθεί ακόμα.'; }}//end if submit //define page title $title = 'Login'; ?> and here is the included config.php <?php ob_start(); session_start(); //set timezone date_default_timezone_set('Europe/Athens'); //database credentials define('DBHOST','xxx'); define('DBUSER','xxx'); define('DBPASS','xxx'); define('DBNAME','xxx'); //application address define('DIR','http://www.mikroviologos.gr/'); define('SITEEMAIL','xxx@xxx.xx'); try { //create PDO connection $db = new PDO("mysql:host=".DBHOST.";dbname=".DBNAME, DBUSER, DBPASS); $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $db->exec("SET NAMES 'utf8';"); } catch(PDOException $e) { //show error echo '<p class="bg-danger">'.$e->getMessage().'</p>'; exit; } //include the user class, pass in the database connection include('classes/user.php'); include('classes/phpmailer/mail.php'); $user = new User($db); ?> In the included config.php there is a line $db->exec("SET NAMES 'utf8';"); but the problem still exists. Could you please help me on that? Thank you!
  6. It works with display:block!I would never find this myself... I made the html this way, because I want the transparent non hover border and the blue hover border to be over the image edges and not around/externally of the image with the image smaller. Is there a simpler way to do this? Thank you!
  7. Why does the border on hover that appears on the 4 smaller pictures not fall exactly on the pictures edge, but at the bottom it is about 7px lower and leaves an empty space? http://www.mikroviologos.gr/test2 Thank you!
  8. In my webpage I would like to put an image in the text logo I have now. I would like the image to be in the right of mikroviologos.gr. Now the code is: <div id="logoArea" class="col-3" title="Μικροβιολογικό Εργαστήριο στην Καβάλα"><h1><a href=/><div id="l1">mikroviologos.gr</div><div id="l2">Εργαστήριο Μικροβιολογίας</div></a></h1></div> If I change it to <div id="logoArea" class="col-3" title="Μικροβιολογικό Εργαστήριο στην Καβάλα"><h1><a href=/><div id="l1">mikroviologos.gr<img src="image.png"></div><div id="l2">Εργαστήριο Μικροβιολογίας</div></a></h1></div> and try to apply some margin-top the whole logo moves. How can I make only the picture move? I want to align it to the text. Thank you!
  9. I made my site www.mikroviologos.gr without any cms with the valuable help of w3schools lessons and this forum (I had almost no knowledge of html, css, javascript, php, mysql before). My site functions as it should but I think I don't like my design so much. Of course I still have no logo, but the rest of the design seems too simple and maybe old fashioned. Of course I would not like something very modern.. My problem is I can't decide what is wrong and what should I change.. I think I don't like the main picture being so big, but if I made it smaller, it would be narrower than the text. Please feel free to make any comment, not only about the design. Thank you!!
  10. I added $db->exec("SET NAMES 'utf8';"); in php and now usernames are stored correctly in mysql. Thank you!
  11. In a member register form how can I add a validation rule to allow only latin characters for username and password? Today a member registered and put in Greek characters and the result in mysql is Σοφία Δέδε ... (In mysql collation is utf8_general_ci). How can I avoid this? Thank you!
  12. <style> div.img {margin:5px;border:1px solid #ccc;float:left;width:220px;} div.img:hover {border:1px solid #777;} div.img img {width:100%;height:auto;} div.desc {padding:15px;text-align:center;} .img {cursor:pointer;transition:0.3s;} .image:hover {opacity:0.7;} /* The Modal (background) */ .modal { display:none; /* Hidden by default */ position:fixed; /* Stay in place */ z-index:1; /* Sit on top */ padding-top:100px; /* Location of the box */ left:0; top:0; width:100%; /* Full width */ height:100%; /* Full height */ overflow:auto; /* Enable scroll if needed */ background-color:rgb(0,0,0); /* Fallback color */ background-color:rgba(0,0,0,0.9); /* Black w/ opacity */ } /* Modal Content (image) */ .modal-content {margin:auto;display:block;max-width:100%;} /* Add Animation */ .modal-content, #caption {-webkit-animation-name:zoom;-webkit-animation-duration:0.6s;animation-name:zoom;animation-duration:0.6s;} @-webkit-keyframes zoom { from {-webkit-transform:scale(0)} to {-webkit-transform:scale(1)} } @keyframes zoom { from {transform:scale(0)} to {transform:scale(1)} } /* The Close Button */ .close{position:absolute;top:15px;right:35px;color:#f1f1f1;font-size:40px;font-weight:bold;transition:0.3s;} .close:hover,.close:focus{color:#bbb;text-decoration:none;cursor:pointer;} /* 100% Image Width on Smaller Screens */ @media only screen and (max-width:700px){.modal-content {width:100%;}} @media screen and (max-width:900px) {#content {margin-bottom:120px}} </style> <div id="content" class="col-9"> <h1>Φωτογραφίες</h1> <div class="img"><img class="image" src="http://s.mikroviologos.gr/image/aithousa_anamonis_1.jpg" alt="Αίθουσα αναμονής 1"></div> <div class="img"><img class="image" src="http://s.mikroviologos.gr/image/aithousa_anamonis_2.jpg" alt="Αίθουσα αναμονής 2"></div> <div class="img"><img class="image" src="http://s.mikroviologos.gr/image/aithousa_anamonis_3.jpg" alt="Αίθουσα αναμονής 3"></div> <div class="img"><img class="image" src="http://s.mikroviologos.gr/image/fygokentroi.jpg" alt="Φυγόκεντροι"></div> <div class="img"><img class="image" src="http://s.mikroviologos.gr/image/analytes_1.jpg" alt="Αναλυτές 1"></div> <div class="img"><img class="image" src="http://s.mikroviologos.gr/image/analytes_2.jpg" alt="Αναλυτές 2"></div> <div class="img"><img class="image" src="http://s.mikroviologos.gr/image/analytes_3.jpg" alt="Αναλυτές 3"></div> <!-- The Modal --> <div id="myModal" class="modal"> <span class="close">×</span> <img src="http://s.mikroviologos.gr/image/pixel.gif" class="modal-content" id="img01" alt=""> </div> <script> // Get the modal var modal = document.getElementById('myModal'); // Get the image and insert it inside the modal var images = document.getElementsByClassName("image"); for(var i = 0; i < images.length; i++) {images[i].onclick = showCaption;} var modalImg = document.getElementById("img01"); function showCaption(){ modal.style.display = "block"; modalImg.src = this.src; } // Get the <span> element that closes the modal var span = document.getElementsByClassName("close")[0]; // When the user clicks on <span> (x), close the modal span.onclick = function() {modal.style.display = "none";} modal.onclick = function() {modal.style.display = "none";} </script> I think I put all the relative code. It works great, you can see here.
  13. I finished the mobile part and started the desktop part. My css is small, it seems that my only gain will be the elimination of 2-3 float:none.
  14. My css is follows Desktop-first design. Should I convert it to Mobile-first? Would there be any advantages? Would it be smaller? Is there a procedure to find the css parts used from mobile now, keep them and add as media query the desktop parts? Thank you! Here is my css: *{box-sizing:border-box} html{overflow-y:scroll;position:relative;height:100%} header.top{height:92px;width:100%;margin:auto;background-color:#1a3365;border-bottom:2px solid #6e98c2} header>.container{overflow:visible;white-space:nowrap} #nav a{color:#d2dce6;display:block;padding:3px 4px;font-weight:bold} #nav li{margin-left:8px;border:2px solid #6e98c2;border-radius:5px;float:left} #nav li:hover,#nav li:active,#nav li.selected{background-color:#101f3d;border:2px solid #4b80b4} #l1{color:#f2f2f2;font-size:19px} #l2{color:#d2dce6;font-size:14px} #logoArea{display:inline-block;float:none;vertical-align:top;font-weight:bold;font-family:Arial} #logoArea>a{white-space:normal} #logoArea>a div{margin-left:12px} #nav{list-style:outside none none;overflow:hidden;margin:0;padding:0} #navArea{display:inline-block;margin:50px 0 0;position:relative;white-space:nowrap} .container{width:81%;margin:0 auto;max-width:1000px} aside{height:100%;margin:12px 0 15px 0} h1{color:#4a6b98;font-size:21px} h2{font-size:19px} #block1{height:auto;margin-top:14px} #block1 ul{height:auto;padding:0;margin:0} #block1 li{list-style:none;padding:6px;text-align:left;margin:0 6px;border-bottom:1px solid #d9d9d9} #block1 a{display:block;font-weight:bold} #block1 a:hover,#block1 a.selected{color:#262626} #block1 li:first-child{border-top:1px solid #d9d9d9} #block2,#block3{height:auto;background-color:#ecf1f8;border-top:1px solid #fff;box-shadow:1px 1px 3px rgba(0,0,0,0.2);border-radius:5px;padding:10px;margin-top:20px} #block2 h2,#block3 h2{margin:0;font-size:18px} #block2 p,#block3 p,#block2 form{font-size:13px} body{height:100%;background:#fff;margin:0;padding:0;font-family:"Trebuchet MS",Helvetica,Arial;font-size:15px;color:#404040;line-height:1.5} body a{text-decoration:none;color:#4a6b98} footer.col-12{position:relative;bottom:auto;overflow:hidden;min-height:100px;padding-top:0;padding-bottom:0;margin-top:-100px;background-color:#dae4f1;border-top:#6e98c2 2px solid} footer p{font-size:12px;margin:0;line-height:1.43} #iso{float:left;margin-right:5px} #p1,#c{color:#1a3365} #p2{color:#dae4f1} ul.topnav li.icon{display:none} .row::after{content:"";clear:both;display:block} [class*="col-"]{float:left;padding:15px} #wrapper{min-height:100%} aside:after,#content:after{content:"";display:block;padding-bottom:100px} @media screen and (min-width:1001px){#content{margin:26px 0 15px} .col-2{width:16.6667%} .col-3{width:25%} .col-4{width:33.3333%} .col-9{width:75%} .col-12{width:100%} } @media screen and (max-width:1000px){aside:after{padding-bottom:15px} #content h1:first-child{margin:0 auto;display:block} ul.topnav li:not(:first-child){display:none} ul.topnav li.icon{float:right;display:inline-block} #logoArea{display:block;text-align:center} header.top{height:auto} #navArea{display:block;height:30px;margin:1em 15px} [class*="col-"]{width:100%} #nav li{float:none;margin:0;background-color:#1a3365} #nav{position:absolute;left:0;right:0} ul.topnav li.icon{display:inline-block;position:absolute;right:0;top:0} #nav a{font-size:16px} #content{margin-top:0} aside{margin-bottom:0} .container{width:auto} ul.topnav.responsive{position:relative} ul.topnav.responsive li.icon{position:absolute;right:0;top:0} ul.topnav.responsive li{float:none;display:block;margin:0} ul.topnav.responsive li a{display:block;text-align:left} #nav.topnav.responsive>li:not(:first-child):not(:last-child){margin-top:-2px}}
  15. I thought that if the css code for each screen would be eliminated, the message could go away. I have only one small 3366kB css. I can't understand why google suggests this. If I put the code of the css in the head, the message goes away and I get 100/100 for both Desktop and mobile. But noway will I put my css in every single page... This suggestion seems wrong to me.
  • Create New...