Jump to content

elcou96

Member
  • Posts

    38
  • Joined

  • Last visited

Awards

This user doesn't have any awards

3 Followers

About elcou96

  • Birthday Dec 01, 1996

Profile Information

  • Gender
    Male
  • Location
    Belgium
  • Interests
    Tolkien, tech, badminton
  • Occupation
    Software engineer
  • Member title
    Junior Member

System

  • CPU
    AMD Ryzen 5 5600X
  • Motherboard
    Gigabyte B550M AORUS PRO-P
  • RAM
    Corsair vengeance pro RGB 32GB DDR4-3200
  • GPU
    EVGA 3070Ti FTW3
  • Case
    Fractal design meshify 2 compact
  • Storage
    1TB Samsung 980 nvme
  • PSU
    Corsair RM750
  • Display(s)
    LG 27GN850
  • Cooling
    Noctua nh-d15s
  • Keyboard
    Ducky Shine one
  • Mouse
    Corsair m65 pro
  • Operating System
    Windows 10
  • Laptop
    MSI gs65
  • Phone
    Pixel 6
  1. yeah, I escaped the strings on the two places that were vulnerable to sql injections (email and password for admin login). For a regular user there is never a place where they have to enter text that's used in a query (no forms and such), so I should be all right I think
  2. Site is up and running
  3. found it! Really weird, but its kinda working now
  4. also apparently something is changing $_session['VarToSet'] to corresponding date pulled from the db, that might be the issue, but I don't remember/can't find where I did that...
  5. Yeah I'm not using that anymore, and the only reason I did that, was because I hoped that might help. right now: index.php: [code] <?php ini_set("session.save_path", "tmp"); session_start(); if(isset($_POST['VarToSet'])){ if($_POST['VarToSet'] == "val1"){ $_SESSION['VarToSet']=1; } if($_POST['VarToSet'] == "val2"){ $_SESSION['VarToSet']=2; } if($_POST['VarToSet'] == "val3"){ $_SESSION['VarToSet']=3; } session_write_close(); header('Location: index.php'); } if (!isset($_SESSION['VarToSet'])){ include('template/SelectValVar.php'); // Var Setting } else { include('template/header.php'); // Page Header include('views/'.$view['name'].'.php'); // View Type include('template/footer.php'); // Page Footer } ?> [/code] selectVarVal.php: [code] <form method="POST" action="index.php"> <div class="col-md-2"> <input type="submit" class="btnstyle center-block" id="val1" name="VarToSet" value="val1" /> </div> <div class="col-md-2"> <input type="submit" class="btnstyle center-block" id="val2" name="VarToSet" value="val2" /> </div> <div class="col-md-2"> <input type="submit" class="btnstyle center-block" id="val3" name="VarToSet" value="val3" /> </div> </form> [/code]
  6. Ok, now the session variable gets set without ajax, using forms and $_Post, it loads the page correct, but I lose the value of the variable when I reload the page, the session-id is still kept.
  7. I am having an issue with setting php session variables. Here is what I'm trying to do: I'm creating a website that pulls data from a database. In the database, there are movie theater schedules of three different cities. (not that relevant, but might be useful to see the reason why I need this) So I want to use Session variables and a way to select one of those movie theaters. My index page is as follows: [code] <?php session_start(); if (!isset($_SESSION['varToSet'])){ include('template/selectVarVal.php'); // Var Setting } else { include('template/header.php'); // Page Header include('views/'.$view['name'].'.php'); // View Type include('template/footer.php'); // Page Footer } ?> [/code] So if the session variable varToSet is not set, you will get a page displaying the three options. These are three html buttons: [code] <button id="btnVarToSetVal1" class="btnstyle center-block">Val1</button> [/code] The buttons use javascript to send an ajax request to set the session variable: [code] $('#btnVarToSetVal1').on('click', function(e){ var name = 1; $.ajax({ type: 'POST', url: 'config/SetVar.php', data: { VarToSet: name } }); location.reload() }); [/code] with the php in SetVar.php: [code] <?php session_start(); if($_POST['VarToSet'] != 0){ $VarToSet = $_POST['VarToSet']; session_registrer($VarToSet); $_SESSION['VarToSet'] = $_POST['VarToSet']; //header("Location: index.php"); } else{ unset($_SESSION['VarToSet']); //header("Location: index.php"); } ?> [/code] Thus, the javascript should start the php to set the session variable and reload the index page, which then has the VarToSet-variable set and should display the correct page instead of the SelectValVar-page. This works on my localhost (xampp apache server), but only on chrome and not on firefox and edge. It doesn't work on the Host I am deploying the website to at all, not even on chrome. When I click one of the buttons, the page reloads, but keeps displaying the SelectValVar-page. As far as I can tell the session-id stays the same, but the session variable doesn't get set, or doesn't stick. Yesterday I managed to get the page to load the correct page, but when switching pages (using the navigation) it lost the session-variables again and it displayed the SelectValVar-page anew. The Host is using an older version of php (5.3.29) which also causes some other issues but to my knowledge that shouldn't affect the setting of session variables. Am I doing something wrong? What can I do to get the damned thing to work??
  8. Congratulation!! Thanks for the giveaway (Blade 14)
  9. Currently have a razer blackwidow, a corsair m45 (that's almost broken and they don't sell them anymore :'( ) and macaw gt100s earbuds
  10. Currently have a gtx660, need an incentive to upgrade my entire rig
  11. nvm found a way: The solution I used: I put the image as the background of a div with a fixed heigth and made sure the image was positioned correctly. new html: <!-- Carousel ================================================== --> <div id="carousel" class="carousel slide" data-ride="carousel"> <!-- Indicators --> <ol class="carousel-indicators"> <li data-target="#carousel" data-slide-to="0" class="active"></li> <li data-target="#carousel" data-slide-to="1"></li> <li data-target="#carousel" data-slide-to="2"></li> </ol> <div class="carousel-inner" role="listbox"> <div class="item active"> <div class="carousel_image" style="background: url(images/lunchbox.jpg) no-repeat"></div> <!--<img class="first-slide img-responsive center-block" src="images/sample.jpg" alt="First slide">--> <div class="container"> <div class="carousel-caption"> <p> <a href="#"><h2>The Lunchbox</h2></a> <h6>8/01 - 20u</h6> </p> </div> </div> </div> <div class="item"> <div class="carousel_image" style="background: url(images/lunchbox.jpg) no-repeat"></div> <!--<img class="second-slide img-responsive center-block" src="images/sample2.png" alt="Second slide">--> <div class="container"> <div class="carousel-caption"> <p> <a href="#"><h2>The Lunchbox</h2></a> <h6>8/01 - 20u</h6> </p> </div> </div> </div> <div class="item"> <div class="carousel_image" style="background: url(images/lunchbox.jpg) no-repeat"></div> <!--<img class="third-slide img-responsive center-block" src="images/sample.jpg" alt="Third slide">--> <div class="container"> <div class="carousel-caption"> <p> <a href="#"><h2>The Lunchbox</h2></a> <h6>8/01 - 20u</h6> </p> </div> </div> </div> </div> </div><!-- /.carousel --> Using @media, I made a different style for small devices. added this to my css: .carousel .carousel_image { background-size: contain !important; width: 100%; height: 400px; background-position: center !important; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover; } @media (max-width:499px){ .carousel .carousel_image { background-size:contain !important; background-position: center !important; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover; width: 100%; height: 200px; } } The solution isn't 100% as I wanted, but it works
  12. In a website I am creating, I need an image-carousel. I tried the default bootstrap carousel, with some adjustments (I need the captions and indicators underneath the image). I want the carousel to have a set max-height (depending on the device). However, when scaling the page or viewing on a mobile device, different-sized images tend to make the captions and indicators jump aroud as seen in the following images: -> -> Is there any way to fix this? Or am I forced to use images of a fixed size? Current HTML: <div id="carousel" class="carousel slide" data-ride="carousel"> <!-- Indicators --> <ol class="carousel-indicators"> <li data-target="#carousel" data-slide-to="0" class="active"></li> <li data-target="#carousel" data-slide-to="1"></li> <li data-target="#carousel" data-slide-to="2"></li> </ol> <div class="carousel-inner" role="listbox"> <div class="item active"> <img class="first-slide img-responsive center-block" src="images/sample.jpg" alt="First slide"> <div class="container"> <div class="carousel-caption"> <p> <a href="#"><h2>The Lunchbox</h2></a> <h6>8/01 - 20u</h6> </p> </div> </div> </div> <div class="item"> <img class="second-slide img-responsive center-block" src="images/sample2.png" alt="Second slide"> <div class="container"> <div class="carousel-caption"> <p> <a href="#"><h2>The Lunchbox</h2></a> <h6>8/01 - 20u</h6> </p> </div> </div> </div> <div class="item"> <img class="third-slide img-responsive center-block" src="images/sample.jpg" alt="Third slide"> <div class="container"> <div class="carousel-caption"> <p> <a href="#"><h2>The Lunchbox</h2></a> <h6>8/01 - 20u</h6> </p> </div> </div> </div> </div> </div><!-- /.carousel --> Current CSS; .carousel-inner > .item > .img-responsive { width: auto; max-height: 500px; } .carousel-inner { margin-bottom: 50px; } .carousel-indicators { } .carousel-indicators li { border: solid 2px; border-radius: 50%; border-color: #36393A; } .carousel-indicators .active { width: 10px; height: 10px; margin: 1px; background-color: #36393A; } .carousel-caption { bottom: 30px; position: relative; left: auto; right: auto; color: #36393A; text-shadow: 0 0 0; } .carousel-caption a { left: auto; right: auto; color: #36393A; text-shadow: 0 0 0; } .carousel-caption h2 { position: relative; margin-bottom: -8px; font-family: 'Open Sans', sans-serif; font-size: 16pt; font-weight: bold; left: auto; right: auto; color: #36393A; text-shadow: 0 0 0; } .carousel-caption h6 { position: relative; margin-bottom: -5px; font-family: 'Open Sans', sans-serif; font-size: 10pt; font-weight: bold; left: auto; right: auto; color: #36393A; text-shadow: 0 0 0; }
  13. I've tried every device, so far none of them appear to cause the spikes
  14. Tried it and it didn't fix it... (if you're wondering why I'm taking pictures of my screen with my phone, I was asking myself the same thing...)
×