Firebase Hosting - PHP Starts file download - php

I have just put up a site on firebase, on it is a form where users can put in their database credentials to access it remotely. The form uses POST to send the details to a php page, and its code looks like this:
<form name="login-form" action="login.php" method="post">
<input autocomplete="off" name="ip_address" type="text" placeholder="Enter DB IP"/>
<br/>
<input autocomplete="off" name="db" type="text" placeholder="Enter DB Name"/>
<br/>
<input autocomplete="off" name="username" type="text" placeholder="Enter Username"/>
<br/>
<input name="password" type="password" placeholder="Enter Password"/>
<br/>
<input id="login-button" type="submit" value=">"/>
</form>
Using my apache2 web server, this process works fine, and the user is redirected, however when deployed with firebase (firebase deploy --only hosting), the process instead triggers a file download of login.php. Why is this happening? The file structure for the public folder is exactly the same as it is for apache, as is each files content.

Related

Moodle Accept Login from external site from external website

We are adding Moodle to our site (different server, different sub-domain, but same main domain, and the servers are set up to be able to communicate with each other) and what we want to have it do is:
if the User accesses the main site
User logs in User clicks a link to Moodle
The user is automatically logged into Moodle without
having to reenter their info.
i have added the html form with hidden type in my main domine as moodle post url.
Main domine:
<form class="mt-3" action="http://localhost/moodle/login/index.php" method="post" id="login">
<input id="anchor" type="hidden" name="anchor" value="">
<script>document.getElementById('anchor').value = location.hash;</script>
<input type="hidden" name="logintoken" value="xUe9G7a012vTHpvtOxAfzu84YJ046pu4">
<input type="hidden" name="loginhas" value="eda690fdf">
<div class="form-group">
<label for="username" class="sr-only">Username / email</label>
<input type="text" name="username" id="username" class="form-control" value="admin" placeholder="Username / email" autocomplete="username">
</div>
<div class="form-group">
<label for="password" class="sr-only">Password</label>
<input type="password" name="password" id="password" value="eda690fdf" class="form-control" placeholder="Password" autocomplete="current-password">
</div>
<div class="rememberpass mt-3">
<input type="checkbox" name="rememberusername" id="rememberusername" value="1">
<label for="rememberusername">Remember username</label>
</div>
<button type="submit" class="btn btn-primary btn-block mt-3" id="login">Log in</button>
How to accept this request in moodle ? or if you have any rolution regarding this issue plese help me out of this.
Don't know if possible with Moodle. We do it for several systems using CAS (central authentication service), where several yii2 apps login against a CAS implemented with web2py.
In the Yii side we use https://github.com/2amigos/yii2-usuario for user management and https://github.com/daxslab/yii2-cas-client for auth against the CAS.
Perhaps you need to implement a CAS on Yii and check how make that Moodle authenticates against it.

Can I add a .php file URL to Blogger?

I would like to know if there's a way to add a .php file to a Blogger template using a direct link. I am unsure whether or not I can add it to my form action with a URL as Blogger does not support .php directly.
<form method="post" action="CAN_I_USE_A_URL_HERE?.php">
<input name="Name" placeholder="Name*:"/>
<input name="E-mail" type="email" placeholder="E-mail*:"/>
<input name="Phone" type="email" placeholder="Phone:"/>
<label>Write your message!</label>
<textarea name="Message"></textarea>
<input id="submit" name="submit" type="submit" value="submit"/>
</form>
Blogger will not run server-side code.
You need to put your PHP code on some server that will run it for you, then make the <form> point to that.

Joomla! Contact form inside an article, can't get action php file working

I'm trying to create a contact form on my own. I noticed that it can be achieved by placing the form inside an article, instead of a custom html module.
In the client side, it seems to work. I even added a captcha manually (the re-captcha plugin doesn't seem to work for me). The problem is, I set form's action property as "mail.php", and just added this "mail.php" file to the the template root. The "mail.php" supossedly retrieves the data send by post, and finally composes and sends the email, showing a "message send" notification.
Anyway, when I click on submit, the form page is just reloaded. I guess that Joomla! can't find my "mail.php". I guess that this issue is related to the joomla structure and my inability to place the "mail.php". Any help will be wellcome.
This is how my article looks like (wysiwyg editor mode disabled):
<form action="mail.php" method="post" target="_blank">
<p><label for="nombre">Nombre:</label></p>
<p><input maxlength="50" name="nombre" size="30" type="text" /></p>
<p><label for="email">Email:</label></p>
<p><input maxlength="50" name="email" required="required" size="30" type="text" /></p>
<p><label for="asunto">Asunto:</label></p>
<p><input maxlength="150" name="asunto" size="30" type="text" /></p>
<p><label for="mensaje">Mensaje:</label></p>
<p><textarea cols="50" maxlength="700" name="mensaje" required="required" rows="8"></textarea></p>
<div class="g-recaptcha" data-sitekey="6Lefblahblahblahblah"> </div>
<p><input type="submit" /></p>
</form>

Drupal Site login from wordpress page

I am trying to logged in to drupal site from wordpress using ajax. Scenario is like below:
I have 2 sites one is wordpress and one is in drupal. Right now half of the functionality is in drupal and I am switching to wordpress. But now User needs to be logged in drupal site from wordpress page. I already set all the pages in wordpress if user is logged in drupal. BUt issue I am getting to make users logged in to drupal from the wordpress page.
But I did: I created the sign in page in drupal and set the email & password from get request and auto submitted the page on loading. It is working fine if I opened this page in broser So I am calling this page from wordpress page using ajax. I got 200 response from ajax call but user is not logged in drupal.
Here is the login form from your page
<form action="http://www.seniorsearch.com/content/sign" class="webform-client-form" id="signin">
<div id="webform-component-name">
<input type="hidden" value="0" id="fb_login_id" name="submitted[fb_login_id]">
<input type="hidden" value="" id="redirect_url" name="submitted[redirect_url]">
<input type="text" class="form-text name1" maxlength="128" size="60" value="" name="submitted[name]" id="edit-submitted-name" placeholder="Enter Email">
</div>
<div id="webform-component-pass">
<input type="password" class="form-text pass1" id="password" name="submitted[pass]" placeholder="Enter Password" maxlength="128" size="60" value="" >
<input type="hidden" value="" name="details[sid]" id="sid">
<input type="hidden" value="1" name="details[page_num]" id="page_num">
<input type="hidden" value="1" name="details[page_count]" id="page_count">
<input type="hidden" value="0" name="details[finished]" id="finished">
<input type="hidden" value="form-_OBf1JYKx79Qg5_hsPtYAWmCPrRX6DwFKSODz4M7Wk4" name="form_build_id" id="form_build_id">
<input type="hidden" value="webform_client_form_52" name="form_id" id="form_id">
<input type="hidden" value="webform-ajax-wrapper-52" name="webform_ajax_wrapper_id" id="webform_ajax_wrapper_id">
</div>
<input type="submit" value="" name="op" class="form-submit ajax-processed" id="submit"><span class="termss">I accept Senior Search's Terms of Use.</span>
</form>
You need to send every one of those parameters with your AJAX script if you want the login to work.
I created the signin and signup form in drupal without any header, footer and sidebar, so There is only form there and call that page in wordpress site using iframe. Then refresh the iframe top window in drupal code after successful login.

php form sanitation before sending to external url

I have a form on my site that gets submitted to a third party site which basically adds the form data as a record in the third party database. This is implemented with the form "action" attribute. I have no control over what the third party does after the form is submitted. See below for the implementation.
I'm doing javascript validation, but I also need to be able to do server-side sanitation and validation of the form data with php before it gets sent to the third party. I may also want to implement a CAPTCHA.
What approach can I take to achieve this? I thought about having the form submit to the script that houses the form, and collecting all of my $_POST variables, do the validation, and then maybe redirect to the third party URL, but not quite sure how the third party would receive all the form data if its not longer the form action. Is it possible to just tack all of my form variables on as a query string the third party URL?
<form id="contactform" name="contactform" onsubmit="return validateForm(this)" method="post" encType="multipart/form-data" action="https://thirdpartysite.com/db/?action=AddRecord&apptoken=xxx">
<input class="contactfield required contact_name_first" type="text" id="firstname" name="firstname" placeholder="FIRST NAME" />
<input class="contactfield required contact_name_last" type="text" id="lastname" name="lastname" placeholder="LAST NAME" />
<input class="contactfield required contact_org" type="text" id="organization" name="organization" placeholder="ORGANIZATION" />
<input class="contactfield required contact_email" type="text" id="email" name="email" placeholder="EMAIL" />
<input class="contactfield required contact_phone" type="text" id="phone" name="phone" placeholder="PHONE" />
<textarea class="contactfield required contact_msg" id="message" name="message" cols="40" rows="10" placeholder="HOW CAN WE HELP YOU?"></textarea>
<input type="hidden" name="rdr" value="http://www.mysite.com/thank-you" /><!-- Note: this gets passed to the third party site as the page to redirect back to after third party site receives the form data" -->
</form>

Categories