Subversion Repositories oidplus

Rev

Go to most recent revision | Blame | Last modification | View Log | RSS feed

  1. <?php
  2.  
  3. /*
  4.  * OIDplus 2.0
  5.  * Copyright 2019 Daniel Marschall, ViaThinkSoft
  6.  *
  7.  * Licensed under the Apache License, Version 2.0 (the "License");
  8.  * you may not use this file except in compliance with the License.
  9.  * You may obtain a copy of the License at
  10.  *
  11.  *     http://www.apache.org/licenses/LICENSE-2.0
  12.  *
  13.  * Unless required by applicable law or agreed to in writing, software
  14.  * distributed under the License is distributed on an "AS IS" BASIS,
  15.  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  16.  * See the License for the specific language governing permissions and
  17.  * limitations under the License.
  18.  */
  19.  
  20. include_once __DIR__ . '/functions.inc.php';
  21.  
  22. if (isset($_SERVER['SERVER_NAME']) && (($_SERVER['SERVER_NAME'] == 'viathinksoft.de') ||
  23.                                        ($_SERVER['SERVER_NAME'] == 'www.viathinksoft.de') ||
  24.                                        ($_SERVER['SERVER_NAME'] == 'viathinksoft.com') ||
  25.                                        ($_SERVER['SERVER_NAME'] == 'www.viathinksoft.com')))
  26. {
  27.  
  28.         if (explode('$',$id)[0] == 'oidplus:com.viathinksoft.freeoid') {
  29.                 $handled = true;
  30.  
  31.                 $out['title'] = 'Register a free OID';
  32.  
  33.                 $highest_id = freeoid_max_id();
  34.  
  35.                 $out['text'] .= '<p>Currently <a href="?goto=oid:1.3.6.1.4.1.37476.9000">'.$highest_id.' free OIDs have been</a> registered. Please enter your email below to receive a free OID.</p>';
  36.  
  37.                 try {
  38.                         $out['text'] .= '
  39.                                   <form id="freeOIDForm" onsubmit="return freeOIDFormOnSubmit();">
  40.                                     E-Mail: <input type="text" id="email" value=""/><br><br>'.
  41.                                  (RECAPTCHA_ENABLED ? '<script> grecaptcha.render(document.getElementById("g-recaptcha"), { "sitekey" : "'.RECAPTCHA_PUBLIC.'" }); </script>'.
  42.                                                    '<div id="g-recaptcha" class="g-recaptcha" data-sitekey="'.RECAPTCHA_PUBLIC.'"></div>' : '').
  43.                                 ' <br>
  44.                                     <input type="submit" value="Request free OID">
  45.                                   </form>
  46.  
  47.  
  48.  
  49.  
  50. <h3>Terms of Service</h3>
  51.  
  52. <ul>
  53.         <li>This service is mainly intended to give <b>private persons, small workgroups and software developers of freeware, shareware or open-source software</b> the possibility of obtaining a free Object Identifier (OID) with minimum bureaucratic overhead.</li>
  54.         <li>You simply need to enter a valid email address to which an activation link will be sent. To get the OID assigned, you need to click the link in the automatically generated email and then enter your personal name, which is the only mandatory field. No human intervention from our side is performed during the whole process and the OID will be immediately assigned.</li>
  55.         <li>Only OIDs which are registered and shown in this registry web site are legal assigned.</li>
  56.         <li><b>You may only register one OID per person</b>. You can assign an infinite amount of sub-OIDs to yourself using your root OID.</li>        <li>Instead of using your new generated OID directly for a specific purpose, we recommend you to delegate a sub-OID for each purpose. Following this strategy, you will only require one root OID assigned to you.</li>
  57.         <li>Please only register an OID if you are really sure that you need an OID namespace.</li>
  58.         <li>To ensure that you get an appropriate OID namespace for your needs, please read the following points carefully:<ul>
  59.                 <li><b>If you are representing a company, you should register an OID in arc <code>1.3.6.1.4.1</code> instead (<a href="http://pen.iana.org" target="_blank">more information</a>).</b></li>
  60.                 <li>If you only need an OID for an example in a document, please use the OID <code>2.999</code> (no registration required).</li>
  61.                 <li>If you are sure that your target application does allow OIDs with 128-bit arcs (which does not apply to most ASN.1 implementations), you can register a globally unique OID (UUID OID) in arc <code>2.25</code> (see <a href="http://www.itu.int/ITU-T/asn1/uuid.html#UUID%20Generation%20&%20Registration" target="_blank">generate OID</a> and <a href="http://www.oid-info.com/faq.htm#size-limitations" target="_blank">more information about known limitations</a>). However, you can still request a ViaThinkSoft OID since it is shorter and easier to remember.</li>
  62.                 <li>If you want to extend the Active Directory schema, please consider obtaining an OID from Microsoft instead (<a href="http://msdn.microsoft.com/en-us/library/ms677620.aspx" target="_blank">more information</a>).</li>
  63.                 <li>If you are representing a country, you should consider registering an OID under the arc <code>1.2</code> (deprecated) or <code>2.16</code> (recommended) instead (<a href="http://www.oid-info.com/faq.htm#11" target="_blank">more information</a>).</li>
  64.                 <li>If you are representing a telecom operator, you should consider registering an OID in arc <code>0.2</code> instead (<a href="http://www.oid-info.com/get/0.2" target="_blank">more information</a>).</li>
  65.                 <li>If you are representing a network operator, you should consider registering an OID in arc <code>0.3</code> instead (<a href="http://www.oid-info.com/get/0.3" target="_blank">more information</a>).</li>
  66.         </ul></li>
  67.         <li>A registered OID can never be unregistered or reassigned. It will always stay visible to the public.</li>
  68.         <li><b>You agree that your OID including your email address will be published in this public registry as well as in <a href="http://oid-info.com/get/1.3.6.1.4.1.37476.9000" target="_blank">oid-info.com</a> and in other public services.</b></li>
  69.         <li>We encourage you to submit all your delegations to <a href="http://oid-info.com/get/1.3.6.1.4.1.37476.9000" target="_blank">oid-info.com</a>.</li>  <li>The data you entered can be changed at any time with a randomly generated password for your OID during the registration procedure (which can be changed and recovered at any time).</li>
  70.         <li>You cannot choose a favorite arc number for your OID.</li>
  71.         <li>ViaThinkSoft does not assign alphanumeric identifiers or Internationalized Resource Identifier (IRI) names since this system is fully automated and only the email address will be verified.</li>
  72.         <li>Your new OID will be registered in arc <code>{iso(1) identified-organization(3) dod(6) internet(1) private(4) enterprise(1) 37476 freeoid(9000)}</code><br>IRI notation: <code>/ISO/Identified-Organization/6/1/4/1/37476/FreeOID</code></li>
  73.         <li>If you have any questions or if you encounter bugs or problems, please contact <a href="mailto:'.htmlentities(OIDPLUS_ADMIN_EMAIL).'">'.htmlentities(OIDPLUS_ADMIN_EMAIL).'</a> (in English or German).</li>
  74. </ul>
  75.  
  76.  
  77.  
  78. ';
  79.  
  80.                 } catch (Exception $e) {
  81.  
  82.                         $out['text'] = "Error: ".$e->getMessage();
  83.  
  84.                 }
  85.         } else if (explode('$',$id)[0] == 'oidplus:com.viathinksoft.freeoid.activate_freeoid') {
  86.                 $handled = true;
  87.  
  88.                 $email = explode('$',$id)[1];
  89.                 $timestamp = explode('$',$id)[2];
  90.                 $auth = explode('$',$id)[3];
  91.  
  92.                 $out['title'] = 'Activate Free OID';
  93.  
  94.                 $res = OIDplus::db()->query("select * from ".OIDPLUS_TABLENAME_PREFIX."ra where email = '".OIDplus::db()->real_escape_string($email)."'");
  95.                 if (OIDplus::db()->num_rows($res) > 0) {
  96.                         $out['text'] = 'This RA is already registered.'; // TODO: actually, the person might have something else (like a DOI) and want to have a FreeOID
  97.                 } else {
  98.                         if (!OIDplus::authUtils()::validateAuthKey('com.viathinksoft.freeoid.activate_freeoid;'.$email.';'.$timestamp, $auth)) {
  99.                                 $out['text'] = 'Invalid authorization. Is the URL OK?';
  100.                         } else {
  101.                                 $out['text'] = '<p>E-Mail-Adress: <b>'.$email.'</b></p>
  102.  
  103.                                   <form id="activateFreeOIDForm" onsubmit="return activateFreeOIDFormOnSubmit();">
  104.                                     <input type="hidden" id="email" value="'.htmlentities($email).'"/>
  105.                                     <input type="hidden" id="timestamp" value="'.htmlentities($timestamp).'"/>
  106.                                     <input type="hidden" id="auth" value="'.htmlentities($auth).'"/>
  107.  
  108.                                     Your personal name or the name of your group:<br><input type="text" id="ra_name" value=""/><br><br><!-- TODO: disable autocomplete -->
  109.                                     Title of your OID (usually equal to your name, optional):<br><input type="text" id="title" value=""/><br><br>
  110.                                     URL for more information about your project(s) (optional):<br><input type="text" id="url" value=""/><br><br>
  111.  
  112.                                     Password: <input type="password" id="password1" value=""/><br><br>
  113.                                     Again: <input type="password" id="password2" value=""/><br><br>
  114.                                     <input type="submit" value="Register">
  115.                                   </form>';
  116.                         }
  117.                 }
  118.         }
  119.  
  120. }
  121.  
  122.