Jump to content

LeonLatex

Members
  • Posts

    393
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by LeonLatex

  1. Will flex and flexbox mean the same as setting up the web page with X number of DIV boxes and then controlling them with CSS3. So, if you imagine that the DIV boxes are parallel both vertically and horizontally (like making a grid), they will be adjusted with CSS and form the intended and planned design. Because then you probably also want to make the DIV boxes different in position and size. Is there something here that I am wrong with my assumptions? Is this partly the intention/principle of the flexbox? Much of this I already know, but I need to have it confirmed, because what I read online and in books are so different. It is possible that I am misunderstanding because bad English etc, but a confirmation of what is right and correction of what is wrong would be nice. I have read the PHP documentation as sugested to.
  2. First of all, I must apologize for asking a question on a Q&A forum. Sorry for that, but thanks at the same time for the help I get. So to what this thread is really about. You are absolutely right Requinix, When you are logged in, the link or button on the navigation bar should be activated, while it should be deactivated/overshadowed when you are not logged in, and I do it in the following way. I only saw now that I have forgotten something important. Namely to add what is written in the header.php file. It is probably very important and I include that too. After I've pasted it in I'll show what I'm doing in trying to get this to work after I had to reconstruct the entire script after breaking what was done for me in an attempt to improve and add features myself, and which therefore turns out to be wrong. By the way. I include the navigation bar too below header.php header.php <?php session_start(); $ROOT = str_replace('\\', '/', $_SERVER['DOCUMENT_ROOT']) . '/'; $HOST = 'http://' . $_SERVER['HTTP_HOST'] . '/'; $disabl1 = isset($_SESSION['member_id']) ? '' : 'w3-disabled'; $disabl2 = isset($_SESSION['member_id']) && isset($_SESSION['isadmin']) ? '' : 'w3-disabled'; $log_btn = isset($_SESSION['member_id']) ? 'Logg ut' : 'Logg inn'; const SYSNAME = 'Management System'; const PAGETITLE = 'Welcome'; const HELPBUTTON = ""; ?> Nav bar <NAV> <div class='w3-bar w3-light-gray w3-margin-bottom' style='height: 39px'> <a id='nav-members' href='<?=$HOST?>index.php' class='w3-bar-item w3-button'>Hjem</a> <a id='nav-register' href='<?=$HOST?>register.php' class='w3-bar-item w3-button'>Registrering</a> <a id='nav-members' href='<?=$HOST?>members.php' class='w3-bar-item w3-button'>Medlemmer</a> <a id='nav-marina' href='<?=$HOST?>marina.php' class='w3-bar-item w3-button'>Bรฅtplass</a> <a id='nav-invoice' href='<?=$HOST?>invoice/invoice.php' class='w3-bar-item w3-button'>Faktura</a> <a id='nav-login' href='<?=$HOST?>login.php' class='w3-bar-item w3-button w3-right'><?=$log_btn?></a> </div> </NAV> Here's what I tried to get it to work: <?=$disabl1?> or <?=$disabl2?> All this do is too write "w3-disabled" on the navigation button. Will say, I do it the same way as it is done with login.php link in the navbar above. Another error is that I have administrative rights regardless of whether I am logged in or not. I don't understand what I'm doing wrong or where, and after all the work I had to reconstruct the system, I don't dare touch it too much.
  3. Barry made this, and the intention is to have the link activated only when logged in as a user or admin. I don't remember how it was set up. Somehow this is controlling the login users rights depending on the email address, which is the username. I paste the sessions from the header.php, members.php and marina.php and the rest of the sites containing the content. I also attached other things related to the log in such as e.g. database etc. If there is something you feel I have forgotten, I hope you will ask. I only try to keep the post as short as possible. I want the user rights to be right again. Do you understand what I mean? Can you help me?, please members.php session. <?php session_start(); $ROOT = str_replace('\\', '/', $_SERVER['DOCUMENT_ROOT']) . '/'; $HOST = 'http://' . $_SERVER['HTTP_HOST'] . '/'; $disabl1 = isset($_SESSION['member_id']) ? '' : 'w3-disabled'; $disabl2 = isset($_SESSION['member_id']) && isset($_SESSION['isadmin']) ? '' : 'w3-disabled'; $log_btn = isset($_SESSION['member_id']) ? 'Logg ut' : 'Logg inn'; const SYSNAME = 'Nikolivia Maraina Management System'; const PAGETITLE = 'Velkommen'; const HELPBUTTON = ""; ?> marina.php session. <?php session_start(); include $ROOT.'db_inc.php'; $pdo = pdoConnect(); $loggedin = $_SESSION['member_id'] ?? 0; unset( $_SESSION['member_id'], $_SESSION['isadmin']); if ($loggedin) { header("Location: {$HOST}marina.php"); exit; } ?> The database part with the records containing the user rights level settings. Here comes some of the HTML/PHP. login.php <?php session_start(); include $ROOT.'db_inc.php'; $pdo = pdoConnect(); $ROOT = str_replace('\\', '/', $_SERVER['DOCUMENT_ROOT']) . '/'; $HOST = 'http://' . $_SERVER['HTTP_HOST'] . '/'; $loggedin = $_SESSION['member_id'] ?? 0; unset( $_SESSION['member_id'], $_SESSION['isadmin']); if ($loggedin) { header("Location: {$HOST}members.php"); exit; } $msg = ''; if ($_SERVER['REQUEST_METHOD']=='POST') { $res = $pdo->prepare("SELECT password , member_id , admin FROM member WHERE email = ? "); $res->execute([ $_POST['email'] ]); $row = $res->fetch(); if ($row && password_verify($_POST['password'], $row['password'])) { $_SESSION['member_id'] = $row['member_id']; if ($row['admin'] == 1) { $_SESSION['isadmin'] = 1; } header("Location: {$HOST}members.php"); exit; } else $msg = "<div class='w3-panel w3-red w3-padding'><p>Ugyldig innlogging</p></div>"; } ?> <?php session_start(); $ROOT = str_replace('\\', '/', $_SERVER['DOCUMENT_ROOT']) . '/'; $HOST = 'http://' . $_SERVER['HTTP_HOST'] . '/'; $disabl1 = isset($_SESSION['member_id']) ? '' : 'w3-disabled'; $disabl2 = isset($_SESSION['member_id']) && isset($_SESSION['isadmin']) ? '' : 'w3-disabled'; $log_btn = isset($_SESSION['member_id']) ? 'Log out' : 'Login'; const SYSNAME = 'Management System'; const PAGETITLE = 'Login'; const HELPBUTTON = ""; ?> <!DOCTYPE html> <html lang='en'> <head> <title><?=SYSNAME?></title> <meta http-equiv='Content-Type' content='text/html; charset=utf-8'> <link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.15.1/css/all.css"> <link href='css/footer.css' rel='stylesheet' type="text/css"> </head> <body> <div class='w3-content w3-card-4 w3-light-gray' style='margin-top: 100px;'> <div class='w3-panel w3-black w3-padding'> <?=SYSNAME?> - <?=PAGETITLE?> </div> <?=$msg?> <form method='POST' class='w3-padding'> <label>E-mail</label> <input type='text' class='w3-input w3-border' name='email'> <label>Password</label> <input type='password' class='w3-input w3-border' name='password'> <br> <button type='submit' class='w3-button w3-blue w3-right'>Logg Inn</button> <br><br><br> </form> </div> </body> </html>
  4. I am working on and trying to further develop the member and invoice system for another project. Barand was the one who helped me with this and developed it for me from the start, but since I can't get in touch with him anymore I have to ask you guys. In any case, I can no longer see him online either here on PHP Freaks or on Skype. I guess I haven't seen him online since mid-March. so I need some help to look at what I need to activate on the server, and how this should be configured so that a pdf invoice is automatically sent by email when a new registration occurs on the website. To start somewhere... Barand integrated a mail system to have it to automatic send mail to one to three people simultaneously when a new member registration is sent from the registration form. I can't remember what he used when he developed this, I know it isn't the usual php sendmail in linux. I cant find any trace of it in the scripts. Can you imagine what it is?
  5. Thank you for a very good answer that was very explanatory and comprehensive. Thanks, requinix ๐Ÿ˜Š๐Ÿ‘Œ๐Ÿ‘
  6. I'm browsing different documentation for HTML5, and I'm going to familiarize myself with version 5 of HTML, and the version I was familiar with was HTML 4.01. It's not easy to catch everything when you have to constantly look up and down, back and forth to find answers, because there is a lot that is new for me. So, I'm asking here. These examples: <HEADER> <NAV> <MAIN> <FOOTER> . What are these called? Are they only called a TAG(s), or do they have a special/own name?
  7. Yes, I have found that too, but I don't know of another place to do this or another way to do it. I am stuck as a duck.
  8. Yes, I re-wrote the whole script (file). That fixed all the problems, but not this one.
  9. I need help deciphering this error message. I can't figure it out myself and I can't see anything wrong with it. Can you see where the error(s) are? Error message in browser: ArticleWebsite.php: DatabaseTable.php:
  10. Why does your error script report itself? It does so on line 3. <?php error_reporting(E_ALL); ini_set('display_errors', '1');
  11. Yes, I understand that. But does it add only the www.domain, domain, or the full path from which directory on the server it is placed inside the file?
  12. What's the differences between include and include __DIR__ . '/../includes/DatabaseConnection.php';
  13. Thanks. Hope this will bring me on the right path.
  14. Ok, here it is. Thanks for the CTRL+Z. I re-wrote the script, but it was more errors than the first one, so I post the old one. The same errors and amount of them. <?php class databaseTable { public function __construct(private PDO $pdo, private string $table, private string $primaryKey) { } public function find($field, $value) { $query = 'select * FROM `' . $this->table . '` WHERE `' . $field . '` = :value'; $values = [ 'value' => $value ]; $stmt = $this->prepare($query); $stmt->execute($values); return $stmt->fetchAll(); } public function findAll() { $stmt = $this->pdo->prepare('SELECT * FROM `' . $this->table . '`'); $stmt->execute(); return $result->fetchAll(); } public function total() { $stmt = $this->pdo->prepare('SELECT COUNT(*) FROM `' . $this->table . '`'); $stmt->execute(); $row = $stmt->fetch(); return $row[0]; } public function save($record) { try { if (empty($record[$this->primaryKey])) { unset($record[$this->primaryKey]); } $this->insert($record); } catch (PDOException $e) { $this->update($record); } } private function update($values) { $query = ' UPDATE `' . $this->table .'` SET '; foreach ($values as $key => $value) { $query .='`' . $key . '`= :' . $key . ','; } $query = rtrim($query, ','); $query .= ' WHERE `' . $this->primaryKey . '` = :primaryKey'; //Set the primary key variable $values['primaryKey'] = $values['id']; $values = $this->processDates($values); $stmt = $his->pdo->prepare($query); $stmt->execute($values); } private function insert($values) { $query = 'INSERT INTO `' . $this->table . '`('; } foreach ($values as $key => $value) { $query .= '`' . $key . '`,'; } $query = rtrim($query, ','); $query .= ') values ('; foreach ($values as $key => $value) { $query .= ':' . $key . ','; } $query = rtrim($query, ','); $query .= ')'; $values = $this->processDates($values); $stmt = $this->pdo->prepare($query); $stmt->execute($values); } public function delete($field, $value) { $values = [':value' => $value]; $stmt = $this->pdo->prepare('DELETE FROM`' . $this->table . '` WHERE `' $field . '` = :value'); $stmt->execute($values); } function processDates($values) { foreach ($values as $key => $value) { if ($value instanceof DateTime) { $values[$key] = $value->format('Y-m-d'); } } return $values; } }
  15. Yes, i am on my way. I post it as text when i am finished.
  16. I tried to upgrade. It didn't work. I try to write the script again.
  17. Do you mean DW doesn't like it? So there is nothing wrong? The script doesn't run in the browser when I run this in the top: <?php error_reporting(E_ALL); ini_set('display_errors', '1'); PHP 7.2 is running on the server. I can upgrade to 8.1, but then i will get a lot of problems with other scripts and sites. As I told cyberRobot, the script won't run in the browser. I try with this one too: <?php error_reporting(E_ALL); ini_set('display_errors', '1');
  18. I can't find the error. In VSC the error is only on only line 17. In DW, which the image is from, the error is on multiple lines (as you can see on the image. Can someone please help me and tell me where/what the error is? I have checked the PHP reference manual + websites. They all tell me teres nothing wrong.
  19. What I want to do now have i done before, but now I can't. I want logo_bar to be 100% wide from margin left to margin right. Now there is a gap on the right side. The 2nd. is the translate_div with the google translate inside. I want it to be aligned 20px from the right margin, but now it won't. Sure, I am doing something wrong, but after trying a lot of different things I give up. Can you see what I am doing wrong? <body> <div class="header_container"> <div class="logo_bar"> <div class="logo_div"> <div class="translate_div"> <div id="google_translate_element"></div> <script type="text/javascript"> function googleTranslateElementInit() { new google.translate.TranslateElement({pageLanguage: 'en'}, 'google_translate_element'); } </script> <script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script> </div> </div> </div> ---------------------------------------------------------------------- div.header_container { background-color: #033333; height: 83px; width: 100%; padding-top: 0px; margin-top: 0px; } div.logo_bar { display: flex; background-color: #033333; width: 100%; height: 47px; } div.logo_div { background-image: url("../images/logo_bg_original.png"); width: 300px; height: 35px; margin-top: 3px; } div.translate_div { display: inline; width: 300px; height: 35px; margin-left: 20px; }
  20. Great Maxxd. This will be useful ๐Ÿ˜Š Thanks ๐Ÿ‘
  21. OK, after much troubling I found the missing link, called error. I had a CSS class in my body tag + I have misunderstood the use of <HEADER>, <NAV>, <MAIN> and <FOOTER>, like some of you have tried to make me understand. I can't put the header inside the main tag f.ex. Now everything is OK, so far. I hope I don't meet more problems like this. It makes so much more problems, and makes me use so much unnecessary use of time. Thank you for trying and helping me with advice and solutions๐Ÿ˜Š๐Ÿ‘
  22. I saw that and have tried different things to solve it. to. The problem is when I try to change it (fixed), then the background image is changing size. I also get problems with the scaling of the background image in the top div. The top div and the navigation bar are is drifting apart when scaling down the resolution when I remove or change the fixed. I tried padding before, but it changed nothing. I saw that after posting and changing it. I looked over it and checked all was right set up, so the structure is ok. I am sure the problem is with the CSS, and not the HTML. Because I have checked and double-checked and gone through that part of the site over and over again. I feel stuck and try so much without anything helping. I have done so much different changes, so now, i can't see the forest because of all the trees again.
  23. Nothing more is happening than described Requinix. The body-text and the navigation bar (in a div bar) are hidden behind the background image (in a div) at the top of the site. Everything should be below the top div. It should be ranged like this: <DIV>top div</DIV> <DIV>navigation bar</DIV> <DIV>body with text</DIV> But are ranged like this: top bar - Navigation bar - body with text Navigation bar in the upper left corner, below that in the left margin, the body with text. I have now removed the BG image from visualization, so just the DIV for the top BG image is showing. If I read the source it is like I have set it up. Read my HTML and my CSS and you will understand. put it in a HTML and CSS file and you will see in your nrowser. All three chrome, edge and opera is the same.
×
×
  • 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.