Jump to content

joeysarsenal

Members
  • Posts

    91
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

joeysarsenal's Achievements

Member

Member (2/5)

0

Reputation

  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.
×
×
  • 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.