Jump to content

heirani1

Members
  • Posts

    14
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

heirani1's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. thanks abdbuet it works now if i was to create more pages for a user so links from profile.php for each unique user would i do the same thing? or slighty different? thanks again youve been a great help
  2. by putting profile.php?username=$_SESSION['name'] as the form action brings up a blank page, am i going in the right direction or not?
  3. // print login form and exit if failed. if($num > 0){ header("Location : profile.php?username=$_SESSION['name']"); exit(); }else{ line 20 is blank
  4. i tried this code and im getting a error saying .. any ideas what this is? thanks
  5. o rite thats quite clever, i'm just trying to work out where to but this line of code.. header("Location : profile.php?username=whateverusernametheyentered"); sorry seems abit stupid but its confusing me. login page ... <?php // Login // auth.php // start session session_start(); // convert username and password from _POST or _SESSION if($_POST){ $_SESSION['name']=$_POST["name"]; $_SESSION['password']=$_POST["password"]; } // query for a user/pass match $result=mysql_query("select * from registered_members where name='" . $_SESSION['name'] . "' and password='" . $_SESSION['password'] . "'"); // retrieve number of rows resulted $num=mysql_num_rows($result); // print login form and exit if failed. if($num < 1){ ?> <!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=utf-8" /> <title>Untitled Document</title> <link rel="stylesheet" type="text/css" href="test.css" /> </head> <body> <div align="center">Please login...<br> <br> </div> <form method=POST action=index.php> <div align="center">username: <input type=text name="name"> password: <input type=password name="password"> <input type=submit value="Login"> </div> </form> <br /> <div align="center"><a href="signup.php">Not Registered? Register now!</a> </div> </body> <?php exit; } ?> </div>
  6. ok thanks abdbuet, the code you showed, what would that be best for?
  7. basically i want is when the user logs on to bring up a page the same as all the other users but the content to be different so when dave logs in it says welcome dave and then lists the stuff hes interested in for example, then when chris logs in welcome chris etc, which code would be best for that? and how would i implement it into my code?
  8. thanks waynewex that sort of makes things a little clearer, using that code will create a different page for each user since your calling the username etc from the users database. Any chance you could implement your code into my login page so i can understand it better? heres the code .. <?php // Login // auth.php // start session session_start(); // convert username and password from _POST or _SESSION if($_POST){ $_SESSION['name']=$_POST["name"]; $_SESSION['password']=$_POST["password"]; } // query for a user/pass match $result=mysql_query("select * from registered_members where name='" . $_SESSION['name'] . "' and password='" . $_SESSION['password'] . "'"); // retrieve number of rows resulted $num=mysql_num_rows($result); // print login form and exit if failed. if($num < 1){ ?> <!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=utf-8" /> <title>Untitled Document</title> <link rel="stylesheet" type="text/css" href="test.css" /> </head> <body> <div align="center">Please login...<br> <br> </div> <form method=POST action=index.php> <div align="center">username: <input type=text name="name"> password: <input type=password name="password"> <input type=submit value="Login"> </div> </form> <br /> <div align="center"><a href="signup.php">Not Registered? Register now!</a> </div> </body> <?php exit; } ?> </div>
  9. i created a login page and register page which people can login to, once they logged in they can upload files and stuff like that. what i want to do now is once the user has logged in to take them to there own page within my site. So basically every member gets there own page. how would i go about doing this becuase i don't have a clue. thanks for any suggestions...
  10. im new to php so please bare with me, im working on this sign up script and a message is echoed in the php, i want to echo the message in the html so i can move and position the text easier. hope you can help, heres the code ... <?php include('config.php'); // table name $tbl_name=temp_members_db; // Random confirmation code $confirm_code=md5(uniqid(rand())); // values sent from form $name=$_POST['name']; $email=$_POST['email']; $password=$_POST['password']; $country=$_POST['country']; // Insert data into database $sql="INSERT INTO $tbl_name(confirm_code, name, email, password, country)VALUES('$confirm_code', '$name', '$email', '$password', '$country')"; $result=mysql_query($sql); // if suceesfully inserted data into database, send confirmation link to email if($result){ // ---------------- SEND MAIL FORM ---------------- // send e-mail to ... $to=$email; // Your subject $subject="Your confirmation link here"; // From $header="from: heirani@blueyonder.co.uk"; // Your message $message="Your Comfirmation link \r\n"; $message.="Click on this link to activate your account \r\n"; $message.="http://localhost/Test/log/confirmation.php?passkey=$confirm_code"; // send email $sentmail = mail($to,$subject,$message,$header); } // if not found else { echo "Not found your email in our database"; } // if your email succesfully sent if($sentmail){ echo "Your Confirmation link Has Been Sent To Your Email Address.<br> You will now be directed back to the login page. <META HTTP-EQUIV=\"refresh\" content=\"2; URL=index.php\">"; } else { echo "Cannot send Confirmation link to your e-mail address"; } ?>
  11. thanks mathew that worked, sorry if it was a simple question i am trying to teach myself php and i just didnt have a clue, thanks again
  12. i got a php form but i want to implement it into the html, that way i can position it and edit the page a lot easier, heres the code, hope you understand what i mean. <?php // start session session_start(); // convert username and password from _POST or _SESSION if($_POST){ $_SESSION['name']=$_POST["name"]; $_SESSION['password']=$_POST["password"]; } // query for a user/pass match $result=mysql_query("select * from registered_members where name='" . $_SESSION['name'] . "' and password='" . $_SESSION['password'] . "'"); // retrieve number of rows resulted $num=mysql_num_rows($result); // print login form and exit if failed. if($num < 1){ echo "Please login...<br><br> <form method=POST action=index.php> username: <input type=text name=\"name\"> password: <input type=password name=\"password\"> <input type=submit value=\"Login\"> </form>"; exit; } ?>
  13. thanks, i didnt realise that, thanks again for your help!
  14. ive been trying to teach myself php by tutorials and stuff and i am trying to create a script where they register and then a conformation link is sent to their email, when they click the link they then become a member. i have a problem though ... heres the code for the page .. <? include('config.php'); // table name $tbl_name=temp_members_db; // Random confirmation code $confirm_code=md5(uniqid(rand())); // values sent from form $name=$_POST['name']; $email=$_POST['email']; $country=$_POST['country']; // Insert data into database $sql="INSERT INTO $tbl_name(confirm_code, name, email, password, country)VALUES('$confirm_code', '$name', '$email', '$password', '$country')"; $result=mysql_query($sql); // if suceesfully inserted data into database, send confirmation link to email if($result){ // ---------------- SEND MAIL FORM ---------------- // send e-mail to ... $to=$email; // Your subject $subject="Your confirmation link here"; // From $header="from: your name <your email>"; // Your message $message="Your Comfirmation link \r\n"; $message.="Click on this link to activate your account \r\n"; $message.="http://localhost/Test/sign_up/confirmation.php?passkey=$confirm_code"; // send email $sentmail = mail($to,$subject,$message,$header); } // if not found else { echo "Not found your email in our database"; } // if your email succesfully sent if($sentmail){ echo "Your Confirmation link Has Been Sent To Your Email Address."; } else { echo "Cannot send Confirmation link to your e-mail address"; } ?> when the form goes to this page it just prints some of the code to the screen, which is ... Any help in resolving this would be much appreciated, Chris
×
×
  • 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.