Jump to content

dancojocaru2000

Members
  • Content Count

    19
  • Joined

  • Last visited

Community Reputation

0 Neutral

About dancojocaru2000

  • Rank
    Member
  1. So you say that I should make something like $value = $_POST['mail']
  2. I want to make an email form using PHP. Everything is good, BUT Is there a way to make a drop-down list and if the visitor selects Admin, email will be sent to admin@$_SERVER[DOCUMENTROOT] and if it selects Postmaster it will be sent to postmaster@<that thing>?
  3. SOLVED IT! I SET IT TO SHORT TEXT. QUESTION SOLVED!
  4. In Access 2013 (or 2016 Preview) it is called Long text. Is there a SQL command that shows it? (There is a almost hidden SQL command processor in Access)
  5. In Access 2013 (or 2016 Preview) it is called Long text
  6. I added it using MS Access. I don't know anything else... Is there a way to make the php script to add automatically the spaces needed to reach 20 characters?
  7. I really don't even know. But how am I supposed to do here. Because if I set the database pass field to only 9 characters... Just tell me please how to make this show TRUE.
  8. I'm completely messed up. I solved that error by gettion SQL to select only by the username and then if the passwords are the same (database and entered) it will do the rest. It looks like this: $sql = "SELECT * FROM Login WHERE Username = '" . $_SERVER['PHP_AUTH_USER'] . "'"; if($result) { while ($row = $result->fetch()) { echo $row['Password']; echo $_SERVER['PHP_AUTH_PW']; if(!empty($row["Username"]) AND !empty($row["Password"])) { if($_SERVER['PHP_AUTH_PW'] == $row["Password"]) { $_SESSION['user'] = $row["Username"]; echo "Login Succefull, " . $_SESSION['user'] . "!"; } else { die("<br>Wrong password!"); //THIS GETS ON THE SCREEN. };} else { echo "You entered wrong username and/or password. Please refresh this page to retry. It may be possible that your account doesn't exist. In this case, cancel the login box and sign up."; } } } // query failed else { $error = $db->errorInfo(); trigger_error('Unable to process login query. DB Error: ' . $error[2]); } } ?> I cutted unnecessary lines that are found above, in other replyes. The output: Database found. Searching for your user account. Please be patient. dan***srl dan***srl Wrong password! For testing,, the password is dan***srl. PLEASE TELL ME WHY IS IT WRONG PASSWORD IF THEY ARE THE SAME? I censored the passwords, in the entered field and database there are not any stars/asterisks.
  9. Notice: Unable to process login query. DB Error: [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1. (SQLExecute[-3010] at ext\pdo_odbc\odbc_stmt.c:254) in C:\xampp\htdocs\login.php on line 87 I suppose this is from database and not PHP related, but someone has the solution?
  10. Fatal error: Call to undefined method PDO::erroInfo() in C:\xampp\htdocs\login.php on line 86 There: $error = $db->erroInfo();
  11. Hello! I wrote the folowing script. It basically sends a HTML 401 Unauthorized error that displays a login box. After that it collects the info an does the login stuff that a form does. Now, here comes the problems: In both Access and MySQL connections method (basically only the method to connect is different because both use SQL, just one is a file and other is a server) I get this error: Fatal error: Call to a member function fetch() on boolean in C:\xampp\htdocs\login.php on line 66 Here is the file: <?php error_reporting(E_ALL); ini_set('display_errors', '1'); session_start(); if (!isset($_SERVER['PHP_AUTH_USER'])) { header('WWW-Authenticate: Basic realm="Login to Bitcoin Double Machine, cancel to sign up"'); header('HTTP/1.0 401 Unauthorized'); //echo 'You canceled the login. Click <a href="test.php">here</a> to retry.'; echo "<script type='text/javascript'> var msg = \"LOGIN CANCELLED. PLEASE REFRESH OR SIGN UP\"; msg = \" ... \" + msg;pos = 0; function scrollTitle() { document.title = msg.substring(pos, msg.length) + msg.substring(0, pos); pos++; if (pos > msg.length) pos = 0 window.setTimeout(\"scrollTitle()\",300); } scrollTitle(); </script>"; echo "<h1>To sign up, use the button below</h1>"; echo "<a href=\"signup.php\" style=\"-webkit-appearance: button;-moz-appearance: button; appearance: button; text-decoration: none; color: initial\">Sign Up</a>"; echo "<br><br>"; echo "<iframe src=\"../401.php\" seamless style=\"width:100%;height:80%\"></iframe>"; unset($_SERVER['PHP_AUTH_USER']); unset($_SERVER['PHP_AUTH_PW']); exit; } else { #Connecting to database $dbFile = $_SERVER["DOCUMENT_ROOT"] . "/LOGINDATABASE.mdb"; if (!file_exists($dbFile)) { die("Database " . $dbFile . " not found! Please copy this error and report it through the contact page."); } else { echo "Database found. Searching for your user account. Please be patient."; } $db = new PDO("odbc:DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=$dbFile; Uid=; Pwd=;"); #Connected to database #Starting login script $user = $_SERVER['PHP_AUTH_USER']; $pass = $_SERVER['PHP_AUTH_PW']; #Clearing login box if user and pass are set so that a refresh would show the box again #NOT WORKING. HELP! #if (isset($user)) { # if (isset($pass)) { # unset($_SERVER['PHP_AUTH_USER']); # unset($_SERVER['PHP_AUTH_PW']); # } else { # die("Password not set. Copy this and sent it to site administrator through contact page."); # } #} else { # die("Username not set. Copy this and sent it to site administrator through contact page."); #} # #Starting database check for login details $sql = "SELECT *"; $sql .= " FROM Login"; $sql .= " WHERE userName = '" . $user . "'"; $sql .= " AND pass ='" . $pass . "'"; $result = $db->query($sql); while ($row = $result->fetch()) { if(!empty($row["Username"]) AND !empty($row["Password"])) { $_SESSION['user'] = $row["user"]; echo "Login Succefull!"; } else { echo "You entered wrong username and/or password. Please refresh this page to retry. It may be possible that your account doesn't exist. In this case, cancel the login box and sign up."; } } } ?> Also, if you can help me with the line 44-56 part, because it isn't working. (I commented it just to be sure it isn't the problem. Again, thank you for help!
  12. Yes, that one was put there by me, not a mistake! I'm coming back with another post because the problem showed by the earlier one is solved. So, here am I. From earlier post, I modified my code and finally (or not), I have reached this one: <?php error_reporting(E_ALL); ini_set('display_errors', '1'); session_start(); if (!isset($_SERVER['PHP_AUTH_USER'])) { header('WWW-Authenticate: Basic realm="Login to Bitcoin Double Machine, cancel to sign up"'); header('HTTP/1.0 401 Unauthorized'); //echo 'You canceled the login. Click <a href="test.php">here</a> to retry.'; echo "<script type='text/javascript'> var msg = \"LOGIN CANCELLED. PLEASE REFRESH OR SIGN UP\"; msg = \" ... \" + msg;pos = 0; function scrollTitle() { document.title = msg.substring(pos, msg.length) + msg.substring(0, pos); pos++; if (pos > msg.length) pos = 0 window.setTimeout(\"scrollTitle()\",300); } scrollTitle(); </script>"; echo "<h1>To sign up, use the button below</h1>"; echo "<a href=\"signup.php\" style=\"-webkit-appearance: button;-moz-appearance: button; appearance: button; text-decoration: none; color: initial\">Sign Up</a>"; echo "<br><br>"; echo "<iframe src=\"../401.php\" seamless style=\"width:100%;height:80%\"></iframe>"; exit; } else { $db=new mysqli('localhost', 'DanCojocaru', 'danutzsrl', 'dan cojocaru'); /* //$ID = $_SESSION['user']; //$Password = $_SESSION['pass']; */ function SignIn() { //session_start(); //starting the session for user profile page if(!empty($_SERVER['PHP_AUTH_USER'])) //checking the 'user' name which is from Sign-In.html, is it empty or have some text { $sql = "<<<sql SELECT * FROM `UserName` WHERE userName = '" . $_SERVER['PHP_AUTH_USER'] . "' AND pass ='" . $_SERVER['PHP_AUTH_PW'] . "' SQL;"; $row = $mysqli->query($sql)->fetch_array(); if(!empty($row['userName']) AND !empty($row['pass'])) { $_SESSION['userName'] = $row['pass']; echo "SUCCESSFULLY LOGIN TO USER PROFILE PAGE..."; } else { echo "SORRY... YOU ENTERED WRONG ID AND PASSWORD... PLEASE RETRY..."; } } } //if(isset($_POST['submit'])) //{ SignIn(); //} } ?> Basically making a HTML 401 error and after error trying to match the info provided with the MySQL database named dan cojocaru. Here are the problems. After loading this page, guess, error! Notice: Undefined variable: mysqli in C:\xampp\htdocs\test3.php on line 41 Fatal error: Call to a member function query() on null in C:\xampp\htdocs\test3.php on line 41 Please help!
  13. Just a tip, your answer would be better if you had told me how to do that, not just how to do it...
×
×
  • 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.