![]() |
Chirurgia endoscopică a hipofizei
"Standardul de aur" în chirurgia hipofizară îl reprezintă endoscopia transnazală transsfenoidală. Echipa NeuroHope este antrenată în unul din cele mai mari centre de chirurgie a hipofizei din Europa, Spitalul Foch din Paris, centrul în care a fost introdus pentru prima dată endoscopul în chirurgia transnazală a hipofizei, de către neurochirurgul francez Guiot. Pe lângă tumorile cu origine hipofizară, prin tehnicile endoscopice transnazale pot fi abordate numeroase alte patologii neurochirurgicale. www.neurohope.ro |
ajutor php
Last Updated: Apr 29 2016 15:10, Started by
bunicu9
, Apr 28 2016 22:34
·
0

#1
Posted 28 April 2016 - 22:34

Buna seara!
Am gasit un script php simplu register/login Baza mea de date este -- -- Structura de tabel pentru tabelul `players` -- CREATE TABLE IF NOT EXISTS `players` ( `ID` int(11) NOT NULL AUTO_INCREMENT, `username` varchar(100) NOT NULL, `password` varchar(128) NOT NULL, `Email` varchar(150) DEFAULT NULL, `Level` int(11) NOT NULL DEFAULT '1', `AdminLevel` int(11) NOT NULL DEFAULT '0', `HelperLevel` int(11) NOT NULL DEFAULT '0', `Cash` int(24) NOT NULL DEFAULT '0', `Account` int(24) NOT NULL DEFAULT '0', `Registred` int(11) DEFAULT '0', `Tutorial` int(11) NOT NULL DEFAULT '0', `IP` varchar(46) DEFAULT NULL, `LastLogin` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`ID`), FULLTEXT KEY `password` (`password`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=16 ; Am facut sciptul sa ma pot loga cu contul din baza mea de date mysql Asa arata index.php <?php ?> <?php include("auth.php"); //include auth.php file on all secure pages ?> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Welcome Home</title> <link rel="stylesheet" href="css/style.css" /> </head> <body> <div class="form"> <p>Welcome <?php echo $_SESSION['username']; ?>!</p> <p>This is secure area.</p> <p><a href="dashboard.php">Dashboard</a></p> <a href="logout.php">Logout</a> </div> </body> </html> Cum pot afisa in index din baza mea de date "Cash si level" si valoarea lor |
#2
Posted 28 April 2016 - 23:44

Cu SQL. Select Cash from players where username like $_SESSION['username']
Rulezi query-ul respectiv, il salvezi intr-o variabila si ii dai echo. |
#3
Posted 28 April 2016 - 23:57

Am uitat sa mentionez ca nu prea ma pricep.
Deci ce trebuie sa fac? $query = "SELECT * FROM `players` WHERE Cash" like $_SESSION['username']; ?? |
#4
Posted 29 April 2016 - 08:01

$query = "SELECT Cash, Level FROM players WHERE username LIKE $_SESSION['username']";
|
#5
Posted 29 April 2016 - 09:56

La profile.php am pus
<?php session_start(); ?> <?php if(!isset($_SESSION['valid'])) { header('Location: login.php'); } ?> <?php //including the database connection file include_once("connection.php"); //fetching data in descending order (lastest entry first) //$result = mysql_query("SELECT * FROM players"); $result = mysql_query("SELECT * FROM players WHERE username='$user'") ?> <html> <head> <title>Homepage</title> </head> <body> <a href="index.php">Home</a> | <a href="add.html">Add New Data</a> | <a href="logout.php">Logout</a> <br/><br/> <table width='80%' border=0> <tr bgcolor='#CCCCCC'> <td>Name</td> <td>Level</td> <td>Admin Level</td> </tr> <?php while($res = mysql_fetch_array($result)) { echo "<tr>"; echo "<td>".$res['username']."</td>"; echo "<td>".$res['Level']."</td>"; echo "<td>".$res['AdminLevel']."</td>"; } ?> </table> </body> </html> Nu imi afiseaza nimic De ce? asa arata login-ul acum <?php session_start(); ?> <html> <head> <title>Login</title> </head> <body> <a href="index.php">Home</a> <br /> <?php include("connection.php"); if(isset($_POST['submit'])) { $user = mysql_real_escape_string($_POST['username']); $pass = mysql_real_escape_string($_POST['password']); if($user == "" || $pass == "") { echo "Either username or password field is empty."; echo "<br/>"; echo "<a href='login.php'>Go back</a>"; } else { $result = mysql_query("SELECT * FROM players WHERE username='$user' AND password=md5('$pass')",$conn) or die("Could not execute the select query."); $row = mysql_fetch_assoc($result); if(is_array($row) && !empty($row)) { $validuser = $row['username']; $_SESSION['valid'] = $validuser; $_SESSION['name'] = $row['name']; $_SESSION['id'] = $row['id']; } else { echo "Invalid username or password."; echo "<br/>"; echo "<a href='login.php'>Go back</a>"; } if(isset($_SESSION['valid'])) { header('Location: index.php'); } } } else { ?> <p><font size="+2">Login</font></p> <form name="form1" method="post" action=""> <table width="75%" border="0"> <tr> <td width="10%">Username</td> <td><input type="text" name="username"></td> </tr> <tr> <td>Password</td> <td><input type="password" name="password"></td> </tr> <tr> <td> </td> <td><input type="submit" name="submit" value="Submit"></td> </tr> </table> </form> <?php } ?> </body> </html> |
#6
Posted 29 April 2016 - 11:33

Daca tot faci "SELECT * " la login, de ce nu setezi direct 'level' si 'cash' in sesiune?
if(is_array($row) && !empty($row)) { $validuser = $row['username']; $_SESSION['valid'] = $validuser; $_SESSION['name'] = $row['name']; //nu am vazut in tabela players campul acesta, deci va fi NULL $_SESSION['id'] = $row['id']; $_SESSION['cash'] = $row['Cash']; $_SESSION['level'] = $row['Level']; $_SESSION['adminlevel'] = $row['AdminLevel']; } else { echo "Invalid username or password."; echo "<br/>"; echo "<a href='login.php'>Go back</a>"; } apoi, in pagina ai <table width='80%' border=0> <tr bgcolor='#CCCCCC'> <td>Name</td><td><?=$_SESSION['name']?></td> <td>Level</td><?=$_SESSION['level']?></td> <td>Admin Level</td><?=$_SESSION['adminlevel']?></td> </tr> <?php /* while($res = mysql_fetch_array($result)) { echo "<tr>"; echo "<td>".$res['username']."</td>"; echo "<td>".$res['Level']."</td>"; echo "<td>".$res['AdminLevel']."</td>"; } */ ?> </table> </body> Edited by robbie_ro, 29 April 2016 - 11:43. |
#8
Posted 29 April 2016 - 15:10

Cum pot face un text sa spuna cate conturi sunt in players ?
si un text care sa spuna cati jucatori au adminlevel <1? |
Anunturi
▶ 0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users