Convert line endings from MAC to UNIX
[php-addressbook.git] / register / checklogin.php
index 3eabf55..fe2ef0d 100644 (file)
-<?php\r\r
-\r\r
-include"login_config.php";\r\r
-\r\r
-//Connection String Variables_________________________________________________\r\r
-\r\r
-   // connect to the server\r\r
-   mysqli_connect( $db_host, $db_username, $db_password )\r\r
-      or die( "Error! Could not connect to database: " . mysqli_error() );\r\r
-   \r\r
-   // select the database\r\r
-   mysqli_select_db( $db )\r\r
-      or die( "Error! Could not select the database: " . mysqli_error() );\r\r
-\r\r
-//IBM suggested scrub for URL request\r\r
-$urlun = strip_tags(substr($_REQUEST['username'],0,32));\r\r
-$urlpw = strip_tags(substr($_REQUEST['password'],0,32));\r\r
-\r\r
-$cleanpw = md5($urlpw);\r\r
-\r\r
-//echo"Cleanpw: $cleanpw<br>";\r\r
-\r\r
-//$sql="SELECT * FROM agents WHERE username='$urlun' and password='$urlpw'";\r\r
-$sql="SELECT * FROM users WHERE username='$urlun' and password='$cleanpw'";\r\r
-\r\r
-$result=mysqli_query($db,$sql);\r\r
-\r\r
-// mysqli_num_row is counting table rows\r\r
-\r\r
-$count=mysqli_num_rows($result);\r\r
-\r\r
-// If result matches $myusername and $mypassword, table row must be 1 row\r\r
-\r\r
-//echo"Count:$count<br>";\r\r
-\r\r
-if($count==1){\r\r
-\r\r
-// Register $myusername and redirect to file designated success file\r\r
-\r\r
-$cookie_name ="$cookiename";\r\r
-\r\r
-$cookie_value ="$urlun";\r\r
-\r\r
-//set to 24 hours\r\r
-\r\r
-$cookie_expire ="86400";\r\r
-\r\r
-setcookie($cookie_name,$cookie_value,time() + (86400),"/", $cookie_domain);\r\r
-\r\r
-header("location:$successful_login_url");\r\r
-\r\r
-}else{\r\r
-\r\r
-header("location:$failed_login");\r\r
-\r\r
-}\r\r
-\r\r
-\r\r
-?>\r\r
-\r\r
-\r\r
-\r\r
-\r\r
-\r\r
+<?php
+\r
+
+\r
+include"login_config.php";
+\r
+
+\r
+//Connection String Variables_________________________________________________
+\r
+
+\r
+   // connect to the server
+\r
+   mysqli_connect( $db_host, $db_username, $db_password )
+\r
+      or die( "Error! Could not connect to database: " . mysqli_error() );
+\r
+   
+\r
+   // select the database
+\r
+   mysqli_select_db( $db )
+\r
+      or die( "Error! Could not select the database: " . mysqli_error() );
+\r
+
+\r
+//IBM suggested scrub for URL request
+\r
+$urlun = strip_tags(substr($_REQUEST['username'],0,32));
+\r
+$urlpw = strip_tags(substr($_REQUEST['password'],0,32));
+\r
+
+\r
+$cleanpw = md5($urlpw);
+\r
+
+\r
+//echo"Cleanpw: $cleanpw<br>";
+\r
+
+\r
+//$sql="SELECT * FROM agents WHERE username='$urlun' and password='$urlpw'";
+\r
+$sql="SELECT * FROM users WHERE username='$urlun' and password='$cleanpw'";
+\r
+
+\r
+$result=mysqli_query($db,$sql);
+\r
+
+\r
+// mysqli_num_row is counting table rows
+\r
+
+\r
+$count=mysqli_num_rows($result);
+\r
+
+\r
+// If result matches $myusername and $mypassword, table row must be 1 row
+\r
+
+\r
+//echo"Count:$count<br>";
+\r
+
+\r
+if($count==1){
+\r
+
+\r
+// Register $myusername and redirect to file designated success file
+\r
+
+\r
+$cookie_name ="$cookiename";
+\r
+
+\r
+$cookie_value ="$urlun";
+\r
+
+\r
+//set to 24 hours
+\r
+
+\r
+$cookie_expire ="86400";
+\r
+
+\r
+setcookie($cookie_name,$cookie_value,time() + (86400),"/", $cookie_domain);
+\r
+
+\r
+header("location:$successful_login_url");
+\r
+
+\r
+}else{
+\r
+
+\r
+header("location:$failed_login");
+\r
+
+\r
+}
+\r
+
+\r
+
+\r
+?>
+\r
+
+\r
+
+\r
+
+\r
+
+\r
+
+\r