cReTzUUUU's Content - Page 8 - GAMELIFE România Jump to content

cReTzUUUU

Hall Of Fame
  • Posts

    760
  • Joined

  • Last visited

  • Days Won

    17
  • Country

    Romania

Everything posted by cReTzUUUU

  1. Username:cReTzUUUU Creator (sau editor):cReTzUUUU Poze/Video în care prezinți index-ul: Versiune dextop: Versiune pentru mobil: Link Virustotal:https://www.virustotal.com/gui/file/f08aa2fee5900f452562db01fd2a17d78f5c4de1ee29f32cdf70fb2fea45f357/detection Link download : https://www66.zippyshare.com/v/YEIkj31G/file.html Alte precizări: 1.Index-ul conține elemente de css, html, javascrip, jquery, bootstrap. 2.Index-ul este optimizat SEO , mobile SEO consta in optimizarea unui site si pentru celelalte device-uri, respectiv smartphone si tableta. Optimizarea SEO a site-ului pentru mobil inseamna de asemenea ca resursele site-ului tau vor fi accesibile motoarelor de cautare.
  2. Code: <!DOCTYPE html> <html> <style> body {font-family: Arial, Helvetica, sans-serif;} form { border: 3px solid #f1f1f1; font-family: Arial; } .container { padding: 20px; background-color: #f1f1f1; } input[type=text], input[type=submit] { width: 100%; padding: 12px; margin: 8px 0; display: inline-block; border: 1px solid #ccc; box-sizing: border-box; } input[type=checkbox] { margin-top: 16px; } input[type=submit] { background-color: blue; color: white; border: none; } input[type=submit]:hover { opacity: 0.8; } </style> <body> <form action="/action_page.php"> <div class="container"> <h2>Subscribe to our Newsletter</h2> </div> <div class="container" style="background-color:white"> <input type="text" placeholder="Name" name="name" required> <input type="text" placeholder="Email address" name="mail" required> <label> <input type="checkbox" checked="checked" name="subscribe"> Daily Newsletter </label> </div> <div class="container"> <input type="submit" value="Subscribe"> </div> </form> </body> </html>
  3. Snake HTML Game: Code: <!DOCTYPE html> <html> <head> <title></title> <style> html, body { height: 100%; margin: 0; } body { background: black; display: flex; align-items: center; justify-content: center; } canvas { border: 1px solid white; } </style> </head> <body> <canvas width="400" height="400" id="game"></canvas> <script> var canvas = document.getElementById('game'); var context = canvas.getContext('2d'); var grid = 16; var count = 0; var snake = { x: 160, y: 160, // snake velocity. moves one grid length every frame in either the x or y direction dx: grid, dy: 0, // keep track of all grids the snake body occupies cells: [], // length of the snake. grows when eating an apple maxCells: 4 }; var apple = { x: 320, y: 320 }; // get random whole numbers in a specific range // @see https://stackoverflow.com/a/1527820/2124254 function getRandomInt(min, max) { return Math.floor(Math.random() * (max - min)) + min; } // game loop function loop() { requestAnimationFrame(loop); // slow game loop to 15 fps instead of 60 (60/15 = 4) if (++count < 4) { return; } count = 0; context.clearRect(0,0,canvas.width,canvas.height); // move snake by it's velocity snake.x += snake.dx; snake.y += snake.dy; // wrap snake position horizontally on edge of screen if (snake.x < 0) { snake.x = canvas.width - grid; } else if (snake.x >= canvas.width) { snake.x = 0; } // wrap snake position vertically on edge of screen if (snake.y < 0) { snake.y = canvas.height - grid; } else if (snake.y >= canvas.height) { snake.y = 0; } // keep track of where snake has been. front of the array is always the head snake.cells.unshift({x: snake.x, y: snake.y}); // remove cells as we move away from them if (snake.cells.length > snake.maxCells) { snake.cells.pop(); } // draw apple context.fillStyle = 'red'; context.fillRect(apple.x, apple.y, grid-1, grid-1); // draw snake one cell at a time context.fillStyle = 'green'; snake.cells.forEach(function(cell, index) { // drawing 1 px smaller than the grid creates a grid effect in the snake body so you can see how long it is context.fillRect(cell.x, cell.y, grid-1, grid-1); // snake ate apple if (cell.x === apple.x && cell.y === apple.y) { snake.maxCells++; // canvas is 400x400 which is 25x25 grids apple.x = getRandomInt(0, 25) * grid; apple.y = getRandomInt(0, 25) * grid; } // check collision with all cells after this one (modified bubble sort) for (var i = index + 1; i < snake.cells.length; i++) { // snake occupies same space as a body part. reset game if (cell.x === snake.cells[i].x && cell.y === snake.cells[i].y) { snake.x = 160; snake.y = 160; snake.cells = []; snake.maxCells = 4; snake.dx = grid; snake.dy = 0; apple.x = getRandomInt(0, 25) * grid; apple.y = getRandomInt(0, 25) * grid; } } }); } // listen to keyboard events to move the snake document.addEventListener('keydown', function(e) { // prevent snake from backtracking on itself by checking that it's // not already moving on the same axis (pressing left while moving // left won't do anything, and pressing right while moving left // shouldn't let you collide with your own body) // left arrow key if (e.which === 37 && snake.dx === 0) { snake.dx = -grid; snake.dy = 0; } // up arrow key else if (e.which === 38 && snake.dy === 0) { snake.dy = -grid; snake.dx = 0; } // right arrow key else if (e.which === 39 && snake.dx === 0) { snake.dx = grid; snake.dy = 0; } // down arrow key else if (e.which === 40 && snake.dy === 0) { snake.dy = grid; snake.dx = 0; } }); // start the game requestAnimationFrame(loop); </script> </body> </html>
  4. Salut
  5. //se citesc datele intr un vector . Sa se tipareasca sortat vectorul... #include <iostream> using namespace std; void citesc(int vt[10], int n) { int i; for(i=1; i<=n; i++) {cout<<"v["<<i<<"]= "; cin>>vt[i];} } void sortez(int vt[10], int n) { int i,gasit,aux; do { gasit=0; for(i=1; i<=n-1; i++) if (vt[i]>vt[i+1]) { aux=vt[i];vt[i]=vt[i+1];vt[i+1]=aux; gasit=1; } }while(gasit); // {cout<<"v["<<i<<"]= "; cin>>vt[i];} } void scriu(int vt[10], int n) { int i; for(i=1; i<=n; i++) cout<<vt[i]<<endl; } int main(void) { int n, v[30]; cout<<"Dati dimensiunile vectorului \n"; cout<<"n = ";cin>>n; citesc (v,n); sortez(v,n); scriu(v,n); }
  6. Gun Fight HTML Game: Script: <!DOCTYPE html> <html> <head> <title></title> <style> html, body { height: 100%; margin: 0; } body { background: black; display: flex; align-items: center; justify-content: center; } </style> </head> <body> <canvas width="565" height="500" id="game"></canvas> <script> const canvas = document.getElementById('game'); const context = canvas.getContext('2d'); const grid = 15; const playerHeight = grid * 3; // 45 const maxPlayerY = canvas.height - grid - playerHeight; var playerSpeed = 4; const leftPlayer = { // start in the middle of the game on the left side x: grid * 2, y: canvas.height / 2 - playerHeight / 2, width: grid, height: playerHeight, // shooting cooldown cooldown: 0, // player velocity dy: 0 }; const rightPlayer = { // start in the middle of the game on the right side x: canvas.width - grid * 3, y: canvas.height / 2 - playerHeight / 2, width: grid, height: playerHeight, // shooting cooldown cooldown: 0, // player velocity dy: 0 }; const bullets = { speed: 5, array: [] } // check for collision between two objects using axis-aligned bounding box (AABB) // @see https://developer.mozilla.org/en-US/docs/Games/Techniques/2D_collision_detection function collides(obj1, obj2) { return obj1.x < obj2.x + obj2.width && obj1.x + obj1.width > obj2.x && obj1.y < obj2.y + obj2.height && obj1.y + obj1.height > obj2.y; } // game loop function loop() { requestAnimationFrame(loop); context.clearRect(0,0,canvas.width,canvas.height); // bullet cooldowns // left player if (leftPlayer.cooldown > 0) { leftPlayer.cooldown--; } // right player if (rightPlayer.cooldown > 0) { rightPlayer.cooldown--; } // move players by their velocity leftPlayer.y += leftPlayer.dy; rightPlayer.y += rightPlayer.dy; // prevent players from going through walls if (leftPlayer.y < grid) { leftPlayer.y = grid; } else if (leftPlayer.y > maxPlayerY) { leftPlayer.y = maxPlayerY; } if (rightPlayer.y < grid) { rightPlayer.y = grid; } else if (rightPlayer.y > maxPlayerY) { rightPlayer.y = maxPlayerY; } // draw bullets context.fillStyle = 'yellow'; bullets.array.forEach(function(bullet, index) { context.fillRect(bullet.x, bullet.y, 10, 5); // check if the bullet hits a player // left player if (collides(bullet, leftPlayer)) { bullets.array.splice(index, 1); leftPlayer.y = canvas.height / 2 - playerHeight / 2; rightPlayer.y = canvas.height / 2 - playerHeight / 2; bullets.array.length = 0; } // right player else if (collides(bullet, rightPlayer)) { bullets.array.splice(index, 1); leftPlayer.y = canvas.height / 2 - playerHeight / 2; rightPlayer.y = canvas.height / 2 - playerHeight / 2; bullets.array.length = 0; } // move bullets bullet.x += bullet.dx; // remove bullets that leave the screen if (bullet.x < 0 || bullet.x > canvas.width) { bullets.array.splice(index, 1); } }); // draw paddles context.fillStyle = 'gold'; context.fillRect(leftPlayer.x, leftPlayer.y, leftPlayer.width, leftPlayer.height); context.fillRect(rightPlayer.x, rightPlayer.y, rightPlayer.width, rightPlayer.height); // draw walls context.fillStyle = 'lightgray'; context.fillRect(0, 0, canvas.width, grid); context.fillRect(0, canvas.height - grid, canvas.width, canvas.height); } // listen to keyboard events to move the players document.addEventListener('keydown', function(e) { // up arrow key if (e.which === 38) { rightPlayer.dy = -playerSpeed; } // down arrow key else if (e.which === 40) { rightPlayer.dy = playerSpeed; } // w key if (e.which === 87) { leftPlayer.dy = -playerSpeed; } // a key else if (e.which === 83) { leftPlayer.dy = playerSpeed; } // shooting // left arrow key if (e.which === 37 && rightPlayer.cooldown === 0) { bullets.array.push({ x: rightPlayer.x - 10, y: rightPlayer.y + 20, width: 10, height: 5, dx: -bullets.speed }); rightPlayer.cooldown = 25; } // d key if (e.which === 68 && leftPlayer.cooldown === 0) { bullets.array.push({ x: leftPlayer.x + 15, y: leftPlayer.y + 20, width: 10, height: 5, dx: bullets.speed }); leftPlayer.cooldown = 25; } }); // listen to keyboard events to stop the player if key is released document.addEventListener('keyup', function(e) { if (e.which === 38 || e.which === 40) { rightPlayer.dy = 0; } if (e.which === 83 || e.which === 87) { leftPlayer.dy = 0; } }); // start the game requestAnimationFrame(loop); </script> </body> </html> sursa:github.com
  7. PHP - MySQL Login Acest tutorial demonstrează cum se creează o pagină de conectare cu baza de date MySQL. Înainte de a intra în cod, ar fi nevoie de privilegii speciale pentru a crea sau pentru a șterge o bază de date MySQL. Config.php Fișierul Config.php are informații despre configurația bazei de date MySQL. <?php define('DB_SERVER', 'localhost:3036'); define('DB_USERNAME', 'root'); define('DB_PASSWORD', 'rootpassword'); define('DB_DATABASE', 'database'); $db = mysqli_connect(DB_SERVER,DB_USERNAME,DB_PASSWORD,DB_DATABASE); ?> Login.php Fisierul Login.php conține informații despre scriptul php și scriptul HTML pentru a vă autentifica. ?php include("config.php"); session_start(); if($_SERVER["REQUEST_METHOD"] == "POST") { // username and password sent from form $myusername = mysqli_real_escape_string($db,$_POST['username']); $mypassword = mysqli_real_escape_string($db,$_POST['password']); $sql = "SELECT id FROM admin WHERE username = '$myusername' and passcode = '$mypassword'"; $result = mysqli_query($db,$sql); $row = mysqli_fetch_array($result,MYSQLI_ASSOC); $active = $row['active']; $count = mysqli_num_rows($result); // If result matched $myusername and $mypassword, table row must be 1 row if($count == 1) { session_register("myusername"); $_SESSION['login_user'] = $myusername; header("location: welcome.php"); }else { $error = "Your Login Name or Password is invalid"; } } ?> <html> <head> <title>Login Page</title> <style type = "text/css"> body { font-family:Arial, Helvetica, sans-serif; font-size:14px; } label { font-weight:bold; width:100px; font-size:14px; } .box { border:#666666 solid 1px; } </style> </head> <body bgcolor = "#FFFFFF"> <div align = "center"> <div style = "width:300px; border: solid 1px #333333; " align = "left"> <div style = "background-color:#333333; color:#FFFFFF; padding:3px;"><b>Login</b></div> <div style = "margin:30px"> <form action = "" method = "post"> <label>UserName :</label><input type = "text" name = "username" class = "box"/><br /><br /> <label>Password :</label><input type = "password" name = "password" class = "box" /><br/><br /> <input type = "submit" value = " Submit "/><br /> </form> <div style = "font-size:11px; color:#cc0000; margin-top:10px"><?php echo $error; ?></div> </div> </div> </div> </body> </html> După conectarea reușită, va afișa pagina de bun venit. (welcome.php) <?php include('session.php'); ?> <html"> <head> <title>Welcome </title> </head> <body> <h1>Welcome <?php echo $login_session; ?></h1> <h2><a href = "logout.php">Sign Out</a></h2> </body> </html> Logoutpage.php Pagina de deconectare conține informații despre modul de deconectare din sesiune <?php session_start(); if(session_destroy()) { header("Location: login.php"); } ?> Session.php va verifica sesiunea, dacă nu există sesiune, se va redirecționa către pagina de conectare. <?php include('config.php'); session_start(); $user_check = $_SESSION['login_user']; $ses_sql = mysqli_query($db,"select username from admin where username = '$user_check' "); $row = mysqli_fetch_array($ses_sql,MYSQLI_ASSOC); $login_session = $row['username']; if(!isset($_SESSION['login_user'])){ header("location:login.php"); die(); } ?> Sursa:tutorialspoint.com
  8. //(metoda bulelor) Se parcurge vectorul atât timp cât mai există o pereche (a,a[i+1]) cu a > a[i+1] (adică o pereche de numere astfel încât primul să fie mai mare ca cel de-al doilea). #include<iostream> using namespace std; int a[100],n,i; void bubble_sort(int a[100], int n) // a - tabloul de numere intregi care se va ordona crescator // n - numarul de elemente al tabloului { int i,aux,inv; // variabila inv este 0 atunci cand s-a facut o interschimbare do{ inv=1; for(i=1; i<=n-1; i++) if( a[i] > a[i+1] ) { aux = a[i]; a[i] = a[i+1]; a[i+1] = aux; inv = 0; } }while( !inv ); return; } int main(void) { cout<<"Dati dimensiunea vectorului n = "; cin>>n; cout<<"Dati elementele vectorului \n"; for(i=1; i<=n; i++) { cout<<"a["<<i<<"]= "; cin>>a[i]; } bubble_sort(a,n); cout<<"Tabloul ordonat crescator \n"; for(i=1; i<=n; i++) cout<<a[i]<<" "; }
×
×
  • Create New...

Important Information