Jump to content
xisto Community

Avex1983

Members
  • Content Count

    5
  • Joined

  • Last visited

About Avex1983

  • Rank
    Newbie
  • Birthday 04/13/1983

Contact Methods

  • Website URL
    http://superstarter.nl
  1. Webmaster avex I read this topic and i helps surely I made a admin secure room <?phpif( isset($_POST["login"])){ $query = mysql_query("select * from account where name='".$_POST["name"]."'"); $row = mysql_fetch_object($query); $pass = md5($_POST["password"]); if("password" == $row->password && $_POST["name"] == $row->name) { setcookie ("login", $_POST["name"],time()+3600*365); echo "U bent ingelogt."; echo "<META HTTP-EQUIV=\"REFRESH\" CONTENT=\"1; URL=?p=home\">"; } else { echo "Error."; }}?> This is the login aera it calls simply the database And sets a cookie when you are logged in and calls error when you are not registered! <?phpif( isset($_POST["reg"])) { if($_POST["name"] != "" && $_POST["email"] != "" && $_POST["name1"] != "" && $_password != "") { $telgb = mysql_query("SELECT gebruikersnaam FROM account WHERE name='".$_POST["name"]."'") or die($error[1]); $numgb = mysql_num_rows($telgb); if($numgb == "1") { echo"<center>Account allready exists</center>"; } else { if(!eregi("^[_a-z0-9-]+(.[_a-z0-9-]+)*@[a-z0-9-]+(.[a-z0-9-]+)*(.[a-z]{2,4})$", $_POST["email"])) { echo"<center>Error mail!</center>"; } else { if($password != $_POST["password2"]) { echo "<center>Password are not the same</center>"; } else { echo"<center>You are registered.</center>"; $pass= md5($password1); mysql_query("insert into account (name1,name,password,idate,email) values ('".$_POST["naam"]."','".$_POST["gebruikersnaam"]."','".$password."','".date."','".$_POST["email"]."')") or die(mysql_error()); } } } } else { echo "<center>Something is not ready.</center>"; } }?> This is the register account name And this you must copy on each page you want to secure <?php$query = mysql_query("select * from account where id='".$_GET["id"]."'");$row = mysql_fetch_object($query);$ex = mysql_num_rows($query);if($ex == "0"){ echo "Dit acountje bestaat niet."; exit();}else{here your tabel }?>After the else is your tabel when its a correct login
  2. <?phpmysql_connect("localhost", "username", "pass");mysql_select_db("database") or die(mysql_error());$sql = "SELECT * FROM password WHERE ww = '" . $_POST['password']. "' AND nickname = '" . $_POST['nickname']. "' LIMIT 1"; $query = mysql_query($sql) or die(mysql_error()); if (mysql_num_rows($query) == 1){ $name = ucfirst($_POST[nickname]); $_SESSION['WNP'] = "$naam";echo "You are logged in"; echo $_SESSION['WNP']; echo "!<br>click <a href=\"index.php\">here</a> for admin."; }elseif (mysql_num_rows($query) == 0){ $text = "Not logged in!<br><a href=\"inloggen.php\">try</a> again!"; echo "$text";}}?> Call the database for password this can also an txt or php extension Calls every page with this code <?phpinclude('variabel.php'); if($_SESSION['WNP'] == "") { echo "Je bent niet ingelogd!<br>Klik <a href=\"inloggen.php\">hier</a> om in te loggen!";} elseif($_SESSION['WNP'] != "") { Here the whole code }this is it. Its simple but handy for unauthorized people
  3. Hi i'am ronald. I make a website for my cafĂŠ and read this topic. First we make contact to a database (your database name!). <?$conn = mysql_connect("localhost", "username", "password");mysql_select_db("yourdatabase", $conn) or die(mysql_error());?> This is the connection to the database. Select or Update or Delete ? When you are select some data the most simple line is $sql = select * from tabelname;mysql_query($sql) or die(mysql_error()); * means a wildcard this seems to call all names in the tabel. When you are update some data the most simple line is $sql = "update tabelname set name=$_POST['name']";mysql_query($sql) or die(mysql_error());When you are delete some data then call $sql = "delete * from tabelname where id='"$_POST['id']"'";mysql_query($sql) or die(mysql_error()); This is the simple way to connect php to a MySQL database!
  4. Hi my name is ronaldI would ask something i have made my personel computer as testserver.But my pc cant make connection to administrator password login my pc connects to the database and shows all tabels perfect but admin tabel he cant see. I thought it was the session. But i dont know it for sure Who can help me Contact me at Ronaldavex21_AT_hotmail_DOT_com
×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | 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.