Jump to content

LeonLatex

Members
  • Posts

    393
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by LeonLatex

  1. <?php session_start(); $ROOT = str_replace('\\', '/', $_SERVER['DOCUMENT_ROOT']) . '/'; $HOST = 'http://' . $_SERVER['HTTP_HOST'] . '/'; if (!isset($_SESSION['isadmin'])) { header("Location: {$HOST}marina.php"); exit; } include $ROOT.'db_inc.php'; $pdo = pdoConnect(); const PAGETITLE = 'Båtplasskart og Venteliste'; const HELPBUTTON = "<span id='info_btn' class='w3-badge w3-small w3-white w3-border w3-border-white w3-right' title='Hjelp'>?</span>"; ////////////////////////////////////////////////////////////////////////// // HANDLE AJAX REQUEST // if (isset($_GET['ajax'])) { if ($_GET['ajax']=='getberth') { $res = $pdo->prepare("SELECT m.fname , m.lname , m.mobile , m.email , b.name as bname , b.make , b.model , COALESCE(be.berth_no, '') as berth_no , CASE WHEN be.berth_no IS NULL THEN CONCAT('(Ventet siden ' , date_format(bb.date_from, '%M %D %Y') , ')') ELSE '' END as since FROM member m JOIN boat b USING (member_id) JOIN boat_berth bb ON b.boat_id = bb.boat_id AND curdate() BETWEEN bb.date_from AND COALESCE(bb.date_until, '9999-12-31') LEFT JOIN berth be USING (berth_id) WHERE b.boat_id = ? "); $res->execute( [ $_GET['boat'] ] ); $row = $res->fetch(); $today = date('Y-m-d'); if (!isset($_SESSION['member_id'])) { $row['fname'] = $row['lname'] = $row['mobile'] = $row['email'] = ''; // member info redacted for non-members } $datefield = isset($_SESSION['isadmin']) ? "<label>Endret dato</label><input class='' type='date' id='reberth_date' value='$today'>" : "&nbsp;<input type='hidden' id='reberth_date' value='$today'>"; $resp = <<<RESP <div class='w3-panel w3-blue-gray'> <h3>Båtplass ID: {$row['berth_no']} {$row['since']} <span class="w3-right w3-margin-right" onclick="hideInfo();"><i class='fas fa-times'></i></span> </h3> </div> <div class='w3-row-padding'> <div class='w3-third'> <label>Båtnavn</label>{$row['bname']}<br> <label>Fabrikat</label>{$row['make']}<br> <label>Type/Modell</label>{$row['model']}<br> </div> <div class='w3-third'> <label>Eier</label>{$row['fname']} {$row['lname']}<br> <label>Mobilnummer</label>{$row['mobile']}<br> <label>E-mail</label>{$row['email']} </div> <div class='w3-third'> $datefield </div> </div> RESP; exit($resp); } elseif ($_GET['ajax'] == 'reberth') { if (!isset($_SESSION['isadmin'])) { exit(marina($pdo)); } $pdo->beginTransaction(); try { $stmt = $pdo->prepare("UPDATE boat_berth SET date_until = ? - INTERVAL 1 DAY WHERE boat_id = ? AND date_until IS NULL "); $stmt->execute( [ $_GET['date'], $_GET['boat'] ] ); $stmt = $pdo->prepare("INSERT INTO boat_berth(boat_id, berth_id, date_from, date_until) VALUES (? , ?, ?, null) "); $stmt->execute( [ $_GET['boat'], $_GET['berth'], $_GET['date'] ] ); $pdo->commit(); } catch(PDOException $e) { $pdo->rollBack(); throw $e; } exit(marina($pdo)); } elseif ($_GET['ajax'] == 'dispose') { if (!isset($_SESSION['isadmin'])) { exit(marina($pdo)); } $pdo->beginTransaction(); try { $stmt = $pdo->prepare("UPDATE boat_berth SET date_until = ? - INTERVAL 1 DAY WHERE boat_id = ? AND date_until IS NULL "); $stmt->execute( [ $_GET['date'], $_GET['boat'] ] ); $stmt = $pdo->prepare("UPDATE boat SET disposal_date = ? WHERE boat_id = ? "); $stmt->execute( [ $_GET['date'], $_GET['boat'] ] ); $pdo->commit(); } catch(PDOException $e) { $pdo->rollBack(); throw $e; } exit(marina($pdo)); } } //////////////////////////////////////////////////////////////////// /* Shape and size of the boat graphics / illustrations */ function boat($id, $size, $rotate, $x, $y) { switch ($size) { case 1: $width = 66; $height = 18; break; case 2: $width = 78; $height = 22; break; case 3: $width = 88; $height = 26; case 4: $width = 88; $height = 26; } /* The graphics / illustrations of the boats are in three parts. There are bow, midships and stern.<br> ellipse is the shape of the bow */ $cx = $width/2; $cy = $height/2; $svg = "<g transform='translate($x, $y)'> <g transform='rotate($rotate $cx $cy)'>\n"; $cx2 = $width/2; $rx2 = $cx2; $cy2 = $height/2; $ry2 = $cy2; $svg .= "<ellipse cx='$cx2' cy='$cy2' rx='$rx2' ry='$ry2' class='boat boat1' data-sel='0' data-size='$size' data-id='$id'/>\n"; $cx1 = $width/10; $rx1 = $cx1; $cy1 = $height/2; $ry1 = $cy1; $svg .= "<ellipse cx='$cx1' cy='$cy1' rx='$rx1' ry='$ry1'class='boat' />\n"; $rx3 = $cx1; $ry3 = 0; $rw3 = $cx2 - $cx1; $rh3 = $height; $svg .= "<rect x='$rx3' y='$ry3' width='$rw3' height='$rh3' class='boat' />\n"; $svg .= "</g> </g>\n"; return $svg; } function berth($bid, $no, $size, $rotate, $boat, $x, $y) { switch ($size) { case 1: $width = 26; break; case 2: $width = 30; break; case 3: case 4: $width = $rotate==180 ? 153 : 34; break; } $even = (intval(substr($no, -2)))%2; $offsets = [ 1 => [ 0 => [ 'x' => 6-$width, 'y' => 5], 1 => [ 'x' => 6-$width, 'y' => 28], ], 2 => [ 0 => [ 'x' => 6-$width, 'y' => -3], 1 => [ 'x' => 6-$width, 'y' => 32], ], 3 => [ 0 => [ 'x' => 6-$width, 'y' => -10], 1 => [ 'x' => 60, 'y' => 3], ], 4 => [ 0 => [ 'x' => 6-$width, 'y' => -10], 1 => [ 'x' => 60, 'y' => 3], ] ]; $height = 50; $ty = $height/2; $tx = $width/2 + 3; $ta = -90; $svg = "<g transform='translate($x, $y)'>\n"; if ($rotate == -90) { $svg .= "<path d='M 0 0 v $height h $width v -$height' fill='#000079' stroke='#C0C0C0' stroke-width='2' class='berth' data-bid='$bid' data-bno='$no' data-boat='$boat' data-size='$size' />\n"; } elseif ($rotate == 90) { $svg .= "<path d='M 0 $height v -$height h $width v $height' fill='#000080' stroke='#C0C0C0' stroke-width='2' class='berth' data-bid='$bid' data-bno='$no' data-boat='$boat' data-size='$size' />\n"; } else { $svg .= "<path d='M 0 20 v -20 h $width v 20' fill='#000080' stroke='#C0C0C0' stroke-width='2' class='berth' data-bid='$bid' data-bno='$no' data-boat='$boat' data-size='$size' />\n"; $ty = 18; $tx += 30; $ta = 0; } if ($boat) { $svg .= boat($boat, $size, $rotate, $offsets[$size][$even]['x'], $offsets[$size][$even]['y']); } $bclass = $boat ? 'bno1' : 'bno2'; $svg .= "<text x='$tx' y='$ty' text-anchor='middle' class='$bclass' transform='rotate( $ta $tx $ty)'>$no</text>\n"; $svg .= "</g>\n"; return $svg; } function marina($db) { /* Controling the piers and berths */ $piers = [ 'A' => ['x0' => 60, // Positioning sideways of pier A 'y0' => 100, // Positioning up/down of pier A 'w' => 988, // Length pier A 'h' => 16, // Width Pier A 'bw' => 26 // Berth width pier A ], 'B' => ['x0' => 198, // Positioning sideways of pier B 'y0' => 324, // Positioning up/down of pier B 'w' => 810, // Length pier B 'h' => 16, // Width Pier B 'bw' => 30 // Berth width pier B ], 'C' => ['x0' => 310, // Positioning sideways of pier C 'y0' => 596, // Positioning up/down of pier C 'w' => 612, // Length pier C 'h' => 16, // Width Pier C 'bw' => 34 // Berth width pier C ] ]; $svg = "<svg width='1140' height='840' viewBox='0 0 1140 840'> <defs> <radialGradient id='myGradient'> <stop offset='10%' stop-color='#000000' /> <stop offset='95%' stop-color='#808080' /> </radialGradient> <radialGradient id='myGrad2'> <stop offset='10%' stop-color='#A91723' /> <stop offset='95%' stop-color='#808080' /> </radialGradient> <style type='text/css'> .boat { fill: #FCF8E8; } .boat1 { cursor: pointer; } .pierno { font-size: 20pt; fill: #FFF; } .piernox { font-size: 12pt; fill: #FFF; } .qno { font-size: 20pt; fill: #CCC; } .bno1 { font-size: 10pt; fill: #444; } .bno2 { font-size: 10pt; fill: #FFF; } .title1 { font-size: 30pt; font-family: gabriola, cursive; font-style: italic; fill: #FFF; } .title2 { font-size: 20pt; font-family: gabriola, cursive; font-style: italic; fill: #FFF; } </style> </defs> "; $svg .= "<rect x='0' y='0' width='1140' height='800' fill='#000080' /> <rect id='waiting-area' x='0' y='700' width='1140' height='140' fill='#808080' /> <!--<text x='1130' y='690' fill='#808080' font-size='8pt' transform='rotate(-90 1130 690)'>&copy; 2021 Barry Andrew</text>--> <path d='M 0 700 h 1140' stroke='#006EFC'/> <text x='5' y='695' fill='#C0C0C0' font-size='20'>Første 10 på venteliste for båtplass.(+ er long-side-plasser på brygge C)</text> <text x='1080' y='720' text-anchor='middle' fill='#000080' font-size='18'>Slette fra</text> <text x='1080' y='795' text-anchor='middle' fill='#000080' font-size='18'>venteliste</text> "; // Berths $res = $db->query("SELECT b.berth_id , b.pier , b.berth_no , b.size , bb.boat_id FROM berth b LEFT JOIN boat_berth bb ON b.berth_id = bb.berth_id AND CURDATE() BETWEEN bb.date_from AND COALESCE(bb.date_until, '9999-12-31') ORDER BY berth_no "); foreach ($res as $r) { $px = $piers[$r['pier']]['x0'] + $piers[$r['pier']]['w']; $bno = intval(substr($r['berth_no'], -2)); switch ($r['pier']) { case 'A': case 'B': $y = ($bno%2 == 0) ? $piers[$r['pier']]['y0'] - 50 : $piers[$r['pier']]['y0'] + 16; $x = $px - floor(($bno+1)/2) * $piers[$r['pier']]['bw']; $rotate = ($bno%2 == 0) ? -90 : 90; $svg .= berth($r['berth_id'], $r['berth_no'], $r['size'], $rotate, $r['boat_id'], $x, $y); break; case 'C': if ($bno%2 == 0) { $y = $piers[$r['pier']]['y0'] - 50; $x = $px - floor(($bno+1)/2) * $piers[$r['pier']]['bw']; $rotate = -90; } else { $y = $piers[$r['pier']]['y0'] + 16; $x = $px - floor(($bno+1)/2) * $piers[$r['pier']]['w']/4; $rotate = 180; } $svg .= berth($r['berth_id'], $r['berth_no'], $r['size'], $rotate, $r['boat_id'], $x, $y); break; } } // Jetties for ($j='A'; $j<='C'; $j++) { $x = $piers[$j]['x0']; $y = $piers[$j]['y0']; $h = $piers[$j]['h']; $w = $piers[$j]['w']; $tx = $piers[$j]['x0'] - 28; $ty = $piers[$j]['y0'] + 17; $svg .= "<rect x='$x' y='$y' width='$w' height='$h' fill='#C38E31' />\n"; /* Pier color */ $svg .= "<text x='$tx' y='$ty' fill='#FFF' class='pierno'>$j</text>\n"; } /* Positioning and appearance of the molo */ $ty += 28; $svg .= "<text x='$tx' y='$ty' fill='#FFF' class='piernox'>+</text>\n"; $svg .= "<path d='M 1116 0 h 16 v 200 l -130 412 h -16 l 130 -412 z' fill='#ACACAC' />" ; foreach ($piers as $p) { $svg .= gangplank($p['x0'] + $p['w'] - 6, $p['y0'] + 1, 75); } // Unberthed boats $res = $db->query("SELECT b.boat_id , b.size FROM boat b JOIN boat_berth bb ON b.boat_id = bb.boat_id AND bb.berth_id IS NULL AND CURDATE() BETWEEN bb.date_from AND COALESCE(bb.date_until, '9999-12-31') ORDER BY b.size, bb.date_from "); $tx = 4; $ty = 725; $by = 705; $waiting = []; foreach ($res as $r) { $waiting[$r['size']][] = $r['boat_id']; } foreach ($waiting as $sz => $q) { switch ($sz) { case 1: $p = 'A'; break; case 2: $p = 'B'; break; case 3: $p = 'C'; break; case 4: $p = '+'; break; } $svg .= "<text x='$tx' y='$ty' fill='#FFF' class='qno'>$p</text>\n"; $k = count($q); $xtra = $k > 10 ? $k - 10 : ''; $q = array_slice($q, 0, 10); $bx = 30; foreach ($q as $id) { $svg .= boat($id, $sz, 180, $bx, $by); $bx += 92; } $ky = $ty - 6; if ($xtra) $svg .= "<text x='$bx' y='$ky' fill='#FFF' fill='#FFF' font-size='20'>+$xtra</text>\n"; $ty += 32; $by += 32; } $svg .= "<circle id='vortex' cx='1080' cy='750' r='25' fill='url(\"#myGradient\")' />"; $svg .= '</svg>' ; return $svg; } function gangplank($x, $y, $len) { $svg = "<rect x='$x' y='$y' width='$len' height='12' fill='#E0E0E0' stroke='#666' />\n"; for ($i=5; $i<$len; $i+=5) { $ix = $x + $i; $svg .= "<path d='M $ix $y v 12' fill='none' stroke='#666' />\n"; } return $svg; } ?> <!DOCTYPE html> <html lang='no'> <head> <title>Brandbu SmåbåtForening - Båtplasser</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_marina.css' rel='stylesheet' type="text/css"> <script type='text/javascript' src='https://ajax.googleapis.com/ajax/libs/jquery/1.5.0/jquery.min.js'></script> <script type='text/javascript'> $().ready(function() { $("#nav-marina").addClass("w3-bottombar") init() $("#info_btn").click( function() { $("#infopanel").toggle() }) }) function init() { $('.boat1').click(function() { var boat = $(this).data('id') $('.boat').css('fill', '#FCF8E8') $('.boat').attr('data-sel', 0) $(this).attr('data-sel', 1) $(this).parent().children().css('fill', '#FF0000') $.get( '', {'ajax':'getberth', 'boat':boat}, function(resp) { $('#query-results').html(resp) $('#query-results').show() location.href = '#query-results' }, 'TEXT' ) }) $('.berth').click( function() { var boat = $(".boat1[data-sel='1']") if (!boat) { return } else { var boatsize = $(boat).data('size') var berthsize = $(this).data('size') if (berthsize != boatsize) { return } if ($(this).data('boat')) return; var boatid = $(boat).data('id') var berthid = $(this).data('bid') var date = $('#reberth_date').val() $.get( '', {'ajax':'reberth', 'boat':boatid, 'berth':berthid, 'date':date}, function(resp) { $('.boat').attr('data-sel', 0) $('#marina').html(resp) init() }, 'TEXT' ) } }) $("#vortex").click( function() { var boat = $(".boat1[data-sel='1']") if (!boat) { return } var boatid = $(boat).data('id') var date = $('#reberth_date').val() $.get( '', {'ajax':'dispose', 'boat':boatid, 'date':date}, function(resp) { $('.boat').attr('data-sel', 0) $('#marina').html(resp) init() }, 'TEXT' ) }) } function hideHelp() { $("#infopanel").toggle() } function hideInfo() { $('#query-results').hide() $('.boat').css('fill', '#FCF8E8') $('.boat').data('sel', 0) } </script> <style type='text/css'> label { background-color: #607d8b; color: white; border: 1px solid white; display: inline-block; padding: 4px; width: 130px; margin-right: 10px; } #query-results { display: none; } #vortex:hover { cursor: pointer; fill: url('#myGrad2'); } #info_btn { cursor: pointer; } #infopanel { display: none; } .berth:hover { fill: #2e90ff; cursor: pointer; } body { background-color: #000080; } </style> </head> <body> <?php include $ROOT.'header.php' ?> <div id="infopanel" class="w3-card-4 w3-container w3-sand"> <div class="w3-panel w3-brown w3-center w3-padding w3-large"> Informasjon <span class="w3-right w3-margin-right" onclick="hideHelp();"><i class='fas fa-times'></i></span> </div> <p>Denne siden gir en oversikt over marinaen, båtene og båtplassene i BSF marina. I tillegg vil du finne noe informasjon om Røykenvik og Randsfjorden her.</p> <ul> <li>Klikk på en båt (baug-området) for å se informasjonen om den båten/eieren i et informasjonspanel øverst på siden.</li> <li>Når en båt er valgt, kan du flytte den til en annen båtplass av samme størrelse ved å klikke på en tom køye.</li> <li>Du kan også slette båten ved å klikke på "slette fra venteliste"-knappen nederst til høyre.</li> <li>Disse bevegelsene brukes fra i dag. Hvis du vil at de skal brukes på en annen dato, kan du angi ønsket dato i båtens informasjonspanel</li> <li>De første 10 båtene (i datorekkefølge) for hver brygge som venter på at en bryggeplass skal bli tilgjengelig, vises i "venteområdet" nederst. Igjen, disse kan velges og tildeles en tilgjengelig båtplass.</li> </ul> </div> <div class='w3-container'> <div id='query-results' class='w3-card-4 w3-margin w3-padding w3-light-gray'> <!-- click response --> </div> <div id='marina' class='w3-container w3-padding w3-center' style='overflow:auto;'> <?=marina($pdo)?> </div> </div> <?php include $ROOT.'footer_marina.php'; ?> </body> </html>
  2. As explained, this is a script that barand has put together for me. I've probably messed it up properly, he's done a good job of getting me started again, but I have a long way to go. So if I understand you two right. NO LINESPACE BETWEEN <? PHP and?> Will that say not abow the block or below the block to? I know I can take shortcuts that are stupid to make it easier to read the code, both along the way and afterwards. So what I spend an enormous amount of time on now is correcting all the mistakes I have "made". So I have to go through and make sure that everything that is between opening and frying PHP is without double line breaks / white space .. When you say this about the differences between the different IDEs that exist in the market. Do you mean that they treat the code differently or do you mean that they show the code in different colors? It's because I take shortcuts to make the code more readable to myself I break up the blocks. I am fully aware of that, but in eagerness and able to do more and in combination with the fact that I am tired, unconcentrated and just want to do a little more all the time, I do a lot of stupid things. And sometimes I can make so many changes that in the end I do not remember what I have done. I remember that I was very structured in the way I worked before, but everything is forgotten, unfortunately. Do you mean that you do not need to close <?php I never think I've tried before. I will remeber that 🙂 I will post the complete the full script from the marina.php file. That file is loooong. I will post it below of this post. After i have done that i have to go to bed. Its 11:00 in the morning here in norway now, so its on time to get some sleep. I haven't slept for 33-34 hours.
  3. Why do i get a; Syntax error unexpected '?' on the line below? $loggedin = $_SESSION['member_id'] ?? 0;
  4. No, it did not help to delete the <? Php and?> That were too many and I also made sure not to have any white space between <? Php .... and ....?> I also made sure not to have white space before them in the margin.
  5. O oh... Is that the reason. Got to try it. Give me 3 min. Yes, it has bean a realy long dau- 12:50 in the night here now 😮 Thanks for your suggestion.
  6. I thought you understood it was a session_start error when i say so. Here is a print screen of what the error is in letters. heres a screen dump: (before you ask. I have tried "require_once". It doesent help.)
  7. Please help me out here? I have had this error for weeks now, but i cant find the reason. And noe i even dont know where to look. I am totaly f***** The error is about "session_start" "<? php error_reporting (E_ALL); ini_set ('display_errors', '1'); ?> " Can the above error checker show errors even a site is opening normal? When I open a page with session_start, an error occurs, but when I open the same page without this, the page opens without problems and appears and appears completely without error. Ie. that all pages that contain session_start then the error will appear, as long as I have activated error check. Have for a long time suspected that this error is related to log in. So I tried to run error check directly from the log in page. I did not get any errors there, but I can not log in. On the log in page there is no session_start, but there is a "$ loggedin = $ _SESSION ['member_id'] ?? 0;" that is, this is a variable for session start. Or a global variable. So the error may be in db_inc.php as well, but I can not find the error. I do not understand what I am overlooking. I have tried as best I can to familiarize myself with the script. It's not set up by me. That's what barand has done, so before anyone asks why I can not ask barand. Then I say as it is. I do not understand that either, he has probably told me something, but ..... Easiest is to say: So, dont even ask. I hope anyway to get help to solve this problem. Can the "specified" error check indicate an error outside it is there? Or, it is there, but not where it is supposed to be. # counselless Below is some of the scripting from the files. Name of files included. **AJAX script in the.php is deleted because there is no relations in that of mater**. --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- db_inc.php <?php define("HOST",'****'); // Default database host. define("USERNAME",'****'); // Deafault database username . define("PASSWORD",'****'); // Default database password. define("DATABASE", '****'); // Default database name. function pdoConnect($dbname=DATABASE) { $db = new PDO("mysql:host=".HOST.";dbname=$dbname;charset=utf8",USERNAME,PASSWORD); $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $db->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC); $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, false); return $db; } ?> --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- header.php <?php //error_reporting(E_ALL); //ini_set('display_errors', '1'); ?> <?php $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'; ?> <?php session_start(); $ROOT = str_replace('\\', '/', $_SERVER['DOCUMENT_ROOT']) . '/'; $HOST = 'http://' . $_SERVER['HTTP_HOST'] . '/'; 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; } $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>Error: Kunne ikke logge inn!</p></div>"; } ?> --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- marina.php <?php session_start(); $ROOT = str_replace('\\', '/', $_SERVER['DOCUMENT_ROOT']) . '/'; $HOST = 'http://' . $_SERVER['HTTP_HOST'] . '/'; include $ROOT.'db_inc.php'; $pdo = pdoConnect(); const PAGETITLE = 'Båtplasskart og Venteliste'; const HELPBUTTON = "<span id='info_btn' class='w3-badge w3-small w3-white w3-border w3-border-white w3-right' title='Hjelp'>?</span>"; ////////////////////////////////////////////////////////////////////////// **AJAX script is deleted because there is no relations in that of mater** --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- login.php <?php error_reporting(E_ALL); ini_set('display_errors', '1'); ?> <?php session_start(); $ROOT = str_replace('\\', '/', $_SERVER['DOCUMENT_ROOT']) . '/'; $HOST = 'http://' . $_SERVER['HTTP_HOST'] . '/'; include $ROOT.'db_inc.php'; $pdo = pdoConnect(); $loggedin = $_SESSION['member_id'] ?? 0; unset( $_SESSION['member_id'], $_SESSION['isadmin']); if ($loggedin) { header("Location: {$HOST}index.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}index.php"); exit; } else $msg = "<div class='w3-panel w3-red w3-padding'><p>Ugyldig innlogging</p></div>"; } ?> --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- front.php <div class='w3-content w3-card-4 w3-margin-top w3-padding w3-light-gray'> <div class="w3-content"> <div class='w3-panel w3-blue-gray w3-center'> <h3>Infrormasjon og Nyheter i Brandbu Småbåtforening, Røykenvik og på Randsfjorden.</h3> </div> <div class='w3-container'> <h4>Registrere som medlem, legge inn båt og få tildelt båtplass.</h4> <p>Det er gjort så pier A, B eller C velges automatisk som visninglg av kun de ledige plasser på registreringsidens nedtrekksmeny for pier-valg/for hvilke pier man tildeles. Scriptet skiller mellom oddetall og partall på alle pierene inkl. B brygge/pier. Alt skjer automatisk selv om det er både 3 og 3,5 meters plasser der. Dette skjer ut i fra hvilke bredde på båten som legges inn i registreringskjemaet. Det skal ikke gå ann å få større plass enn hva systemet er satt til å beregne som tilpasset for hver brygge/plass. <p> <h4>Log In</h4> <p>Jeg har generert e-postadresser for alle testmedlemmene. Alle e-poster har utforming "fornavn.etternavn@gmail.com". Ved en tilfeldighet har alle medlemmer valgt samme passord ("passord"). Scott Chegg er for tiden utnevnt til administrator, så for eksempel <ul> <li>Logg inn som Admin</p> <pre> E-mail : scott.chegg@gmail.com Passord: password </pre> </li> <li>Logg inn som normalt medlem</p> <pre> E-mail : peter.dowt@gmail.com Passord: password </pre> </li> </ul> <p> Gjestetilgang gis for øyeblikket menyalternativene "Båtplass" og "Innmelding" (og "Logg inn", selvfølgelig) </p> <p> Bare administratorer har menyfunksjonen "Faktura" tilgjengelig. </p> <h4> Marina.php </h4> <p> &bull; Gjestene &ndash; kan se kartet og klikke på båter, men medlemsdata er skjult for dem. De kan ikke flytte båter. <br> &bull; Medlemmer &ndash; kan klikke båter og se medlemsdata. De kan heller ikke flytte båter. <br> &bull; Administratorer &ndash; kan klikke båter, se medlemsdata og flytte båter. </p> <p> Lagt til brygge C + for båter med bjelke over 3,8 meter. Disse båtene har nå sin egen venteliste. </p> <p> Alle ventelister utvidet til å vise de 10 første båtene i hver liste. </p> <h4> Members.php </h4> <p> Medlemmenes medlemsnummer vises på listen. </p> <p> Medlemmer kan redigere sine egne personlige data. De kan også legge til detaljer om den nye båten sin (om nødvendig). <ul> <li> Hvis den nye båten har samme størrelse som den gamle båten, blir båtplassen beholdt </li> <li> Hvis den nye båten er mindre enn den gamle båten, blir båtplassen beholdt til slutten av medlemsåret og deretter plassert på ventelisten for en mindre båtplass </li> <li> Hvis den nye båten er større enn den gamle båten, plasseres den nye båten i venteliste for bredere båtplass. </li> <li> Den gamle båten fjernes i alle tilfeller. </li> </ul> <p> Administratorer kan redigere alle medlemmers personlige data og angi / deaktivere medlemmers administratorstatus. Administratorer kan også fjerne medlemmer (i så fall blir båten deres også fjernet) </p> <h4> Register.php </h4> <p> Et for øyeblikket tilgjengelig medlemsnummer vises på skjemaet. Ved registrering tildeles medlemmet dette medlemsnummeret </p> <h4> Fakturaer </h4> <p> Disse viser nå medlemmets navn og medlemsnummer </p> </div> </div> </div> </div> --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- index.php <?php session_start(); $ROOT = str_replace('\\', '/', $_SERVER['DOCUMENT_ROOT']) . '/'; $HOST = 'http://' . $_SERVER['HTTP_HOST'] . '/'; const PAGETITLE = "Velkommen"; include $ROOT.'header.php'; include $ROOT.'front.php'; //For you only. Remove when not required include $ROOT.'footer.php'; ?>
  8. I got this "<class="w3-bar-item w3-button">" The buttons and the bar got the color #008833 (green), the hover color is standard light grey, but I want it to hoover in my specified color (#008833) and hold on to this colorff6633 (orange) when its clicked/chosen and hold on to that color (#ff6633) when it is on that site/page. I tried to find the solution for this in the index of w3 schools index over w3.css, but i couldn't find it, dosent it exist or? (correct me if i am wrong?)
  9. barand, thanks 🙂 (vomit, that was a good one 🤣😜)
  10. Yes, that's exactly what I was talking about. You probably threw out some "words" I left out and say. I'm too careful to say too much here yet because I'm fresh in here and do not know where the line is laid. Besides, I have been away from the "subject" for too long to be able to engage in longer discussions about what is good or bad. It's too much new and too much to get acquainted with right away in addition to the fact that I struggle to remember what I could from before. It is 11 years ago and more than that since I was involved in development. I dont know if you guys understand what i mean sometimes, but some times i realy struggle. And that's why i am so happy to find this site with so many good programmers and developers that is not afraid telling a Norwegian man (who feels so stupid) soon 50 years old how to do it even though he some times ask to much. Thank you 🙂
  11. Maybe it's because w3-css is new to me, but the fact is that i know css wer y well from before. I am not in to css3 or w3 css, that i look at as a kind of containers with a lot of ready to use css scripts/syntax. I am the old school that like to have control over what i am doing and what is happening because of what i have done. I feel like i am loosing that control with w3-css. Because every thing is pre-made, but i have seen it like this is something i have to learn. So thats why i am strugling with this. At least, they could have left a little from the basic of CSS when making this (horse shit). I call it like that because i am loosing the control i am used to have before when i was working with this. But i still got it in me. I have some external .css files. Or... there is a advantage with w3-css. Since we got so many platforms to relate to as developers, it is probably an advantage that we are spared a lot of extra work to have our sites to fit all over. We didn't need to do that before. But beyond that .... I wish you a good night requinix. I am tired and have to go to bed soon. It has bean a looooong day.
  12. A wery good night to upload files to the server.
  13. OK 🙂 I know that one, but i thought i could set a BG color on a W3-css bar with a hex valuea with w3-black. I will remeber that. Thanks 🙂 Isn't it posible to set a w3-#000000 at all?
  14. How do I set the color value with hex in w3-css? I tried w3-#009000, but it didnt work. I also tried w3-#009000; but that didn't work either.
  15. Ok, so what you you are saying is that most people dont use the quote marks at all, but there is a standardization saying use them as you described for me? Its easier for me asking here than reading through a lot of text on w3c or w3schools to find the ansver. So thank you for helping barand and requinix.
  16. Yes i can see i have left them out here. But back to my question. Is it with the quotes mark or with out them? If there depends on where and what, please tell me when to use them and when to not use them.
  17. a litle problem with my external script. It seem s like it is a difference with or without quote marks on values, depending on what kind of value there is/what it's for. I cant remeber it was something like that. Below i have an example. Please feel free to copy it and write it how you would have done it. div.copyright_box { max-width: "100%"; max-height: "100%"; font-family: Consolas; font-size: "11px"; text-align: center; color: #000000; h4.headline { text-align: "center"; font-family: "arial"; font-weight: "bold"; font-size: "15px"; line-height: "10"; letter-spacing: "5px";
  18. Thanks for your validator tip cyberRobot. I knew about this. I used it already 20 years ago. But still thanks. All help and tips is good help and ment the best way.About this <label> tag, i am on my way do be known with it. I have never used it before. Remember, (or, i dont know if you know) I have been away from developing in all ways for more than 10 years. So i am in a way coming back. More or less I have to re-learn everything I knew, and in addition forget the outdated so I can learn the new that has come and updated. It's damn worse than being completely ignorant on the school desk the first day. Who would have thought that I was once both a teacher and a lecturer. It is unbelievable. I think barand (the one on this forum) more than once has balded his head in the road because of me. He has helped me a lot, and I am eternally grateful for that help.
  19. You were so right gizmola. On almost every page there is a "include $ROOT.'db_inc.php'; ". They must have bean there from before. I haven't put them there. They must have ben there from when barand made the script. It has bean working til now. I think i have to ask him what happen. The case is for now: As long i set them as a comment. It works fine... or there is a error on line 12 or something, but the page e.g. shows up and some others to. So for now it is working bether. But, as i said. Something happened here, but nothing like that is done by me. Thanks for now gizmola
  20. But gizmola, i haven't changed anything that has to do with what you suggest as a solution. But i will look after to be sure.
  21. There in's any more info in the error msg than showing. So nothing is cut off. Look: This was working with include before and should be now too.
  22. Thanks Barand. Saved by you again 🙂 👏👌👍 I cant remember it was written that way before. Now it's working. Should have listen more to ginerjm to, so thanks to both of you 🙂
  23. The error has nothing to do with the globals/variables in the connection script/include file. It is a Quoting mark error nearby the text to be printed out by PHP on the screen. On the screen it should looks like this: Diskuter (the link text) But, it look like this: w3-disabledDiskuter
  24. It works fine the way it is, and the way barand has set it up. define("HOST",'xxx.xxxx.xxxxxxxxxx.com'); // Default database host. $db = new PDO("mysql:host=".HOST.";dbname=$dbname;charset=utf8",USERNAME,PASSWORD); The error is where i alresdy have told. But i cant see where to put the quotes.
×
×
  • 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.