Tumgik
#reminder that html and css is a nightmare
lvnarsapphic · 2 years
Text
ignore the time im writing this post but oh my god, i finally found the silver bullet in making my theme look right on the common screen resolutions from 720p to 1080p, with 150% to 100% display scaling
https://www.w3schools.com/css/tryit.asp?filename=trycss_website_layout_blog
@media screen and ([max/min]-height: [effective vertical resolution]px) {
.div1, .div2, [etc.] {
[properties that will be overridden by different displays:
- margin
- width
- padding
- etc.]
}
if you know of a better more universal method than the above, please dm me cause i have a feeling this is gonna be tedious and inefficient code once I implement it
0 notes
tmaclucien · 5 years
Photo
Tumblr media
Recently, we are going to discover a new web area: server-side web development. It reminds me of my elective course: server-side web development and database, which was a nightmare for me last semester. Because I did not know any computer languages before and it was really difficult for a web starter who started learning the server-side language firstly.
Basically, the computer languages used in clientside are HTML/CSS/JavaScript.
While PHP/ Python/ Java are the normal server-side scripting languages. But PHP is the most popular one, which I learned last semester. And I also use MySQL, which is a popular open-source relational database management system.
In MySQL, you can use SQL language to insert information to the tables you have created. And then use PHP language to create home page, login page...
But how PHP and MySQL work?
For example, if users click the login button, his username will be transferred into the server and the server will check the database if there is a same name. If yes, then check the password again. If the username and passport are correct, users then are allowed to access to the main page. If not, the login page will remind users that the usernames do not exist. 
And the following is my login page from last semester.
<?php  session_start(); // If user click login button, those information from html form will be assigned to variables//   if (isset($_POST['login'])) {    include_once("connect.php");
   $username = strip_tags($_POST['username']);    $password = strip_tags($_POST['password']);
   $username = stripslashes($username);    $password = stripslashes($password);
   $username = mysqli_real_escape_string($db, $username);    $password = mysqli_real_escape_string($db, $password);
   $password = md5($password);
//Draw all data from table "Blogging" if the username wrote by user is the same with database and assign them to a variable//    $sql = "SELECT * FROM user WHERE username = '$username' LIMIT 1";    $query = mysqli_query($db, $sql);    $row = mysqli_fetch_array($query);    $ID = $row['ID'];    $db_password = $row['password'];    $admin= $row['admin']; // If user type the right login information, they can access to home page, otherwise there will be a warning to inform user that they type the incorrect information//    if ($password == $db_password) {       $_SESSION['username'] = $username;       $_SESSION['ID'] = $ID;       if ($admin == 1) {       $_SESSION['admin'] = 1;       }       header("Location: index.php");    }  else {         echo "You didn't enter the correct detalis!";       }
 }
?>
<!DOCTYPE html> <html> <head> <title>Login</title> </head> <body background="bg.jpg"> <link rel="stylesheet" type="text/css"href="style.css">
<div class='Loginbox'> <div align="center">
<!-- The Title of Login Page --> <h1>Hello Griffith</h1> </div>
<div align="center"> <br>     <form action="login.php" method="post" enctype="multipart/form-data">      Username: <input type="text"  name="username" autofocus/>      <br><br>      Password: <input type="password"  name="password" />      <br><br>      <input type="submit" name="login" value="Login" />      <br>      <?php      echo "No Accounts? <a href = 'register.php'>Register</a>";      ?> </form> </div> </div>
</body> </html>
0 notes