Google Custom Search and a multi tenant multi domain web application - multi-tenant

I'm developing an application that runs on several domains.
I want to use Google Custom Search on all of them. But GCS requires to provide the domain(s) of websites to search.
Is there any way to specify domains dynamically? In theory I can have thousands of domains, and I don't like the idea of adding all of them manually.

Google provide a service where you can Create a Custom Search Engine on the fly.
To use this you have to have real links on your page and not JavaScript generated links – this is so the remote service can parse your page.
<form name="cse" id="searchbox_demo" action="http://www.google.com/cse">
<input type="hidden" name="cref" value="" />
<input type="hidden" name="ie" value="utf-8" />
<input type="hidden" name="hl" value="" />
<input name="q" type="text" size="40" />
<input type="submit" name="sa" value="Search" />
</form>
<script type="text/javascript" src="http://www.google.co.uk/cse/tools/onthefly?form=searchbox_demo&lang="></script>
stackoverflow<br />
serverfault<br />
superuser
Therefore you would need to use some mechanism to dynamically create your site list page (e.g. Ruby, Python, PHP, ASP, JSP etc). From my limited experimentation it appears that the on the fly service aggressively cache your requests for the creation of a custom search engine based on the requesting page (I'm not sure how long the cache lasts). It would therefore appear that you will not be able to add and drop search sites from your list very quickly. As a workaround you could change the url that requested the custom search box for every change.

Related

Firefox built in dev Inspector tool, browser bug with hidden input in HTML

I use Normal Firefox with Dev Tool.
The Explanation: I use hidden input fields to store some data. So I have noticed twice, that the browser is mixing all input fields completely up, it does not understand what is what at all.
Simplified example HTML on server:
<input id="test" type="hidden" value="Hello there"><input id="something" type="hidden" value="0">
Firefox gets above HTML from server (clear cache, reload the page, nothing fixes this):
<input id="test" type="hidden" value="0"><input id="something" type="hidden" value="Hello there">
(and now thinks that id 1 is id 2 etc)
Once I Restart my browser, all gets normal again. (Like example shows, there is no human error, just nonsense) Anyone else had this, if not, then look out before hurting yourself. I don't know if normal users may actually experience this but they may. Someone can explain this...

Oracle Apex to receive form submit POST data

I am new to Oracle Apex.I am trying to receive POST data in Oracle Apex page. I want to submit a HTML form and receive that post submission in my Oracle Apex app. searched web but couldn't get suggestions.
In my Oracle database 11g, I have configured Apex 18.1 which is running in 8085 port and created some basic pages.
<!DOCTYPE html>
<html>
<body>
<h2>HTML Forms</h2>
<form action="http://localhost:8085/apex/f?p=106:4:9735956410807:::::" method="post">
<label for="fname">First name:</label><br>
<input type="text" id="fname" name="fname" value="John"><br>
<label for="lname">Last name:</label><br>
<input type="text" id="lname" name="lname" value="Doe"><br><br>
<input type="submit" value="Submit">
</form>
<p>If you click the "Submit" button, the form-data will be sent to Oracle Apex page.".</p>
</body>
</html>
This POST submission will be from external source and Apex app should process this submission.
Thanks in advance.
There are a couple options here:
You could create a webservice using APEX Restful services and sending there. It's probably much safer than exposing you application like you are doing. Worst case scenario you'll have to convert you form post to a json on the backend of the original app, which should be easy pease.
Why not just create a public page with an APEX form and execute a process after the submit happens? You have a tool that generate forms and you are building one from scratch?
*** Having said that, you might want to have the page in a different domain, site, etc... I still think you would be better telling on the other site that the person would be redirected and then sending it to the APEX form

GSA Cookie Auth - "Login form doesn't have both text and password inputs"

I can't seem to find out what's wrong with the login form I'm using to setup cookie authentication, the GSA throws me this error (serving log) after submitting my credentials in universal login form:
Got form; name=customlogin clientLogin; action=/content/marketing/en/login/j_security_check; type=hidden, name=resource; type=hidden, name=_charset_; type=hidden, name=j_username; type=hidden, name=j_password
Login form doesn't have both text and password inputs
Error in authentication module: Login form doesn't have both text and password inputs
Here is the form I'm using:
<form method="POST" action="/content/marketing/en/login/j_security_check" id="form_customlogin" name="customlogin clientLogin" enctype="multipart/form-data" onsubmit="return cq5forms_validate_customlogin();">
<input type="hidden" name="resource" value="/content/operations/apps/en.html" />
<input type="hidden" name="_charset_" value="UTF-8" />
<input id="username" type="hidden" name="j_username" value="anonymous-user" />
<input id="password" type="hidden" name="j_password" value="anon" />
<p>
Or go straight through as a
guest
(limited access)
</p>
</form>
Does anyone have knowledge on how a form has to be built in order for the GSA to use it? It'd be very welcome.
Thanks in advance!
EDIT: Apparently, inputfilds user/pw must have type username and password, they can't be hidden.
This was already a feature request.
The username field will have to be type="text", there is no type="username". Out of curiosity, why would you have them hidden?
Very often, when you have complicated login forms, your best bet is to create a separate login form just for the GSA that doesn't include any JavaScript or other wackiness.

Search-form action attribute with Advanced AJAX Page Loader wordpress plugin returns "more than one title tag on the page.." warning in debug mode

I'm trying to enable search functionality of the Advanced AJAX Page Loader plugin on a custom wordpress theme I'm building, but after I enter keyword into search and hit enter, loader.gif keeps on spinning and I get this message in debug mode : "WARNING: You seem to have more than one title tag on the page, this is going to cause some major problems so page title changing is disabled". It also passes the url of the website twice into the address bar and I believe this has something to do with the action attribute that's being passed by the form.
This is the site in question: http://natalija.co.nf
I left the debug mode of the AAPL plugin on for now
This is my searchform.php code:
<form method="get" id="searchform" class="searchform" action="<?php bloginfo('url'); ?>">
<input type="submit" id="searchsubmit" value="" class="btn" />
<input type="text" size="10" name="s" id="s" value="" onfocus="if(this.value==this.defaultValue)this.value='';" onblur="if(this.value=='')this.value=this.defaultValue;"/>
</form>
I managed to ajaxify the theme with this plugin but I 'm having trouble getting the search to work properly so I was wondering if anyone here can help me out with this? It is driving me crazy.
I solved it. The code in search.php needs to be wrapped with a div class="searchform".

google checkout integration - codeigniter

I have site built in codeigniter framework.
I want to use google checkout.
I have used this code to transfer fund but I need something returned so that I can know that transfer is successful and then enter values to my database.
I am not sure how to do that.
Can anyone show me step by step how to do that?
My form :
<form action="https://sandbox.google.com/checkout/api/checkout/v2/checkoutForm/Merchant/xxxxxxx" id="BB_BuyButtonForm" method="post" name="BB_BuyButtonForm" target="_top">
<input name="item_name_1" type="hidden" value="Deposite"/>
<input name="item_description_1" type="hidden" value="Money Deposite"/>
<input name="item_quantity_1" type="hidden" value="1"/>
<input name="item_price_1" type="text" value="30.0"/>
<input name="item_currency_1" type="hidden" value="USD"/>
<input name="_charset_" type="hidden" value="utf-8"/><br />
<input alt="" src="https://sandbox.google.com/checkout/buttons/buy.gif?merchant_id=xxxxxxxx&w=117&h=48&style=white&variant=text&loc=en_US" type="image"/>
</form>
...but I need something returned so that I can know that transfer is successful and then enter values to my database...
The Google Checkout API calls that "Part 2" or "Process Checkout Orders".
Here's a tutorial using their Java lib. Note that it doesn't mean you "have" to use this (or any) specific lib, it just shows you the flow.
Other libs are here.

Resources