Jump to content

joeysarsenal

Members
  • Posts

    91
  • Joined

  • Last visited

    Never

Everything posted by joeysarsenal

  1. yer i didnt think that "delimiter" was imported so i took it out it was the first time ive ever used something like this. Thanks for all the help guys.
  2. ty i let you know how i go at home. Thanks again.
  3. thats the example they had at that site. With other information to open and overwrite. But i think this one is more revelant " $myFile = "testFile.txt"; $fh = fopen($myFile, 'w') or die("can't open file"); $stringData = "Bobby Bopper\n"; fwrite($fh, $stringData); $stringData = "Tracy Tanner\n"; fwrite($fh, $stringData); fclose($fh);" <?php $ip = $_SERVER['REMOTE_ADDR'];//variable ? $date = date("Y-m-d"); //variable ? $myFile = "log.txt"; $fh = fopen($myFile, 'w') or die("can't open file"); $stringData = $ip"; fwrite($fh, $stringData); $stringData = "$date"; fwrite($fh, $stringData); fclose($fh);" ?> cant really test it here. No Xampp on these comps.
  4. Thanks for the quick reply, ill have a play around with it now and let you know how go.
  5. ey guys, just adding finishing touches to my website, was wondering if there is a way to write to a log, when a user enters the website. So it writes to log with ip-address and date. thanks in advanced
  6. ok ive encrypted all my passwords in md5 how can i grab the password unencrypted so i can edit it.
  7. best way to redirect is threw headers i found. if($result) { if(mysql_num_rows($result)>0) { //Login Successful session_regenerate_id(); $member=mysql_fetch_assoc($result); $_SESSION['SESS_MEMBER_ID']=$member['member_id']; session_write_close(); header("location: ../Loginsucces.htm"); exit(); }else { //Login failed header("location: ../loginfailed.htm"); exit(); }
  8. one more question.. When i use the code i was given previously. it runs fine. But doesnt give me a form to enter my details, and doesnt know what username to edit. I know i can use sessions to edit, but is it really needed.
  9. ill have a play around with it it ill let u know how i go u guys have been very helpfull ty
  10. yes i want logged in users to edit there details via a button "edit details" yes used sessions, although its not the best code in the world. Below is my login code. <?php //Start session session_start(); //Connect to mysql server $link=mysql_connect("localhost","root",""); if(!$link) { die('Failed to connect to server: ' . mysql_error()); } //Select database $db=mysql_select_db("plaincart"); if(!$db) { die("Unable to select database"); } //Sanitize the value received from login field //to prevent SQL Injection if(!get_magic_quotes_gpc()) { $login=mysql_real_escape_string($_POST['login']); }else { $login=$_POST['login']; } //Create query $qry="SELECT member_id FROM members WHERE login='$login' AND passwd='".md5($_POST['password'])."'"; $result=mysql_query($qry); //Check whether the query was successful or not //Check for a certain username if($result) { if(mysql_num_rows($result)>0) { //Login Successful session_regenerate_id(); $member=mysql_fetch_assoc($result); $_SESSION['SESS_MEMBER_ID']=$member['member_id']; session_write_close(); header("location: ../Loginsucces.htm"); exit(); }else { //Login failed header("location: ../loginfailed.htm"); exit(); } }else { die("Query failed"); } ?>
  11. k that resolved that problem. I have another one. How to i link this code to a form, because when i run it it justs gives me this. No rows found! ERROR: Enter User Password
  12. Error in query: SELECT * login, passwd, firsname, lastname, address, city, email, postcode FROM members where login = 'login. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'login, passwd, firsname, lastname, address, city, email, postcode FROM members w' at line 1 i seem to be getting that error, i had to change a couple things but yer it didnt like the query. <HTML> <HEAD> <TITLE>Users Personal Information</TITLE> </HEAD> <BODY> <?PHP $server = "localhost"; $user = "root"; $pass = ""; $db = "plaincart"; // open connection $connection = mysql_connect($server, $user, $pass) or die ("Unable to connect!"); // select database mysql_select_db($db) or die ("Unable to select database!"); // create query $query = "SELECT login, passwd, firsname, lastname, address, city, email, postcode FROM members where login = 'login"; // execute query $result = mysql_query($query) or die ("Error in query: $query. ".mysql_error());
  13. thanks for the help uve been very helpfull. Ill give it a shot and let u know how i go
  14. Thank you so much. <form action="useredit1.php" method="post"> What would go within useredit1.php
  15. hmm what i mean is that. Ok say u logged in how can i write a code to edit personal information and password. Because at the moment all i have is that u click edit user. Then it supplys all the member_ids which gives the person using the editing tool to much power.
  16. Hello Everyone, im not to sure how to go about explaining this but ill try. I have a login script. Is it possible that once the user has logged in to automatically choose his // her id and POST the information up on the screen because at the moment all i have is a drop down box displaying all the user id, which i dont want to give users that much power. Thanks in advanced people. Let me know if you need to see some script. Just wanted to know if its possible and how to go about doing so.
  17. sure script is below <?php //Start session session_start(); //Connect to mysql server $link=mysql_connect("localhost","root",""); if(!$link) { die('Failed to connect to server: ' . mysql_error()); } //Select database $db=mysql_select_db("plaincart"); if(!$db) { die("Unable to select database"); } //Sanitize the value received from login field //to prevent SQL Injection if(!get_magic_quotes_gpc()) { $login=mysql_real_escape_string($_POST['login']); }else { $login=$_POST['login']; } //Create query $qry="SELECT member_id FROM Emps WHERE login='$login' AND passwd='".md5($_POST['password'])."'"; $result=mysql_query($qry); //Check whether the query was successful or not if($result) { if(mysql_num_rows($result)>0) { //Login Successful session_regenerate_id(); $member=mysql_fetch_assoc($result); $_SESSION['SESS_MEMBER_ID']=$member['member_id']; session_write_close(); header("location: member-index.php"); exit(); }else { //Login failed header("location: login-failed.php"); exit(); } }else { die("Query failed"); } ?>
  18. well u could just use md5 if u really wanted , i used md5 to encript my passwords for the login script my site used
  19. yer the data is in a database table and im using a form to get to that page but at that page i want it to rederect after a minute or so.
  20. i want my page to redirect to another page after a successfull login. Just not sure what command to use. below is the code im working with <?php require_once('auth.php'); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Member Index</title> <link href="loginmodule.css" rel="stylesheet" type="text/css" /> </head> <body> <h1>Welcome to Members' area!</h1> <a href="member-profile.php">My Profile</a> | <a href="logout.php">Logout</a> | <a href="http://localhost/Finalised/Loginsucces1.htm">Contiue with Priviladges</a> <p>This is a password protected area only accessible to members. </p> </body> </html>
  21. lol neon i know its not urs but u helped give me the code. Thanks thats what i wanted. Uve been really helpful i just thought if it would be possible to do something like this like it automatically checks the field were "passwd" is in my table and automatically encripts it. If i do it how i was before i have to encript every password and i don't know who's going to use what if there isnt a way ill just have to stick to this.
  22. well if i use the code he gave me i can only encript 1 password i want to encript a couple more.
  23. ok ive used neons md5 code. is there a way i can name mulitple variables for different passwords? <?php /* Populate The Staff Table ** Use an Include file to open the database */ include( "connect.inc" ); $sql = "DELETE FROM members"; //drop all data , then insert mysql_query($sql ); $pass = "password"; (Want more Variables here) $passwd = md5($pass); (Need to name alot more passwords). $sql = "INSERT INTO members VALUES " . "(NULL,'Joe','m','lebo_joe@hotmail.com','melb','69 fook street city','4444','joe','$passwd'), " . "(NULL,'Joe1','m1','lebo_joe@hotmai1l.com','melb1','691 fook street city','4441','joe1','joe1')"; if(mysql_query($sql)){ echo("<p>client table successfully populated!</p>"); } else{ print("<p>Error adding to client table: " . mysql_error() . "</p>"); } ?>
  24. wouldnt i have to set another variable for the username or password for instance like <?php $myuser = "password" $password = "Select From Members where password = $password" (Just taking a punt here) $myencrypteduser = md5($myuser); ///while you echo ///you will get this da64a1bc2c9a53dd1cdb6846103cd2de ?> Not sure if thats right but is there a way that it would grab the password field from the table.
×
×
  • Create New...

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.