Jump to content

Pavlos1316

Members
  • Posts

    302
  • Joined

  • Last visited

Everything posted by Pavlos1316

  1. I think I will stick in php. There is nothing you can't do if you now the right words and philosophy. but for this script I don't even know what to serch for... e.g. for login form you search login.php. For this one???
  2. ...for me at least! Hi there. What I have: 1. I have - ready and working - my connection string to post in mysql db. - TESTED - Ok! What I want: 1. Let's say my form is like: b1 b2 b3 b4b5b6 b7b8b9 1.a. Columns are used as check boxes. 2. The problem: 2.a. User MUST check 4 columns only - one in each row + a 2nd one in one of the rows. 2.b. When they check the 4th one, other columns must not be able to be checked. 2.c. User must not be able to check 4 columns in only 2 rows. This may be the last step for my site but I have no idea how to do it!!! ??? I hope you can help. Thanks.
  3. Couldn't find the file specified...!! Now after I revewed changes my page is ok. But back from scratch my authendication file doesn't work Isn't out there a simple authentication file?
  4. i have changed members.html to php and another link. but nothing is working now. it says the file you requested may have been changed!!! ??? nothing!!!!!!
  5. I've been told it can't be done. So I have to rename EVERY protected page .php instead of .html WITH NO other change?
  6. not my server!!!! but with the last codes I posted if I make that change will it work?
  7. this sounds easyer if you tell me what to do cause the other way round screwed up everythiiiiiiiiing!!
  8. Do I have to rename frames too? top.html to top.php and all prodected pages?
  9. Still doesn't work for the rest protected pages. (I am stuck here 20 days now!!!) How do I fix that???? members.html: <?php session_start(); //members page if (!isset ($_SESSION['Username'])){ //Unauthorized page ?> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta http-equiv="refresh" content="2;url=/"> </head> <body> <center><h1>Unauthorized Access!</h1></center> <center><h1>Please Register... It is TOTALLY Free!!!</h1></center> </body> </html> <?php exit; } ?> html code here login.php <?php session_start(); //Database Information $dbhost="localhost"; $dbname="data"; $dbuser="username"; $dbpass="password"; //Connect to database mysql_connect($dbhost, $dbuser, $dbpass)or die("Could not connect: ".mysql_error()); mysql_select_db($dbname)or die(mysql_error()); $Username=mysql_real_escape_string($_POST['Username']); $Password=mysql_real_escape_string($_POST['Password']); $query="SELECT * FROM Register WHERE Username='$Username' and Password='$Password'";$result=mysql_query($query); if(mysql_num_rows($result)!=1){ $error="Invalid Login"; include ("main.html"); echo "<center><font color=#FF0000>Invalid Login</font></center>"; }else{ $_SESSION['Username']=$Username; include ("members.html"); } ?>
  10. I always have <?php session_start(); exept in login.php that it is starting after the connection string as you see above. Oh and did you remove " " from $Username from the 4th line from the end of my code or was accidentaly?
  11. it is welcome Is quite long code.. 90 lines. But if you need it I will post it. Just to know is plain html code plus my authentication script you just modified paste at the begining. Just like my members page that is working. You need it? Oh and did you remove " " from $Username from the 4th line from the end of my code or was accidentaly?
  12. Is not dub cause I am quite new at this. I don't know If I should add a code lets say in login.php to remember that you are logged in If you are talking about my login.php here it is mysql_connect($dbhost, $dbuser, $dbpass)or die("Could not connect: ".mysql_error()); mysql_select_db($dbname)or die(mysql_error());session_start(); $Username=$_POST['Username']; $Password=$_POST['Password']; $query="SELECT * FROM Register WHERE Username='$Username' and Password='$Password'"; $result=mysql_query($query); if(mysql_num_rows($result)!=1){ $error="Invalid Login"; include ("main.html"); echo "<center><font color=#FF0000>Invalid Login</font></center>"; }else{ $_SESSION['Username']="$Username"; include ("members.html"); } ?>
  13. Nope I am still getting the unauthorized msg for other links when I am logged in. It is like my page doesn't stores the login details when somebody is logged in. Am i missing anything from another code? Something I should have write?
  14. but if you count you are oppening 4( and closing only 3
  15. Ah yes is added here too but I acciddentaly left it in the first line..!!! Sorry.
  16. Hi This code is for authendicate user. It works fine when I put it in members.index. But if I paste it in my other restricted pages when i log in and try to access them... i get the unauthorized msg <?php //members pagesession_start(); if (!isset ($_SESSION['Username']) OR empty ($_SESSION['Username'])){ //Unauthorized page ?> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta http-equiv="refresh" content="2;url=/"> </head> <body> <center><h1>Unauthorized Access!</h1></center> <center><h1>Please Register... It is TOTALLY Free!!!</h1></center> </body> </html> <?php exit; } ?>
  17. ??? Ok. My mistake I didn't mention I am new at coding. Last month I did a lot of job in my page. But this is maybe my biggest promblem cause everybody saying that I have just to copy paste the same code to my restricted pages. Can you give me an example of what you are saying??? Thanks
  18. More problems... The above works fine. But I have restricted links as well. If I use the same code there too I get unauthorized access etc.. Must I use another code or am I missing something else? Thank you
  19. My friend... Thanks a lot. It works fine!!!
  20. Hello My code below is written so when somebody tries to skip login page and copy/paste the members page url. to show the msg and redirect to login page. Everything is working exept that it prints not only the msg but the 3 last lines of the code as well. (EOF; } ?>) I tried many things but nothing. Any suggestions? ??? <?php //members page session_start(); if(empty($Username)){ print<<<EOF <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta http-equiv="refresh" content="0;url=/"> </head> <body> <center><h1>Unauthorized Access!</h1></center> <center><h1>Please Register... It is Totally Free!!!</h1></center> </body> </html> EOF; } ?> [/quote]
  21. I thought I copied the results. Sorry. They were all "","",""... that means black. But the answer from mrdamien was the solution of it!!! Thank you all very very much!!
  22. Hi, I did echo $query; and I get my "insert into" after registration successfull. But the result remauns the same.
  23. Here is my code: //Connect to database mysql_connect ($dbhost, $dbuser, $dbpass)or die("Error: " .mysql_error()); mysql_select_db($dbname) or die(mysql_error()); $Full_Name=$_Post['Full_Name']; $Birthday=$_Post['Birthday']; $Phone_No=$_Post['Phone_No']; $E_mail=$_Post['E_mail'];$ Mail=$_Post['Mail']; $Username=$_Post['Username']; $Password=$_Post['Password']; $checkuser=mysql_query("SELECT Username FROM Register WHERE Username='$Username'"); $Username_exist=mysql_num_rows($checkuser); if($Username_exist>0){ echo "Username Already Registered!"; unset($Username); include 'register.html'; exit(); } $query="INSERT INTO Register (ID, Full_Name, Birthday, Phone_No, E_mail, Mail, Username, Password) VALUES ('NULL','$Full_Name','$Birthday','$Phone_No','$E_m ail','$Mail_Adrdress','$Username','$Password')"; mysql_query($query) or die(mysql_error());mysql_close(); echo "Registration Successful!"; OK here is the problem. When I test my registration form for 1st time I get: Registration successful. But in mysql db (throught control panel) I have only blank fields exept for ID field. Then when I try my form for second or third time and so on I always get: Username allready registered!!!!! Have you anything to suggest? Where is the problem? Thank you ???
×
×
  • 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.