Jump to content

ChompGator

Members
  • Posts

    171
  • Joined

  • Last visited

    Never

Everything posted by ChompGator

  1. Im trying to set up a certain type of login - which Ive never done before - When - Employee's login - they see "Certain links" When Managers Login - they see the links the employee's see, plus additional "managers links" When Vice-Presidents Login - they see all the links employee's see, managers see, and additional "vp links" So what I did was set up a login, with 3 levels of access, when a user puts their username then password in - they then select from a drop down menu if they are level 1 access, level 2 access, or level 3 access. Then they hit submit, the information gets verified in a database(username, password, access level) ... Problem is, as I know how to direct the login to whatever page is applicable for their access level, but I dont understand how I can I guess start the session? so that each user if they want can set up their profile, or whatever. So basically like all employees would see the same links, but in a sense they wouldn't be the same links because each user can customize his/her own area. Anyone have any good advice or know of any tutorials for doing this sort of thing?
  2. Fantastic, this concludes my part 1, I will let you guys know of any progress, or problems I have, Im going to try and have it working tonight, my part two, has to do with sessions and access levels, - But that will come later! Thanks again!
  3. Hmm, Ill review it - Do you think it might be easier to use Captcha Validation instead? Not that this can't work, its just this looks pretty complex, and Im not that well versed in php, I mean Im not a BAD php programmer, but I would not say that Im overly experienced either you know, I know a good amount about it, but when looking at this, it looks like it can get severly complex, is that right?
  4. Hello, A while back I posted a topic about how to create a validation link off a join form. The script I recieved - was useful, but not versatile enough. So I was hoping for some more help, and this time Ill be more specific, but I want to do this in two parts so I can make sure I understand how to do it. Part 1 is as follows: Say, I have a join form - and when you submit the join form, I already have a handle.php (a script to handle the form) made, and I already have it - so that the values from the form get inserted into a database. But there are a few things I cant master, so the form works. The trouble is, I want a validation link - sent to the user's email address they provided, but once they click the validation link - I want them to automatically get another email from our server with their ID Number (which should be automatically assigned) and their password (which they will provide on the join form) so they can login to the site. Now, more or less, I need to know a script that will not only send a validation link on submission, but also how to get it so when they click the link - they get sent their ID, and Password. Anyone have any scripts that do this, or know where I could get a good tutorial on how to do this?
  5. Ok, before I add my big form, Im just trying to do a test form just with 3 simple fields, "username" "password" "email" So below is new.htm and then the php document that is supposed to handle the form is new.htm, the name of the php document is "email.php Im submitting the form and its just taking me to a page cannot be displayed - I do have a dbconnect.php (that is stated at the start of the php document.) - What do you see wrong with this code that I can fix? new.htm <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> </head> <body> <form name="input" action="email.php" method="post"> Username: <input type="text" name="user"><br /> Password: <input type="text" name="user0"><br /> Email <input type="text" name="user1"><br /> <br /> <input type="submit" value="Submit"> </form> </body> </html> email.php <?php session_start(); include 'dbconnect.php'; if($_POST['Submit']) { $myusername=$_POST['myusername']; $mypassword=$_POST['mypassword']; $sql="SELECT * FROM join WHERE username='$myusername' and password='$mypassword'"; $result=mysql_query($sql); // Mysql_num_row is counting table row $count=mysql_num_rows($result); // If result matched $myusername and $mypassword, table row must be 1 row if($count==1){ // Register $myusername, $mypassword and redirect to file "login_success.php" session_register("myusername"); session_register("mypassword"); header("location:ad_setup.php"); } else { echo "<div id='error_setup'>The account information does not exist, Try again!</div>"; } ob_end_flush(); } if($_POST['create']) { if($_POST['password1'] == $_POST['password2']) { $checksql = "SELECT * FROM join WHERE username = '" . $_POST['username'] . "';"; $checkresult = mysql_query($checksql); $checknumrows = mysql_num_rows($checkresult); } else { for($i = 0; $i < 16; $i++) { $randomstring .= chr(mt_rand(32,126)); } $verifyurl = "http://www.jetbluevirtual.net/join/verify.php"; $verifystring = urlencode($randomstring); $verifyemail = urlencode($_POST['email']); $validusername = $_POST['username']; $sql = "INSERT INTO join(username, password, email, verifystring, active) VALUES('" . $_POST['username'] . "', '" . $_POST['password1'] . "', '" . $_POST['email'] . "', '" . addslashes($randomstring) . "', 0);"; mysql_query($sql); $mail_body=<<<_MAIL_ Hi $validusername, Welcome To JBU Please click on the following link to verify your new account: $verifyurl?email=$verifyemail&verify=$verifystring _MAIL_; mail($_POST['email'], "JBU", $mail_body); echo "A link has been emailed to the address you entered. Please see the email - to activate your account"; } } else { switch($_GET['error']) { case "pass": echo "<div id='error_setup'>Passwords do not match!</div>"; break; case "taken": echo "<div id='error_setup'>Username taken, please use another.</div>"; break; case "no": echo "<div id='error_setup'>Incorrect login details!</div>"; break; } } ?>
  6. Question about the validation script again, Im testing it out on my server now and Im getting an error saying "PHP Has Encountered a Stack Over-Flow" What does this mean? And what are some suggestions to fix it, Ill also look up and asses the problem, - thanks,
  7. One thing, I noticed you have a header pointing to a url location, - what do you have stored there, I should be able to remove that huh? Anyway let me know
  8. Thankyou Muchly, Ill give it a shot - thanks!!
  9. Boy do I have lots of PHP Questions today, Im only posting one at a time though so I have time to write my scripts and understand them. I was wondering if someone could help me out, or point me to a tutorial online, what I did was make a 'join this website' link, and Ive already made the form - and what I want to happen is when the user clicks the submit button, the server sends them an email with a link to validate their account once they click the link, they have been added to the "Master Member List" I already have the form, and the handleform.php (the script that handles the form.htm) entering their data into the database, but only once they click the validation link that is sent to them, they are added to the master list. Does anyone know a script for a validation link that I can add to my script? Thank
  10. Thank you for your input everyone, Ill give it a try to make sure it all works, thanks!
  11. Modified Post: I have included the script to my handle.php - which handles the information from the form Login Script: (This is the checklogin.php - the script that handles the information from the html form) - I added what you said to add <?php $host="mysql105.mysite4now.com"; // Host name $username="aiim"; // Mysql username $password="k7YuHeFv"; // Mysql password $db_name="login"; // Database name $tbl_name="staff"; // Table name // Connect to server and select databse. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $username=$_POST['username']; $password=$_POST['password']; $sql="SELECT * FROM $tbl_name WHERE username='$myusername' and password='$mypassword'"; $result=mysql_query($sql); // Mysql_num_row is counting table row $count=mysql_num_rows($result); // If result matched $myusername and $mypassword, table row must be 1 row If ($_SESSION[login] != 1) { #http://www.url-to-redirect-them-to-login.com } else { # display html for login }; if($count==1){ // Register $myusername, $mypassword and redirect to file "login_success.php" session_register("myusername"); session_register("mypassword"); header("location:login_success.php"); } else { echo "Wrong Username or Password"; } ?> I know there are some errors in this scripting, but could you perhaps mention some errors/what to take out/what to add, and Ill clean it up, I haven't done php in so many years its all slowly coming back to me lol Thanks,
  12. Hello, I used to program quite a bit, and I remember when I was younger and doing it I created a login script once, and every page past the members login page I had to add a little short one-or two line script on all the members page at the top of the page so that when someone tried to access any page passed the members login by just typing in the URL it would re-direct them and say "You are not logged in, please login first, before accessing this page" Any the issue Im having is for the life of me I cannot remember what the script was I used - I remember it was a short script, so Im wondering if anyone out there knows a script I can use to put on all the pages in my members area so that if someone trys to go to a particular url thats for a page in the members area, it will verify if they're logged in or not, and if they're not logged in, it will deny them access? (Login is already set up, just need a verification script as mentioned above) thanks,
  13. I used the code you posted above, and the same thing is still happening, its saying 1 Record Added, but its not actually adding any of the information from the form into the database.
  14. Nope, same thing, it says "1 Record AddeD" But the form information was not added to the table in the db.
  15. Hmm, let me try it give me a second here
  16. It is saying "1 Record Added" But nothing was added
  17. Hello, Im having a problem with a subscription script I made. Its a basic script, and the purpose of it is to allow a user to enter their email address, forename, surname, and select weather they are a business user or home user, then click "submit" and the information gets entered into the database/table I made for the script. Now the problem Im having is the script works, and it submits, the problem is if I go look in the database the script didn't actually insert any information into the database. Below I have included the html form, and the handle.php (the php script that handles the form information) I was hoping someone may be able to provide some insight/advice as to why its not inserting whats in the field values into the database. - Thanks HTML Script: <html> <body> FORM id=mailinglist name=mailinglist onsubmit="return emailOnly(this.emaillist.value,'emaillist');" action="handle.php" method=post <INPUT type=hidden value="Interactive Systems" name=thispage> <INPUT type=hidden value=Main name=thissection> <a title="AIIM Calgary Home Page" target="_self" href="http://www.aiimcalgary.org">Home</a> | <a href="http://calendar.aiimcalgary.org">Calendar</a> | Join The Calgary Chapter Mailing List: <INPUT class=small id=emaillist onkeydown="hideshow('mldetails','on');" onblur="return handleEmp(this,'Your Email');" onfocus="clearThis(this,'Your Email');hideshow('mldetails','on');" align=top size=24 value="Your email" name=emaillist> <INPUT class=submit id=join type=submit align=top value=Join name=join> <DIV class=off id=mldetails onmouseover="hideshow('mldetails','on');" onmouseout="hideshow('mldetails','off');"> <FIELDSET><LEGEND>Optional Details:</LEGEND><LABEL for=mlfname>Forename:</LABEL><INPUT class=small id=mlfname maxLength=50 name=mlfname><BR><LABEL for=mllname>Surname:</LABEL><INPUT class=small id=mllname maxLength=50 name=mllname><BR>[<A title="View AIIM' Privacy Policy: How we handle your personal information" href="javascript:openWin('/legal/privacy_policy.asp','privacy','795','550')">Privacy</A>] <SELECT class=small size=1 name=mltype> <OPTION value=business selected>I'm a Business User</OPTION> <OPTION value=home>I'm a Home User</OPTION><OPTION value=home>I'm a New User</OPTION></SELECT> </FIELDSET> </DIV></FORM> <SCRIPT type=text/javascript> //hide mailing list options on load hideshow('mldetails','off'); </SCRIPT> </body> </html PHP Script: <?php $con = mysql_connect("mysql105.mysite4now.com","aiim","k7YuHeFv"); if (!$con) { die('Could not connect: ' . mysql_error()); }mysql_select_db("login", $con);$sql="INSERT INTO subscribe (email, forename, surname, user) VALUES ('$_POST','$_POST[forename]','$_POST[surname]','user')";if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } echo "1 record added";mysql_close($con) ?>
×
×
  • 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.