Jump to content

LeonLatex

Members
  • Posts

    396
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by LeonLatex

  1. Certainly! You can incorporate the admin link into your existing code by checking the user level after the login check. Here's how you might modify your code: Check the user level after confirming that the user is logged in. Display the admin link if the user level is 1. Provide an alternative link for other users. Here’s how you can integrate the admin link into your code: <?php include ("styles/top.php"); ?> <div id="left"> <img src="images/john.png" height="600px" width="300px" /> </div> <div id="right"> <div id="view_box"> <ul> <li><img src="images/1.png" /></li> <!-- <li><img src="pics/2.jpg" /></li> --> <!-- <li><img src="pics/3.jpg" /></li> --> </ul> </div> <div id="button"> <ul> <!-- <li><button class="button" scroll_value="0">*</button></li> --> <!-- <li><button class="button" scroll_value="600">*</button></li> --> <!-- <li><button class="button" scroll_value="1200">*</button></li> --> </ul> </div> <hr /> <?php if (loggedin()) { echo "<h3><font color='Yellow'>Welcome, {$customer_name}</font></h3>"; if ($user_level == 1) { echo "<a href='admin.php'>Admin Panel</a> | "; } else { echo "<a href='user_dashboard.php'>User Dashboard</a> | "; } echo "<h3>Money That Your Due Today</h3>"; echo '<table border="1"> <tr> <th>FULL NAME</th> <th>DATE GOT</th><th>MONEY DUE</th> <th>UPDATE</th> </tr>'; // Your existing code for fetching and displaying order data continues here... // (Insert your existing code for fetching data from the database and displaying it) echo '<tr> <td>&nbsp;</td> <td>TOTAL DUE</td> <td>&pound;' . number_format($totmoney, 2) . '&nbsp;</td> <td></td> </tr>'; echo '</table><br />'; } else { echo '<h3>Login To Your Account</h3>'; echo '<form method="post" action="login.php"> <table cellspacing="10" cellpadding="10"> <tr> <td>Username</td> <td><input type="text" name="username" /></td> </tr> <tr> <td>Password</td> <td><input type="password" name="password" /></td> </tr> <tr> <td></td> <td><input type="submit" name="submit" value="Login To Your Account" /></td> </tr> </table> </form>'; } ?> </div> <?php include ("styles/bottom.php"); ?> Explanation: User Level Check: After confirming the user is logged in, you check if $user_level is 1. If it is, you display the admin link. If not, you can display a different link (like a user dashboard link). Dynamic Links: This makes your application more dynamic, allowing you to cater different content based on user roles. Feel free to adjust the link destinations (admin.php, user_dashboard.php, etc.) to fit your application's structure!
  2. Requinix, i dont know if this a good solution or not. I don't understand what you mean with a tag system. Does it mean to mark some specific image, text, file or directory or something? Is this controlled by a config.php file?
  3. This is being planned, and will have it down on paper for the time being. Actually, the question is not how to set up the database's rows and columns, because I reckon that is the usual way to do it. If it isn't, shout it out. It's when it comes to inserting data, extracting data that it gets a bit confusing. This is a page that is supposed to be about food. E.g. dishes as a category. Or imagine dishes as a topic where there are different dishes such as from different countries. These must then be collected on the food dish from the country that is indicated where the food dish originates, etc., and there may be several subcategories. What is the best way to solve this? This is what I came up with so far. There will probably be more later. Just give me some time so I can get started. Since the last time, my body and I have been on quite a journey. In October 2023 I traveled to Thailand to be there until March 2024. In January 2024 I got food poisoning, and this meant that I was bedridden in the hotel for 2 months. Everything I ate and drank went down into my stomach and returned immediately. Obviously, this resulted in severe dehydration and nutrient absorption. This led to kidney failure and nerve damage throughout the body. I have been and am still seriously ill and am still in a wheelchair in a nursing home. My feet and legs as well as fingers are numb and my fingertips are numb and half numb. That's why I haven't programmed for almost half a year. I also haven't been here on the PHP Freaks forum in as long. As I said, I'm not quite well yet, but I'm getting better and better, and a nerve injury takes a long time to heal.
  4. @maxxd@Strider64 Of course, I do. I don't save a plain-text password in the database Have you read through the thread, you would see that your question is so unnecessary, or am I wrong? The password is saved to the "password_hash" column in db, and id hashed with this: <?php $password = '******'; // Replace the stars with the actual password $hashed_password = password_hash($password, PASSWORD_DEFAULT); echo $hashed_password; // This will output the hashed version of the password for you. Just copy and paste ?>
  5. @mac_gyver, If you look in bottom of my first posting you find my login form. I dont have a registration form yet because so early in the development process i manually put the testing user accounts in mysql manually. I dont have time to use more time on this now, so i will start develop another system, and this time with email confirmation and a confirmation code. Is less use of time to put a new one together than looking for errors in this login system. I dont think there is only one error. The system has going through many changes through the last year, so it's time to let the old one rest. Any way, thanks for using time for trying to help 😃
  6. One of the first things I did was go through the password and username. I checked the db-connection with this one too: <?php $servername = "***.****.********.no"; $username = "*****_*****"; $password = "************"; $database = "*****_*****"; try { $pdo = new PDO("mysql:host=$servername;dbname=$database", $username, $password); $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); echo "Connection successful!"; } catch(PDOException $e) { echo "Error connecting: " . $e->getMessage(); } ?> Then I checked if the hashed password was corect and matched. As a precaution, I set up a new hashed password string using this code, and paste it into the database table users: <?php $password = '******'; // Replace this with the actual password $hashed_password = password_hash($password, PASSWORD_DEFAULT); echo $hashed_password; // This will output the hashed version of the password ?>
  7. Sorry again. There's a little busy here today (every day). The problem is that i get the $error_message = "Feil e-postadresse eller passord."; ...and I dont know why. It has been running fine on another site, but not on this site I am dealing with now. The only difference is the database. I cant find any there. Can you ?
  8. Of course Requinix. Here is that part: <?php // Inkluder skriptet for databasekobling. include_once $_SERVER['DOCUMENT_ROOT'] . '/includes/db.php'; if ($_SERVER['REQUEST_METHOD'] === 'POST') { // Hent brukerregistreringsdata fra skjemaet. $first_name = $_POST['first_name']; $last_name = $_POST['last_name']; $email = $_POST['email']; $password = $_POST['password']; // Dette skal være passordet i klartekst som brukeren oppgir. // Hash brukerens passord før det lagres i databasen. $hashed_password = password_hash($password, PASSWORD_DEFAULT); // SQL-spørring for å sette inn brukeren i databasen. $sql = "INSERT INTO users (first_name, last_name, email, password_hash) VALUES (:first_name, :last_name, :email, :password_hash)"; // Forbered og utfør SQL-setningen. $stmt = $pdo->prepare($sql); $stmt->bindParam(':first_name', $first_name); $stmt->bindParam(':last_name', $last_name); $stmt->bindParam(':email', $email); $stmt->bindParam(':password_hash', $hashed_password); if ($stmt->execute()) { // Brukerregistrering vellykket. echo "Bruker registrert vellykket!"; // Du kan omdirigere brukeren til en påloggingsside eller vise en suksessmelding. } else { // Brukerregistrering mislyktes. echo "Brukerregistrering mislyktes. Prøv igjen senere."; } } ?>
  9. I was setting up a login system that was working till I want it to hash the password. I paste both my user table in the database and login.php. I can't find what's wrong, can you? <?php // Inkluder databasekobling og nødvendige funksjoner include_once $_SERVER['DOCUMENT_ROOT'] . '/includes/db.php'; if ($_SERVER['REQUEST_METHOD'] === 'POST') { // Håndter innloggingsskjemaet som er sendt inn. $email = $_POST['email']; $password = $_POST['password']; // Hent brukerens hashed passord fra databasen basert på e-postadressen $sql = "SELECT * FROM users WHERE email = :email"; $stmt = $pdo->prepare($sql); $stmt->bindParam(':email', $email); $stmt->execute(); $user = $stmt->fetch(); if ($user && password_verify($password, $user['password_hash'])) { // Passordet er gyldig, opprett en brukersesjon session_start(); $_SESSION['user_id'] = $user['user_id']; $_SESSION['user_role'] = $user['role']; // Gi tilbakemelding til brukeren om vellykket innlogging header('Location: dashboard.php'); // Omdiriger til en beskyttet side exit(); } else { // Feil passord, gi tilbakemelding om innloggingsfeil $error_message = "Feil e-postadresse eller passord."; } } ?> <!DOCTYPE html> <html lang="en"> <head> <!-- ... Legg til nødvendige meta-informasjon og stiler ... --> </head> <body> <h2>Logg inn</h2> <?php if (isset($error_message)): ?> <p><?php echo $error_message; ?></p> <?php endif; ?> <form method="post" action="login.php"> <label for="email">E-postadresse:</label> <input type="email" id="email" name="email" required> <label for="password">Passord:</label> <input type="password" id="password" name="password" required> <input type="submit" value="Logg inn"> </form> </body> </html> /* Navicat MySQL Data Transfer SET NAMES utf8mb4; SET FOREIGN_KEY_CHECKS = 0; -- ---------------------------- -- Table structure for users -- ---------------------------- DROP TABLE IF EXISTS `users`; CREATE TABLE `users` ( `user_id` int(11) NOT NULL AUTO_INCREMENT, `first_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `middle_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `last_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `address` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `city` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `postal_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `birthday` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `country` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `county` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `municipality` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `phone` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `sex` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `email` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `display_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `password_hash` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `confirm_password` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `confirm_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `role` enum('user','moderator','administrator') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'user', `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`user_id`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 17 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = DYNAMIC; -- ---------------------------- -- Records of users -- ---------------------------- SET FOREIGN_KEY_CHECKS = 1;
  10. requinix, the problem is that the username/email does not match the specified size in the CSS document. The password field does, but not the username field. I know that this is probably a trivial issue, but I can't seem to spot the triviality. There might be an extra letter or one missing altogether.
  11. I am working on a new project, and I have a problem with CSS and the size of a text box for username/email. I want the box to change size like the password box, because that one works, but not the box for username/email. I am pasting the HTML and CSS below. Thank you for all your help. <form method="POST" action="login_process.php"> <div class="login_div"> <input type="text" name="email" placeholder="Email" required> <input type="password" name="password" placeholder="Passord" required> <label for="showPassword">Vis passord</label><input type="checkbox" id="showPassword"><p> <button type="submit">Login</button> </div> </form> <script> document.getElementById("showPassword").addEventListener("change", function () { var passwordInput = document.querySelector("input[name='password']"); if (passwordInput.type === "password") { passwordInput.type = "text"; } else { passwordInput.type = "password"; } }); </script> /* CSS Document */ /* styles.css */ body { font-family: Arial, sans-serif; background-color: #ffffff; margin: 0; padding: 0; } h2 { color: #333; } form { width: 300px; margin: 0 auto; padding: 20px; background-color: #fff; border-radius: 5px; box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1); } label { display: block; margin-bottom: 5px; font-size: 11px; font-weight: normal; } input[type="email"], input[type="password"] { width: 30%; padding: 2px; margin-bottom: 0px; border-radius: 5px solid thin #000; font-size: 14px; } input[type="submit"] { display: block; width: 10%; padding: 10px; background-color: #333; color: #fff; border:thin; border-radius: 5px; font-size: 14px; cursor: pointer; } input[type="submit"]:hover { background-color: #fff; }
  12. No, but I fixed it now. I set the charset to utf8mb4. Thanks Barand.
  13. Barand, i cant make it work wit Æ, Ø or Å. They won't save to the database. All other letters is saved in the database. Is the problem in the hashing of the password?
  14. I have set up this block for validating password reg. // Validering av passord if (strlen($password) < 8 || !preg_match("/[A-Z]/", $password) || !preg_match("/[0-9]/", $password)) { $error_message = "Passordet må være minst 8 tegn langt, inneholde minst én stor bokstav og ett tall."; // Legg til en feilmelding i en feilmeldingsarray for å vise senere. In can't make it work with Scandinavian special letters Ææ, Øø, Åå Does someone here know how to fix this?
  15. I am trying to follow this guide on how to configure GitHub Copilot in Visual Studio Code. That goes well till I come to number three. Where is that login button in the left corner? How does it look? -------------------- To configure Github Copilot in Visual Studio Code, you need to follow these steps: 1- Install Visual Studio Code: If you haven't already, you can download and install Visual Studio Code from the official website: https://code.visualstudio.com/. 2- Install the Github Copilot extension: Open Visual Studio Code and click on the "Extensions" icon in the left-hand sidebar. Search for "Github Copilot" and install the official extension that is developed by Github and Microsoft. 3- Sign in to Github: After installing the extension, click on the "Sign in to GitHub" button in the bottom left corner of the Visual Studio Code window, and follow the instructions to sign in to your Github account. 4- Activate Github Copilot: Once you are signed in to Github, you can activate Github Copilot by opening a file and typing some code. Press "Ctrl+Space" (Windows, Linux) or "Cmd+Space" (Mac) to trigger Github Copilot, and it will start suggesting code for you. 5- Customize the settings: You can customize the settings for Github Copilot by going to the Visual Studio Code settings (File > Preferences > Settings), searching for "Github Copilot", and adjusting the relevant settings to your preference. 6- That's it! You should now be able to use Github Copilot in Visual Studio Code. Just remember that Github Copilot is an AI-powered code generator that uses machine learning to suggest code based on context, and it is not a complete replacement for manual coding. You should always review and understand the code generated by Github Copilot before using it in production environments.
  16. I have asked about this in another project before, but now the problem is back. I am still struggling with this. Read through my CSS, and look at my HTML, I can't understand this no matter how hard I try, over and over again. My screen resolution is 1920X1080. In that resolution, the site looks as I want. It's only the header and the menu bar whos not cooperating. For those of you who want to see this problem in action and, what's happening and what's not happening, here is the link to the site: www.matsnakk.com This is the one who's making all the trouble, but i need it for scaling my header banner background image: background: url("../../images/matsnakk_header.png") no-repeat; background-size: contain; /*Makes the background scaling.*/ <?php error_reporting(E_ALL); ini_set('display_errors', 1); include $_SERVER['DOCUMENT_ROOT'] . '/includes/db.php'; ?> <!doctype html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title><?php echo $article['title_tag']; ?></title> <link rel='stylesheet' href='https://www.w3schools.com/w3css/4/w3.css'> <link rel="stylesheet" href="<?php echo BASE_URL; ?>scripts/css/style.css" rel="stylesheet" type="text/css"> <link rel="stylesheet" href="<?php echo BASE_URL; ?>scripts/css/navbar.css" rel="stylesheet" type="text/css"> <link rel="stylesheet" href="<?php echo BASE_URL; ?>scripts/css/header.css" rel="stylesheet" type="text/css"> <link rel="stylesheet" href="<?php echo BASE_URL; ?>scripts/css/main.css" rel="stylesheet" type="text/css"> <link rel="stylesheet" href="<?php echo BASE_URL; ?>scripts/css/footer.css" rel="stylesheet" type="text/css"> <link rel="stylesheet" href="<?php echo BASE_URL; ?>scripts/css/main_elements.css" rel="stylesheet" type="text/css"> </head> <body class="body"> <div class="banner"></div> <div class="menu_div"> <a href='<?=$HOST?>index.php'class='w3-bar-item w3-button color: white w3-round-tiny w3-hover-white'>Hjem</a> <a href='<?=$HOST?>recipes.php'class='w3-bar-item w3-button w3-round-tiny w3-hover-white'>Oppskrifter</a> <a href='<?=$HOST?>restaurants.php'class='w3-bar-item w3-button w3-round-tiny w3-hover-white'>Restauranter</a> <a href='<?=$HOST?>recipes.php'class='w3-bar-item w3-button w3-round-tiny w3-hover-white'>Café - Diners</a> <a href='<?=$HOST?>roadside.php'class='w3-bar-item w3-button w3-round-tiny w3-hover-white'>Etter veien</a> <a href='<?=$HOST?>fastfood.php'class='w3-bar-item w3-button w3-round-tiny w3-hover-white'>Fastfood</a> <a href='<?=$HOST?>forums.php'class='w3-bar-item w3-button w3-round-tiny w3-hover-white'>Diskuter</a> <a href='<?=$HOST?>news.php'class='w3-bar-item w3-button w3-round-tiny w3-hover-white'>Nyheter</a> <a href='<?=$HOST?>about.php'class='w3-bar-item w3-button w3-round-tiny w3-hover-white'>Om Matsnakk</a> </div></div> <div class="main_bg"> </div> <div class="footer_bg"> <br> <div class="footer"> Matsnakk &copy;<br> All Rights Reserved. </div> </footer> </body> </html> /* CSS Document */ div.logo_bg { width: 250px; height: 69px; margin-left: 28px; margin-top: 0px; margin-bottom: 0px; margin-right: 0px; padding-top: 0px; padding-left: 10px; } div.container { background-color: #f7f7f7; display: flex; position: fixed; box-sizing: border-box; overflow: hidden; height: 100%; width: 100%; top: 0px; left: 0px; } body.style { background-color: #f7f7f7; font-family: "Verdana, Consolas", "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", "DejaVu Sans", "sans-serif"; padding-top: 0PX; margin-top: 0px; } div.banner { background-color: #033333; background: url("../../images/matsnakk_header.png") no-repeat; background-size: contain; /*Makes the background scaling.*/ width: 100%; height: 250px; position: fixed; } /*div.logo_div { background-image: url("../../images/matsnakk_logo_liten.png"); flex: 1; position: fixed; box-sizing: border-box; height: 69px; width: 250px; top: 11px; left: 30px; }*/ div.menu_bar { background-color: #033333; position: fixed; box-sizing: border-box; overflow: hidden; font-size: 15px; font-weight: bold; margin-top: 0px; height: 25px; width: 100%; top: 0px; left: 0px; } div.menu_div { display: flex; justify-content: center; margin-top: 10px; background-color: #f7f7f7; position: fixed; box-sizing: border-box; overflow: hidden; height: 35px; width: 100%; top: 240px; left: 0px; border-bottom: 2px solid #033333; }
  17. Oh crap! Got to learn to check my spelling🙄
  18. I can't figure this puzzle out. I have tried most things throughout the night, but I have not set up this DIV as either a FLEX CONTAINER or a GRID CONTAINER. So, I tried to do that too, but it wasn't working. Do I have to place it in some special place in the CSS code? So, what will work here to align the text and content in this menu bar in center position? Everything is on one line too. I would appreciate it if someone could show me where to put it? <body class="body"> <div class="menu_div">Menu items</div> div.menu_div { margin-top: 10px; background-color: #ffffff; position: fixed; box-sizing: border-box; overflow: hidden; height: 35px; width: 100%; top: 83px; left: 0px; border-bottom: thin solid #033333; }
  19. I found the solution my self. - I had to remove the hight on big_div and change it to min-height. - Set the position property of .nav_div to absolute, and position it at the bottom of .big_div. - And I had to remove this line: background-size: contain; /*Makes the background scaling.* Both .big_div and .nav_div is scaling in proportion to the background image in .big_div, and .nav_div stays at the bottom of .big_div when it scales. Case closed.
  20. If you suspect that someone is sending spam to you through means other than your website's contact form, there are several things you can do to investigate: Check the email headers: Email headers contain information about the sender, including the IP address and the originating server. You can use an email header analyzer tool to decode the headers and check if the email was sent from your website's server or from a different one. Verify the sender's email address: Check the sender's email address to see if it matches the email address used on your website's contact form. If the email address is different, it is likely that the email was sent from a different source. Use CAPTCHA: Implement a CAPTCHA on your website's contact form to prevent automated spam bots from submitting the form. Implement email authentication protocols: Implement email authentication protocols such as SPF, DKIM, and DMARC to verify that emails sent from your domain are legitimate. Monitor your website's traffic: Use website analytics tools to monitor your website's traffic and look for unusual spikes in traffic or suspicious activity. By taking these steps, you can help ensure that the emails you receive through your website's contact form are legitimate and have been sent from your website's server.
  21. It is the background image that is scaling, but the two div's is not. I have removed the img_div so I have just big_div and nav_div left. I thought that maybe this would help. I discovered that it is not the nav_div that is not scaling when I minimize the browser window. It doesn't follow the background picture with the logo and graphic. Because the background picture is scaling as it should. The problem occurs when I minimize the browser window, and the two div's are not scaling like the background image. The background image is scaling because of this one: background: url("../images/topbg.png") no-repeat; background-size: contain; /*Makes the background scaling.*/ First (like in my first posting) I thought that the nav bar was hanging on the same place and the other two div's was scaling. But that wasn't the problem. The problem occurs when the background image is scaling, but the div's is not. How to make this work I don't have a clue, but I hope someone here has and can help. Please, tell me how to solve this problem. I hope this is enough information when I include the screenshots 😊 The CSS is the same as in my opening posting minus the img_div and I also corrected the quoting that was missing👍 Maximized Minimized CSS: .big_div { margin: auto; width: 100%; height: 203px; padding-top: 0px; padding-left: 0px; padding-right: 0px; font-size: 14pt; background: url("../images/topbg.png") no-repeat; background-size: contain; /*Makes the background scaling.*/ } .nav_div { background-color: #ff0000; margin: auto; width: 100%; height: 40px; padding-top: 0px; padding-left: 0px; padding-right: 0px; font-size: 13pt; text-align: center; vertical-align: middle; } HTML: <div class="big_div"></div> <div class="nav_div"> <a id="nav-hjem" href="<?=$HOST?>index.php" class="w3-bar-item w3-button">Hjem</a> <a id="nav-jeg" href="<?=$HOST?>index.php" class="w3-bar-item w3-button">Jeg</a> <a id="nav-meg" href="<?=$HOST?>index.php" class="w3-bar-item w3-button">Meg</a> <a id="nav-deg" href="<?=$HOST?>index.php" class="w3-bar-item w3-button">Deg</a> <a id="nav-du" href="<?=$HOST?>index.php" class="w3-bar-item w3-button">Du</a> </div>
  22. Hello senenglari, the earth is answering 😉
  23. nav_div remains in the same place when I minimize and scale. It should follow the div above, but doesn't. The width and height scale, but it does not move accordingly. What and where is wrong? CSS: .big_div { margin: auto; width: 100%; height: 201px; padding-top: 0px; padding-left: 0px; padding-right: 0px; font-size: 14pt; } .img_div { width: 100%; height: 203px; background: url("../images/logo.png") no-repeat; background-size: contain; } .nav_div { background-color: #ff0000; margin: auto; width: 100%; height: 40px; padding-top: 0px; padding-left: 0px; padding-right: 0px; font-size: 13pt; text-align: center; vertical-align: middle; } HTML: <div class="big_div"><div class="img_div"></div></div> <div class="nav_div"> <a id='nav-hjem' href='<?=$HOST?>index.php' class='w3-bar-item w3-button'>Hjem</a> <a id='nav-jeg' href='<?=$HOST?>index.php' class='w3-bar-item w3-button'>Jeg</a> <a id='nav-meg' href='<?=$HOST?>index.php' class='w3-bar-item w3-button'>Meg</a> <a id='nav-deg href='<?=$HOST?>index.php' class='w3-bar-item w3-button'>Deg</a> <a id='nav-du' href='<?=$HOST?>index.php' class='w3-bar-item w3-button'>Du</a> </div>
  24. Thanks for the answer to both of you. I tried as Requinix said to print out the path and found out the difference between those two.
  25. I have put the PDO database connection one level above (outside) the WWW directory on the server to protect it from unwanted visitors who get hold of the user data of the database server. Today I use this in other places than where it says now, but it is only as an example: include __DIR__ . '/../includes/db.php'; but then I thought of the super global $server , but I can't get it to work. I have set it up like this: include($_SERVER['DOCUMENT_ROOT'] . "../includes/db.php"); What am I doing wrong? Or won't it work with the super global example? And how do I create a variable out of the super global string so I only use $linkpath in front of the path to the file I want to link to?
×
×
  • 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.