-
Posts
396 -
Joined
-
Last visited
-
Days Won
1
Everything posted by LeonLatex
-
Hello, and good evening DevonZeb. I was new here in February 2021. I know exactly what you are talking about. Self i have bean away from programming for over 10 years. woke up a spring morning 1,5 years ago. Couldnt do anything. It was like blown away. And it wasnt in my imagination it was so hard learning again. It is like i was writing in another thread here. It is like waking up from coma and cant do anything. Got to learn everything up again. And that is not easy at the age of 50.
-
Good evening Sprig 🙂 I am like you and manny others here "of the old school". I was new here in February 2021.I have bean away from Programming and the life inside the IT univers for more than 10 years. So i know exactly what you are talking about. When i started programing again i thought i would be a easy match. I was so wrong. It was like waking up from coma and have to learn every thing up up up and up again. Good luck Sprig, and welcome 🙂 Leon (Norway)
-
Nice and a smart move barand, wery! As the person you are, of all, YOU, you go out public to mark me and throwing all the blame on me? It's ok. I let you do that. But... I know you have frinds and like-minded in here on PHP Freaks. You have bean here since 2002 or something. You are well known among the other once her. PHP Freaks is a site i came over by chance, and it was a lucky shot that I did so. Here I also found "my" like-minded people. People who needed help. I did it because I've been away from the "subject programming" for over ten years (since 2010/11). Things I could do were totally gone. I had to learn everything again. There are also "several reasons" for this. Blue. a stroke in 2014. But I'm also 50 years old in January, so everything is not so good and functional anymore , by the case learning. These are things I've told barand about before he knows a lot of me and my future as a self developed and a businessman and one of the persons and owners behind the biggest webhosting and data center in Norway. That is a story back to 1998/99 (actual in 1995, but that is a longer story). So he knows about it, about me. There are also some other incidences as a traffic accident in 1988 with major head injuries that make memory and earning not my biggest "thing" in life. soooo ...... maxxd, then you have heard a little of the one side of the story. I never felt for explain or tell others about what happened between me and barand, or other things for that mather. And still barand is trying to put me in a place i dont belong. Remember there is always two sides of a story, two sides of whats true. Here is the rest of my version. (And i have never tried to hide that this script was something barand had done) Just go back and look up in this tread. I never feel to put a stamp on or blame other people. I let them do their things. As long.........as long as it is not unfair and not goes over head of me or any of mine. I am concerned about justice and that everyone including myself is treated with respect. Now i feel for saying. (never thought i would go SOOOO in to discuss OT on a internet forum). Me and barand was skyping and working on the "marian project" one nigh(i think it was in june)t, like we had done since around February. Me in Norway and him in GB. That day i had tried to do some adjustments and corrections on the site barand has made for me, and. In that matter i removed hes signature. I tried out a few things. Some were luckyly put back the way barand did it Part of the reason why barand should help me with this was that I could use it to learn / practice. That was not a agrement among us from the beginning. But along the way, it became more and more clear that this was what this project was about, and that I would be able to use it later for what it was intended for. A gift from me to my marina where I live. They have had problems for a long time with running the marina association for several years due to lack of time, and that the marina is run on a voluntary basis (unpaid). all with manny problems, like a surgery that went wery wrong, eating heavy medications and a loss of a friend (barand knows all of this) i now felt like stating to go realy in to study and learn barands code. So the whole day i was doing this and sudenly some time in the evening/night barand showed up. And i was actualy waiting for him because i was exited see him on Skype. Like i throw all in my hands away i contacted him/or he was contacting me. I had a lot of questions to ask him. So now i forgot all about what i had done and put them back the way they was. I had the signature/copyright text in the footer file from another site i was working on. Where i forgot to change the text and implement barands information. It still had my name and e-mail, and my intension was to put in barands name and e-mail. Hard to explain and be belived. You got to know me to to understand(me). So, over to the core of the marina.php file where all begun. I tried to learn the PHP and AJAX he set up in this file. He realy did a great job. I comment out hes signature and I commented out part of hes scripts and blocks, just to see what the diferent functions in the script(s)works/do, among other things. If I had the intention to remove it (take advantage of), then I had not just commented it away. I would totally remove it in the source code. There were many things up there that had been commented out, but that he had not seen. besides the one thing that was visually visible in the browser. Until this we had a good collaboration on both mic and writing on Skype. When he became aware of this, he totally turned on his heels and I have never seen a person turn so completely on mood, situation and not least receptivity to listen to what is an explanation. No, barry has since made his own version and locked me out. I tried then as now to explain what had happened. Both in writing by email, on Skype and on pm here at PHP Freaks. Lately I have been trying to sell the script since I do not want to finish it. I have received several stakeholders for it. There is one offer in particular from Denmark that seems to be serious enough. When I got an answer from Denmark a few days ago, I contacted barand the same day / evening and told him about it, and that I would divide the sum 50/50, but now I do not know if it works either. Since I contact Denmark, I wanted to clean up and make the code more readable. That's why I've now messed up the whole script and rendered it useless. Why would I make myself an enemy with someone I depended on to move on? I know that with this I am in danger of not receiving help anymore here on PHP Freaks or being banned. Of course I hope we can all be friends, but ... how far are you willing to go? I also feel unfairly treated. Again, sorry for what I did that seemed like taking your credit for the work I will forever be grateful for. For that is what you accuse me of, and who have not been willing to listen to me. Sorry.... (i had a backup of the scripts/site, but deleted it when i was about delete the web root files and put in the backup).
-
<?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'>" : " <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)'>© 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>
-
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.
-
Why do i get a; Syntax error unexpected '?' on the line below? $loggedin = $_SESSION['member_id'] ?? 0;
-
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.
-
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.
-
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.)
-
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> • Gjestene – kan se kartet og klikke pÃ¥ bÃ¥ter, men medlemsdata er skjult for dem. De kan ikke flytte bÃ¥ter. <br> • Medlemmer – kan klikke bÃ¥ter og se medlemsdata. De kan heller ikke flytte bÃ¥ter. <br> • Administratorer – 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'; ?>
-
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?)
-
barand, thanks 🙂 (vomit, that was a good one 🤣😜)
-
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 🙂
-
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.
-
-
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?
-
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.
-
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.
-
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.
-
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";
-
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.
-
PDO Connect & Session error (pictures of error codes)
LeonLatex replied to LeonLatex's topic in PHP Coding Help
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 -
PDO Connect & Session error (pictures of error codes)
LeonLatex replied to LeonLatex's topic in PHP Coding Help
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. -
PDO Connect & Session error (pictures of error codes)
LeonLatex replied to LeonLatex's topic in PHP Coding Help
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. -