Jump to content

michaelfurey

Members
  • Posts

    27
  • Joined

  • Last visited

michaelfurey's Achievements

Member

Member (2/5)

0

Reputation

  1. I created a login system with bootstrap but for some reason I cannot delete the "placeholder" (in which it is written "admin") in both the inputs of the form ("uname" and "psw"). Even if I change the placeholder it's remain "admin". Have you any idea? This is the code: <!DOCTYPE html> <html> <head> <title>Login</title> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/js/bootstrap.min.js"></script> <link rel="stylesheet" type="text/css" href="css/styles.css"> </head> <body> <div class="container"> <div class="jumbotron text-center" id="jumbo_log"> <h1>Login Page</h1> <p>You must login to enter</p> <form id="theform" method="get"> <div class="container2"> <label for="uname"><b>Username</b></label> <input type="text" id= "uname" name="uname" required><br> <label for="psw"><b>Password</b></label> <input type="password" id="psw" name="psw" required><br><br> <input type="submit" id="submit" class="btn btn-info" value="Login"><br><br> <a class="btn btn-primary" href="registration.php" role="button">Click here if you are not registered</a> </div> </form> </div> </body> </html>
  2. Uhm I tried changing the method (post) but nothing change. In the image what happened. The status is canceled. When I insert that line the status is canceled furthermore the alert and the redirect don't work, even if the insert works well with the DB MySQL.
  3. I have created a registration page to access my website. After the user registrate himself should appear an alert saying that the registration was OK and a redirect to main.php page... however for some reason if I create an insert statement the alert and the redirect don't appear... If I remove the insert the alert and the redirect works... why? This is part of the code of my 3 files: registration.php (ajax call) $('#submit').click(function() { var username2 = $('#uname2').val(); var password2 = $('#psw2').val(); $.ajax({ url: 'ajax/response.php', type: 'GET', data: {username2 : username2, password2: password2}, success: function(data) { if(data === 'correct') { alert("Username and Password have been created!"); //don' work with the insert location.replace("main.php"); //don' work with the insert } else { alert("Username or password are not correct... please register yourself!"); } } }); }); response.php (answer to ajax call) if(isset($_GET['username2']) && isset($_GET['password2'])) { $username2 = $_GET['username2']; $password2 = $_GET['password2']; if (checkUser($pdo, $username2) === true) { echo 'duplicate'; } else { insertUserPwd($pdo, $username2, $password2); //including this line the redirect and the alert doesn't work... the insert is OK echo 'correct'; } } data_access.php (the function works but doesn't permit alert and redirect to appear) function insertUserPwd(PDO $pdo, $usr, $pwd) { $data = [ 'id' => '', 'user' => $usr, 'password' => $pwd ]; $sql = "INSERT INTO users (id, user, password) VALUES (:id, :user, :password)"; $stmt= $pdo->prepare($sql); $stmt->execute($data); } Can someone help me to fix the code?
  4. Yep that's the right title of the topic. I suppose that you can create "quite" easily a Chained Select with Javascript and Ajax.. I was wondering if with PHP it's the same.
  5. I forgot to specify that I should get the selected country from a similar html datalist tag: <datalist id=country_data></datalist> And get the selected value to reduce the name options of the second datalist: <datalist id=name_data></datalist> In other words I should connect both datalists each other.
  6. I would like to connect two html datalists each other. For example starting from a table like that obtained with a SQL query:: +----+---------+--------+--------+ | ID | Name | Country| Gender | +----+---------+--------+--------+ | 1 | Michael | USA | M | | 2 | John | USA | M | | 3 | Michele | Italy | M | | 4 | Carlo | Italy | M | | 5 | Pablo | Mexico | M | | 6 | Lucy | USA | F | +----+---------+--------+--------+ SELECT * FROM genders I would like to select in the first datalist one country in order to see in the second datalist only the names of the persons living in that country. So if I select USA in the first datalist in the second one I should see only the names Michael, John and Lucy. I suppose that an easy way to do that is saving the selected option of the first datalist (for example USA) in a variable ($country_selected) and to modify the SQL query to get the data of the second datalist adding a where clause (where=$country_selected)). But my problem is that I don't know how to create $country_selected... is it possible with PHP?
  7. I am trying to create a bot to auto login to one external blog. Unfortunately when the html 'body' of that site is loading appears an alert: <body onload="alert('Welcome to my personal Blog! Click on continue to Login')" Is there a way to avoid that this alert appears in order to auto fill the username and password more easily?
  8. Well I don't have bad intentions however I understand your point of view!
  9. Hi! I am trying to do a script to fill in and submit this page: https://sa.www4.irs.gov/irfof/lang/en/irfofgetstatus.jsp . Unfortunately my script doesn't work... have you some ideas about the reasons? <?php $dir = 'C:/Users/mmea/Desktop/temporary/'; $refundAmount = // WHY $TIN3 = // DID $TIN2 = // YOU $TIN5 = // POST $filingStatus1 = // THESE? $url="https://sa.www4.irs.gov/irfof/lang/en/irfofgetstatus.jsp"; $postinfo = "refundAmount=".$refundAmount."&TIN2=".$TIN2."&TIN5=".$TIN5."&TIN3=".$TIN3."&filingStatus=".$filingStatus1."&autologin=1&Submit2=Submit"; $cookie_file_path = $dir."/cookie.txt"; $ch = curl_init(); curl_setopt($ch, CURLOPT_HEADER, false); curl_setopt($ch, CURLOPT_NOBODY, false); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file_path); curl_setopt($ch, CURLOPT_COOKIE, "cookiename=0"); curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.2 (KHTML, like Gecko) Chrome/22.0.1216.0 Safari/537.2"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_REFERER, $_SERVER['REQUEST_URI']); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $postinfo); curl_exec($ch); curl_close($ch); ?>
×
×
  • 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.