PageRenderTime 46ms CodeModel.GetById 13ms RepoModel.GetById 1ms app.codeStats 0ms

/admin/createaccount.php

https://bitbucket.org/3tierlogic/3tl.tabbuilder
PHP | 183 lines | 149 code | 33 blank | 1 comment | 8 complexity | 6ecfe75fa7bade261f6ffdd01dda635f MD5 | raw file
  1. <?
  2. session_start();
  3. if (isset($_SESSION['superaccount'])) {
  4. $isSuperUser = $_SESSION['superaccount'];
  5. }
  6. // Connect to database
  7. require_once("../editor/config.php");
  8. $con = mysql_connect(DB_HOST, DB_USER, DB_PASS); // connect to database
  9. if (!$con) { // error checking and handling
  10. die('Could not connect: ' . mysql_error());
  11. }
  12. mysql_select_db(DB_NAME);
  13. ?>
  14. <!doctype html>
  15. <html lang="en-US">
  16. <head>
  17. <meta charset="UTF-8" />
  18. <title>Tab Editor - Administration Section </title>
  19. <link href="../style.css" rel="stylesheet" type="text/css" />
  20. <!--[if IE]>
  21. <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
  22. <![endif]-->
  23. <!--[if IE 6]>
  24. <script src="../js/belatedPNG.js"></script>
  25. <script>
  26. DD_belatedPNG.fix('*');
  27. </script>
  28. <![endif]-->
  29. </head>
  30. <body class="normalpage">
  31. <section id="page">
  32. <div id="bodywrap">
  33. <section id="top">
  34. <nav>
  35. <h1 id="sitename">
  36. <a href="#">Portfolio | Premium CSS Template </a></h1>
  37. <ul id="sitenav">
  38. <li><a href="../editor/dashboard.php">Back to dashboard</a></li>
  39. <li class="current"><a href="">Admin</a></li>
  40. </ul>
  41. </nav>
  42. <header id="normalheader"></header>
  43. </section>
  44. <section id="contentwrap">
  45. <div id="contents" class="normalcontents"><section id="normalpage">
  46. <section id="left">
  47. <h2>Administration Page</h2>
  48. <article>
  49. <h3>Your account has been created with the following information:</h3>
  50. <?
  51. $currentCompanyID = $_REQUEST['customerID'];
  52. $createCompany = false;
  53. if ($currentCompanyID == '0') {
  54. $createCompany = true;
  55. }
  56. echo "Company Name: ".$_REQUEST['cname']."<br>";
  57. echo "Company Address: ".$_REQUEST['caddress']."<br>";
  58. echo "City: ".$_REQUEST['ccity']."<br>";
  59. echo "Postal Code: ".$_REQUEST['cpostal']."<br>";
  60. echo "URL: ".$_REQUEST['curl']."<br>";
  61. $totalwidgets = count($_REQUEST['cwidget']);
  62. $selectedwidgets = $_REQUEST['cwidget'];
  63. echo "Total widgets: ".$totalwidgets."<br>";
  64. for ($i=0; $i<$totalwidgets; $i++) {
  65. echo ($i+1) . '- ' . $selectedwidgets[$i] . '<br>';
  66. }
  67. echo "User Name: ".$_REQUEST['user1name']."<br>";
  68. echo "Login ID: ".$_REQUEST['user1loginid']."<br>";
  69. echo "Password: ".$_REQUEST['user1password']."<br>";
  70. if (!$createCompany) { //*** Company already
  71. $new_companyID = $currentCompanyID;
  72. } else { //*** Create a new company
  73. $sql_create_company = "INSERT INTO sp_company_info (cp_companyName, cp_companyHeadAddress, cp_city, cp_postalCode, cp_createDate, cp_url, cp_status) VALUES ('".
  74. addslashes($_REQUEST['cname'])."','".
  75. addslashes($_REQUEST['caddress'])."','".
  76. addslashes($_REQUEST['ccity'])."','".
  77. addslashes($_REQUEST['cpostal'])."','".
  78. date("Y-m-d H:i:s")."','".
  79. addslashes($_REQUEST['curl'])."','1')";
  80. $res_create_company = mysql_query($sql_create_company, $con);
  81. $new_companyID= mysql_insert_id();
  82. echo "Record created in the company table with id: ".$new_companyID."<br>";
  83. }
  84. $sql_create_wdigets = "INSERT INTO sp_partner_widgets SET partner_sid ='".$new_companyID."', ";
  85. for ($i=0; $i<$totalwidgets; $i++) {
  86. $sql_create_wdigets = $sql_create_wdigets.$selectedwidgets[$i]."=1,";
  87. }
  88. $sql_create_wdigets = substr($sql_create_wdigets, 0, -1);
  89. echo $sql_create_wdigets;
  90. $res_create_wdigets = mysql_query($sql_create_wdigets, $con);
  91. $new_widgetsID= mysql_insert_id();
  92. echo "Record created in the widgets table with id: ".$new_widgetsID."<br>";
  93. $sql_create_user = "INSERT INTO sp_partner_info SET partner_company_sid ='".$new_companyID."', partner_code='0', partner_login_account='".
  94. $_REQUEST['user1loginid']."', partner_login_password='".$_REQUEST['user1password']."', partner_contact_name='".$_REQUEST['user1name']."', partner_create_time='".date("Y-m-d H:i:s")."'";
  95. $res_create_user = mysql_query($sql_create_user, $con);
  96. $new_userID= mysql_insert_id();
  97. echo "<br>".$sql_create_user."<br>";
  98. echo "Record created in the users table with id: ".$new_userID."<br>";
  99. ?>
  100. <br><br><br>
  101. </article>
  102. </section>
  103. <section id="sidebar">
  104. <h2>Testimonials</h2>
  105. <article class="testimonials">
  106. <blockquote>
  107. <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer egestas purus bibendum neque aliquam ut posuere elit semper. Fusce sagittis pharetra eros, sit amet consequat sem mollis vitae. </p>
  108. <cite>John Doe, New York City</cite>
  109. </blockquote>
  110. </article>
  111. </section>
  112. <div class="clear"></div>
  113. </section>
  114. </div>
  115. </section>
  116. </div>
  117. <footer id="pagefooter">
  118. <div id="bottom">
  119. <div class="block1">
  120. <h2>Meet The Team</h2>
  121. <div class="teamimg">
  122. <? include("../editor/team.php")?>
  123. <!--<div class="imgthmb"><img src="../images/team5.jpg" width="65" height="65" alt="team"></div>
  124. <div class="imgthmb"><img src="../images/team1.jpg" width="65" height="65" alt="team"></div>
  125. <div class="imgthmb"><img src="../images/team2.jpg" width="65" height="65" alt="team"></div>
  126. <div class="imgthmb"><img src="../images/team4.jpg" width="65" height="65" alt="team"></div>
  127. <div class="imgthmb"><img src="../images/team2.jpg" width="65" height="65" alt="team"></div>
  128. <div class="imgthmb"><img src="../images/team1.jpg" width="65" height="65" alt="team"></div>-->
  129. </div>
  130. </div>
  131. <div class="block2">
  132. <h2>Latest Project</h2>
  133. <div class="projectthmb"><? include("../editor/latestproject.php")?> <!--<a href="../portfolio"><img src="../images/latstproject.jpg" width="240" height="150" alt="project"></a>--></div>
  134. </div>
  135. <div class="block3">
  136. <h2>More About</h2>
  137. <p>3 Tier Logic is a full service digital marketing and technology services company that enables organizations to grow their customer and prospect communities through anywhere-anytime communications. </p>
  138. </div>
  139. <div class="clear"></div>
  140. </div>
  141. <div id="credits">
  142. <p>
  143. <span class="copyright">&copy; 2012 | 3 Tier Logic Inc | All Rights Reserved </span>
  144. <span id="designcredit">Powered by <a href="http://www.3tierlogic.com" title="Powered by 3 Tier Logic Inc" target="_blank">3 Tier Logic Inc.</a></span>
  145. </p>
  146. </div>
  147. </footer>
  148. </section>
  149. </body>
  150. </html>