Jump to content

Jedijon

Members
  • Content Count

    20
  • Joined

  • Last visited

Community Reputation

0 Neutral

About Jedijon

  • Rank
    Member
  1. How to add the ability to login with username or email for login? <?php ob_start(); include('../header.php'); include_once("../db_connect.php"); session_start(); if(isset($_SESSION['user_id'])!="") { header("Location: ../dashboard"); } if (isset($_POST['login'])) { $email = mysqli_real_escape_string($conn, $_POST['email']); $password = mysqli_real_escape_string($conn, $_POST['password']); $result = mysqli_query($conn, "SELECT * FROM users WHERE email = '" . $email. "' and pass = '" . md5($password). "'"); if ($row = mysqli_fetch_array($result)) { $_SESSION['user_id'] = $row['uid']; $_SESSION['user_name'] = $row['user']; $_SESSION['user_email'] = $row['email']; header("Location: ../dashboard"); } else { $error_message = "Incorrect Email or Password!!!"; } } ?>
  2. .dropbtn { background-color: #4CAF50; color: white; padding: 10px; font-size: 16px; border: none; } .dropdown { position: relative; display: inline-block; } .dropdown-content { display: none; position: absolute; background-color: #f1f1f1; min-width: 800px; box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2); z-index: 1; } .dropdown-content img { width: 32px; height: 32px; margin: 3px; position: relative; float: left; } .dropdown-content a { color: black; padding: 12px 16px; text-decoration: none; display: block; } .dropdown-content a:hover {background-color: #ddd;} .dropdown:hover .dropdown-content {display: block;} .dropdown:hover .dropbtn {background-color: #3e8e41;} /* HIDE RADIO */ [type=radio] { position: absolute; opacity: 0; width: 0; height: 0; } /* IMAGE STYLES */ [type=radio] + img { cursor: pointer; } /* CHECKED STYLES */ [type=radio]:checked + img { outline: 2px solid #f00; } <div class="dropdown"> <button class="dropbtn">Dropdown</button> <div class="dropdown-content"> <form name="form" action="icons-submit/submit_icon-default.php" method="post"> <input type="radio" id="icon_default" name="icon_default" value="icons/default.jpg" onchange='if(this.value != 0) { this.form.submit(); }'> <img src="icons/default.jpg"> <input type="text" id="id" name="id" value=" . $row['id'] . " style="background: transparent;border: none;font-size: 0;"> </form> <form name="form" action="icons-submit/submit_icon-default.php" method="post"> <input type="radio" id="icon_default" name="icon_default" value="icons/default.jpg" onchange='if(this.value != 0) { this.form.submit(); }'> <img src="icons/default.jpg"> <input type="text" id="id" name="id" value=" . $row['id'] . " style="background: transparent;border: none;font-size: 0;"> </form> <form name="form" action="icons-submit/submit_icon-Grass_Block.php" method="post"> <label> <input type="radio" id="icon_grass-block" name="icon_grass-block" value="icons/Grass_Block.png"onchange='if(this.value != 0) { this.form.submit(); }'> <img src="icons/Grass_Block.png"> </label> <input type="text" id="id" name="id" value=" . $row['id'] . " style="background: transparent;border: none;font-size: 0;"> </form> <form name="form" action="icons-submit/submit_icon-gear.php" method="post"> <label> <input type="radio" id="icon_gear" name="icon_gear" value="icons/Gear.png"onchange='if(this.value != 0) { this.form.submit(); }'> <img src="icons/Gear.png"> </label> <input type="text" id="id" name="id" value=" . $row['id'] . " style="background: transparent;border: none;font-size: 0;"> </form> </div> </div>
  3. Jedijon

    How to make it insert info from session

    Query looks like: SELECT * FROM datakeyWarning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, string given in /srv/disk1/2648096/www/site/test/index.php on line 35 It shows the session data
  4. Jedijon

    How to make it insert info from session

    Error message Parse error: syntax error, unexpected ';', expecting ',' or ')' in /srv/disk1/2648096/www/site/test/index.php on line 20
  5. Jedijon

    How to make it insert info from session

    I have that <?php // Initialize the session session_start(); // Check if the user is logged in, if not then redirect him to login page if(!isset($_SESSION["loggedin"]) || $_SESSION["loggedin"] !== true){ header("location: ../login"); exit; } ?>
  6. Jedijon

    How to make it insert info from session

    <?php $con=mysqli_connect("IP","Username","Password","Database name"); // Check connection if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } $result = mysqli_query($con,"SELECT * FROM {$_SESSION['datakey']}"; echo "<table border='1'> <tr> <th></th> <th></th> <th></th> <th></th> <th></th> </tr>"; while($row = mysqli_fetch_array($result)) { echo "<tr>"; echo "<td>" . $row['column1'] . "</td>"; echo "<td>" . $row['column2'] . "</td>"; echo "<td>" . $row['column3'] . "</td>"; echo "<td>" . $row['column4'] . "</td>"; echo "<td>" . $row['column5'] . "</td>"; echo "</tr>"; } echo "</table>"; mysqli_close($con); ?>
  7. Jedijon

    How to make it insert info from session

    $_SESSION['datakey'] contains the name of the table
  8. Jedijon

    How to make it insert info from session

    It will grave the info from the login SESSION
  9. Jedijon

    How to make it insert info from session

    Didn't work $result = mysqli_query($con,"SELECT * FROM {$_SESSION['datakey']}";
  10. Jedijon

    How to make it insert info from session

    $result = mysqli_query($con,"SELECT * FROM table name"); but where the table name goes I wan't it use $_SESSION['datakey'] to get the table name
  11. Jedijon

    How to make it insert info from session

    I don't wan't it to be inserted into the database but use the session info as the name of the table to grave data from for the html table
  12. Jedijon

    How to make it insert info from session

    Like this $result = mysqli_query($con,"INSERT * FROM $_SESSION['datakey']";
  13. $result = mysqli_query($con,"SELECT * FROM $_SESSION['datakey']";
×

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.