Browse Source

Add extra scripts

master
Chris Smith 13 years ago
parent
commit
415764575f
100 changed files with 1296 additions and 0 deletions
  1. 33
    0
      common/messagemail.php
  2. 84
    0
      common/tac-old.txt
  3. 84
    0
      common/tac.txt
  4. 11
    0
      common/test.php
  5. 66
    0
      common/ticketmail.php
  6. 21
    0
      scripts/analyselog.php
  7. 96
    0
      scripts/bandwidth.php
  8. 118
    0
      scripts/billing.php
  9. 12
    0
      scripts/build-support-db.php
  10. 14
    0
      scripts/cplogs.php
  11. 46
    0
      scripts/emailconfig.php
  12. 20
    0
      scripts/get-support-article.php
  13. 59
    0
      scripts/redflag.php
  14. 38
    0
      scripts/resetstats.php
  15. 22
    0
      scripts/stats.php
  16. 28
    0
      scripts/tacmail.php
  17. 33
    0
      scripts/tickets.php
  18. 5
    0
      scripts/updateconf.php
  19. 5
    0
      signup/.htaccess
  20. 32
    0
      signup/1.php
  21. 9
    0
      signup/2.php
  22. 136
    0
      signup/2new.php
  23. 46
    0
      signup/2old.php
  24. 42
    0
      signup/3.php
  25. 81
    0
      signup/4.php
  26. 34
    0
      signup/5.php
  27. 14
    0
      signup/inc/sessions.php
  28. 107
    0
      signup/index.php
  29. BIN
      signup/res/1a.png
  30. BIN
      signup/res/1b.png
  31. BIN
      signup/res/1c.png
  32. BIN
      signup/res/2a.png
  33. BIN
      signup/res/2b.png
  34. BIN
      signup/res/2c.png
  35. 0
    0
      www/.htaccess
  36. 0
    0
      www/403.php
  37. 0
    0
      www/account.php
  38. 0
    0
      www/addsite.php
  39. 0
    0
      www/admin.menu.php
  40. 0
    0
      www/admin.php
  41. 0
    0
      www/adminannouncements.php
  42. 0
    0
      www/adminbans.php
  43. 0
    0
      www/adminbw.php
  44. 0
    0
      www/admindiscounts.php
  45. 0
    0
      www/admindomains.php
  46. 0
    0
      www/adminfinances.php
  47. 0
    0
      www/admininvoices.php
  48. 0
    0
      www/adminreports.php
  49. 0
    0
      www/adminsites.php
  50. 0
    0
      www/admintickets.php
  51. 0
    0
      www/adminusers.php
  52. 0
    0
      www/alltickets.php
  53. 0
    0
      www/bandwidth.php
  54. 0
    0
      www/bans.php
  55. 0
    0
      www/billing.php
  56. 0
    0
      www/billingref.php
  57. 0
    0
      www/changepass.php
  58. 0
    0
      www/checkuser.php
  59. 0
    0
      www/database.php
  60. 0
    0
      www/discount.php
  61. 0
    0
      www/discounts.php
  62. 0
    0
      www/domains.php
  63. 0
    0
      www/doticket.php
  64. 0
    0
      www/doticketreply.php
  65. 0
    0
      www/editpref.php
  66. 0
    0
      www/editsite.php
  67. 0
    0
      www/email.php
  68. 0
    0
      www/enabledomain.php
  69. 0
    0
      www/ext/pie.php
  70. 0
    0
      www/fileman.php
  71. 0
    0
      www/history.php
  72. 0
    0
      www/index.php
  73. 0
    0
      www/invoices.php
  74. 0
    0
      www/ipn.php
  75. 0
    0
      www/lib/account.php
  76. 0
    0
      www/lib/bandwidth.php
  77. 0
    0
      www/lib/common.php
  78. 0
    0
      www/lib/dashboard.php
  79. 0
    0
      www/lib/database.php
  80. 0
    0
      www/lib/footer.php
  81. 0
    0
      www/lib/header.php
  82. 0
    0
      www/lib/log.php
  83. 0
    0
      www/lib/profiler.php
  84. 0
    0
      www/login.php
  85. 0
    0
      www/logout.php
  86. 0
    0
      www/pages/adddomain.php
  87. 0
    0
      www/pages/addemail.php
  88. 0
    0
      www/pages/addmailbox.php
  89. 0
    0
      www/pages/addsite.php
  90. 0
    0
      www/pages/admin.actions.php
  91. 0
    0
      www/pages/admin.addannouncement.php
  92. 0
    0
      www/pages/admin.adddiscount.php
  93. 0
    0
      www/pages/admin.addfinances.php
  94. 0
    0
      www/pages/admin.addipban.php
  95. 0
    0
      www/pages/admin.announcements.php
  96. 0
    0
      www/pages/admin.discounts.php
  97. 0
    0
      www/pages/admin.domains.php
  98. 0
    0
      www/pages/admin.finances.php
  99. 0
    0
      www/pages/admin.invoices.php
  100. 0
    0
      www/pages/admin.ipbans.php

+ 33
- 0
common/messagemail.php View File

@@ -0,0 +1,33 @@
1
+<?PHP
2
+
3
+ function messagemail ($message) {
4
+  $sql  = 'SELECT message_id, message_title, message_time, message_body, ';
5
+  $sql .= 'message_type FROM messages WHERE message_id = '.$message;
6
+  
7
+  $res = mysql_query($sql);
8
+  $row = mysql_fetch_array($res);
9
+
10
+  $sql  = 'SELECT user_email FROM users WHERE mail_announce = 1';
11
+  if ($row['message_type'] == 'admin') {
12
+   $sql .= ' AND user_admin = 1';
13
+  }
14
+  
15
+  $res = mysql_query($sql);
16
+  
17
+  while ($usr = mysql_fetch_array($res)) { 
18
+   $to = $usr['user_email'];
19
+   $subject = 'UTD-Hosting announcement: '.$row['message_title'];
20
+   $body  = 'This is an automated message. A new UTD-Hosting announcement ';
21
+   $body .= 'has been posted. The announcement is displayed below for your ';
22
+   $body .= 'convenience. To opt out of these messages, please log into the ';
23
+   $body .= 'control panel at https://secure.utd-hosting.com/control/ and ';
24
+   $body .= 'select the "User preferences" link.'."\n\n";
25
+   $body .= ' ============ '.$row['message_title'].' ============';
26
+   $body .= "\n\n".$row['message_body']."\n\n";
27
+   $body .= ' ============ End of message ========= '."\n\n";
28
+   $body .= "\n\n-- UTD-Hosting support";
29
+   mail($to, $subject, $body, 'From: support@utd-hosting.com (UTD-Hosting support)'); 
30
+  }
31
+ }
32
+
33
+?>

+ 84
- 0
common/tac-old.txt View File

@@ -0,0 +1,84 @@
1
+0003
2
+<h3>1. Billing</h3>
3
+
4
+<h4>1.1 General billing information</h4>
5
+
6
+<p>Payment for UTD-Hosting services must be made in advance. All services last for one year (365 days) unless otherwise stated. At the end of the one year period, if payment has not been made to continue services, all services provided for the user will cease.
7
+</p>
8
+<h4>1.2 Payment handling</h4>
9
+
10
+<p>All payments made to UTD-Hosting are handled by <a href="http://www.paypal.com/" class="external">Paypal</a>, and are therefore subject to their <a href="https://www.paypal.com/uk/cgi-bin/webscr?cmd=p/gen/ua/ua-outside" class="external">user agreement</a>. Payments made to UTD-Hosting will only be accepted once they have been fully cleared by Paypal.
11
+
12
+</p>
13
+<h4>1.3 Refunds</h4>
14
+
15
+<p>All payments to UTD-Hosting are final. In the case of account termination, either initiated by the user or initiated by UTD-Hosting, any prepaid service will be forfeited.
16
+</p>
17
+<h4>1.4 Account ownership</h4>
18
+<p>
19
+All accounts are owned soley by the user who registered the account, or the user who made contact with UTD-Hosting staff in order to have the account created. Accounts may not be transferred to any other party. UTD-Hosting services may not be resold to any third party or any other user. 
20
+</p>
21
+<h3>2. Disclosure of information</h3>
22
+
23
+<h4>2.1 General</h4>
24
+
25
+<p>While UTD-Hosting strives to maintain the privacy and integrity of all data stored by the user, we cannot guarantee either. Users should avoid transferring or storing sensitive or private information using the services provided by UTD-Hosting. Users should make regular backups of any data hosted for them on UTD-Hosting services to avoid loss of data in case of a hardware or software error.
26
+</p>
27
+<h4>2.2 Disclosure to law enforcement agencies</h4>
28
+
29
+<p>UTD-Hosting may disclose any information pertaining to any services used by any user to any law enforcement agent who formally requests such information in writing. In such a circumstance, the user will not be notified of such a request, or UTD-Hosting's response.
30
+</p>
31
+
32
+<h4>2.3 Monitoring of user actions and data</h4>
33
+
34
+<p>UTD-Hosting may monitor any and all actions performed by the user, including but not limited to files uploaded via FTP, e-mails sent and received via UTD-Hosting servers, commands and programs executed by users with SSH access, and files requested via HTTP. In addition, UTD-Hosting may inspect any file, database or e-mail stored on UTD-Hosting servers, if there is suspicion that the user may be in violation of this agreement.</p> 
35
+
36
+<h3>3. Use of UTD-Hosting services</h3>
37
+
38
+<h4>3.1 Unacceptable uses</h4>
39
+
40
+<p>UTD-Hosting services may <span class="bold">not</span> be used for:
41
+</p>
42
+<ul><li> Organising or participating in illegal activity</li>
43
+<li> Distributing copyrighted material without the correct permission</li>
44
+
45
+<li> Distributing viruses, trojans or other malware</li>
46
+<li> Sending unsolicited or excessive commercial e-mail</li>
47
+<li> Attempting to gain illegal access to any service, server or computer, whether related to UTD-Hosting or not</li>
48
+</ul>
49
+<p>In addition, the following are forbidden:
50
+</p>
51
+<ul><li> Any script, program or other file that causes disruption to UTD-Hosting systems</li>
52
+<li> Attempting to gain illict access to any UTD-Hosting services</li>
53
+
54
+<li> Attempting to gain access to any files or data hosted on UTD-Hosting systems that has not been directly uploaded or created by the user.</li>
55
+</ul>
56
+<h3>4. Account cancellation</h3>
57
+
58
+<h4>4.1 Cancellation and notification</h4>
59
+
60
+<p>UTD-Hosting reserves the right to terminate any account at any time, for any of the reasons outlined in section 4.2, or, in exceptional circumstances, for any reason deemed appropriate by UTD-Hosting staff. Any payment made in advance for services from UTD-Hosting will be forfeited if an account is cancelled. Upon account cancellation, an e-mail will be sent to the account holder's address.
61
+</p>
62
+<h4>4.2 Reasons for cancellation</h4>
63
+
64
+<p>Accounts may be cancelled by UTD-Hosting without prior warning, as per condition 4.1, for the following reasons:
65
+</p>
66
+
67
+<ul><li> Lack of payment</li>
68
+<li> Any unacceptable use (as defined in section 3.1) of any service(s) provided by UTD-Hosting</li>
69
+</ul>
70
+<h4>4.3 Data availability following cancellation</h4>
71
+
72
+<p>If an account is cancelled due to lack of payment, or following a request for cancellation by the account holder, the following data will be made available for download by the account holder for seven days after the cancellation of the account:
73
+</p>
74
+<ul><li> Contents of any MySQL databases associated with the account</li>
75
+<li> Any unread e-mail messages</li>
76
+
77
+<li> All files stored within the account's 'home' directory</li>
78
+</ul>
79
+<p>Accounts cancelled by UTD-Hosting without consultation with the account holder, excluding accounts cancelled as a result of non-payment, are excempt from this clause. Data held for these accounts will be removed from UTD-Hosting systems within fourty-eight hours of account cancellation.
80
+</p>
81
+<h3>5. Future updates</h3>
82
+
83
+<p>These terms and conditions may be updated at any time. Users will be notified of changes when they log in to the UTD-Hosting control panel. Users will be bound to any new set of Terms and Conditions one week after they are issued.
84
+</p>

+ 84
- 0
common/tac.txt View File

@@ -0,0 +1,84 @@
1
+0004
2
+<h3>1. Billing</h3>
3
+
4
+<h4>1.1 General billing information</h4>
5
+
6
+<p>Payment for UTD-Hosting services must be made in advance. All services last for one year (365 days) unless otherwise stated. At the end of the one year period, if payment has not been made to continue services, all services provided for the user will cease.
7
+</p>
8
+<h4>1.2 Payment handling</h4>
9
+
10
+<p>All payments made to UTD-Hosting are handled by <a href="http://www.paypal.com/" class="external">Paypal</a>, and are therefore subject to their <a href="https://www.paypal.com/uk/cgi-bin/webscr?cmd=p/gen/ua/ua-outside" class="external">user agreement</a>. Payments made to UTD-Hosting will only be accepted once they have been fully cleared by Paypal.
11
+
12
+</p>
13
+<h4>1.3 Refunds</h4>
14
+
15
+<p>All payments to UTD-Hosting are final. In the case of account termination, either initiated by the user or initiated by UTD-Hosting, any prepaid service will be forfeited.
16
+</p>
17
+<h4>1.4 Account ownership</h4>
18
+<p>
19
+All accounts are owned soley by the user who registered the account, or the user who made contact with UTD-Hosting staff in order to have the account created. Accounts may not be transferred to any other party. UTD-Hosting services may not be resold to any third party or any other user. 
20
+</p>
21
+<h3>2. Disclosure of information</h3>
22
+
23
+<h4>2.1 General</h4>
24
+
25
+<p>While UTD-Hosting strives to maintain the privacy and integrity of all data stored by the user, we cannot guarantee either. Users should avoid transferring or storing sensitive or private information using the services provided by UTD-Hosting. Users should make regular backups of any data hosted for them on UTD-Hosting services to avoid loss of data in case of a hardware or software error.
26
+</p>
27
+<h4>2.2 Disclosure to law enforcement agencies</h4>
28
+
29
+<p>UTD-Hosting may disclose any information pertaining to any services used by any user to any law enforcement agent who formally requests such information in writing. In such a circumstance, the user will not be notified of such a request, or UTD-Hosting's response.
30
+</p>
31
+
32
+<h4>2.3 Monitoring of user actions and data</h4>
33
+
34
+<p>UTD-Hosting may monitor any and all actions performed by the user, including but not limited to files uploaded via FTP, e-mails sent and received via UTD-Hosting servers, commands and programs executed by users with SSH access, and files requested via HTTP. In addition, UTD-Hosting may inspect any file, database or e-mail stored on UTD-Hosting servers, if there is suspicion that the user may be in violation of this agreement.</p> 
35
+
36
+<h3>3. Use of UTD-Hosting services</h3>
37
+
38
+<h4>3.1 Unacceptable uses</h4>
39
+
40
+<p>UTD-Hosting services may <span class="bold">not</span> be used for:
41
+</p>
42
+<ul><li> Organising or participating in illegal activity</li>
43
+<li> Distributing copyrighted material without the correct permission</li>
44
+
45
+<li> Distributing viruses, trojans or other malware</li>
46
+<li> Sending unsolicited or excessive commercial e-mail</li>
47
+<li> Attempting to gain illegal access to any service, server or computer, whether related to UTD-Hosting or not</li>
48
+</ul>
49
+<p>In addition, the following are forbidden:
50
+</p>
51
+<ul><li> Any script, program or other file that causes disruption to UTD-Hosting systems</li>
52
+<li> Attempting to gain illict access to any UTD-Hosting services</li>
53
+
54
+<li> Attempting to gain access to any files or data hosted on UTD-Hosting systems that has not been directly uploaded or created by the user.</li>
55
+</ul>
56
+<h3>4. Account cancellation</h3>
57
+
58
+<h4>4.1 Cancellation and notification</h4>
59
+
60
+<p>UTD-Hosting reserves the right to terminate any account at any time, for any of the reasons outlined in section 4.2, or, in exceptional circumstances, for any reason deemed appropriate by UTD-Hosting staff. Any payment made in advance for services from UTD-Hosting will be forfeited if an account is cancelled. Upon account cancellation, an e-mail will be sent to the account holder's address.
61
+</p>
62
+<h4>4.2 Reasons for cancellation</h4>
63
+
64
+<p>Accounts may be cancelled by UTD-Hosting without prior warning, as per condition 4.1, for the following reasons:
65
+</p>
66
+
67
+<ul><li> Lack of payment</li>
68
+<li> Any unacceptable use (as defined in section 3.1) of any service(s) provided by UTD-Hosting</li>
69
+</ul>
70
+<h4>4.3 Data availability following cancellation</h4>
71
+
72
+<p>If an account is cancelled due to lack of payment, or following a request for cancellation by the account holder, the following data will be made available for download by the account holder for seven days after the cancellation of the account:
73
+</p>
74
+<ul><li> Contents of any MySQL databases associated with the account</li>
75
+<li> Any unread e-mail messages</li>
76
+
77
+<li> All files stored within the account's 'home' directory</li>
78
+</ul>
79
+<p>Accounts cancelled by UTD-Hosting without consultation with the account holder, excluding accounts cancelled as a result of non-payment, are excempt from this clause. Data held for these accounts will be removed from UTD-Hosting systems within fourty-eight hours of account cancellation.
80
+</p>
81
+<h3>5. Future updates</h3>
82
+
83
+<p>These terms and conditions may be updated at any time. Users will be notified via their registered e-mail address when the terms and conditions have been updated. There will then be a two week period during which users should contact UTD-Hosting support at support@utd-hosting.com if they do not agree with the revised conditions. If, after two weeks, UTD-Hosting has not been contacted with objections, it will be assumed that the user agrees to the new conditions and they will become binding. 
84
+</p>

+ 11
- 0
common/test.php View File

@@ -0,0 +1,11 @@
1
+<?PHP
2
+
3
+chdir('../control');
4
+
5
+require_once('lib/database.php');
6
+
7
+require_once('../common/messagemail.php');
8
+
9
+messagemail(8);
10
+
11
+?>

+ 66
- 0
common/ticketmail.php View File

@@ -0,0 +1,66 @@
1
+<?PHP
2
+
3
+ function ticketmail ($ticket) {
4
+  $sql  = 'SELECT t.ticket_thread, u.user_name, t.ticket_body FROM tickets AS';
5
+  $sql .= ' t, users AS u WHERE t.ticket_id = '.$ticket.' AND u.user_id = ';
6
+  $sql .= 't.user_id';
7
+  
8
+  $res = mysql_query($sql);
9
+  $row = mysql_fetch_array($res);
10
+
11
+  $sql  = 'SELECT u.user_email, u.mail_tickets, t.ticket_title FROM tickets AS';  $sql .= ' t, users AS u';
12
+  $sql .= ' WHERE t.ticket_id = '.$row['ticket_thread'].' AND u.user_id = ';
13
+  $sql .= ' t.user_id';
14
+  
15
+  $res = mysql_query($sql);
16
+  $usr = mysql_fetch_array($res);
17
+
18
+  if ($usr['mail_tickets'] == '1') {
19
+   $to = $usr['user_email'];
20
+   $subject = 'UTD-Hosting ticket: '.$usr['ticket_title'];
21
+   $body  = 'This is an automated message. A reply has been made to one of';
22
+   $body .= ' your tickets. A full copy of the message follows. ';
23
+   $body .= 'You can view the entire thread and make replies at';
24
+   $body .= ' https://secure.utd-hosting.com/control/viewticket/'.$row['ticket_thread'];
25
+   $body .= ' and unsubscribe from these updates at ';
26
+   $body .= 'https://secure.utd-hosting.com/control/prefs.'."\n\n";
27
+   $body .= ' ============ Message from '.$row['user_name'].' ============';
28
+   $body .= "\n\n".$row['ticket_body']."\n\n";
29
+   $body .= ' ============ End of message ========= '."\n\n";
30
+   $body .= "Please do not ";
31
+   $body .= 'reply to this e-mail -- use the reply form at the URL above. ';
32
+   $body .= "\n\n-- UTD-Hosting support";
33
+   mail($to, $subject, $body, 'From: support@utd-hosting.com (UTD-Hosting support)'); 
34
+  }
35
+ }
36
+
37
+ function adminTicketMail($ticket) {
38
+  $sql  = 'SELECT t.ticket_title, t.ticket_thread, u.user_name, t.ticket_body FROM tickets AS';
39
+  $sql .= ' t, users AS u WHERE t.ticket_id = '.$ticket.' AND u.user_id = ';
40
+  $sql .= 't.user_id';
41
+
42
+  $res = mysql_query($sql);
43
+  $row = mysql_fetch_array($res);
44
+
45
+  $sql = 'SELECT user_email FROM users WHERE user_admin = 1';
46
+
47
+  $res = mysql_query($sql);
48
+
49
+  while ($usr = mysql_fetch_array($res)) {
50
+   $to = $usr['user_email'];
51
+   $subject = 'UTD-Hosting ticket: '.$row['ticket_title'];
52
+   $body  = 'This is an automated message. A new ticket has been posted. View it here: '; 
53
+   $body .= ' https://secure.utd-hosting.com/control/viewticket/'.$row['ticket_thread']."\n\n";
54
+   $body .= ' ============ Message from '.$row['user_name'].' ============';
55
+   $body .= "\n\n".$row['ticket_body']."\n\n";
56
+   $body .= ' ============ End of message ========= '."\n\n";
57
+   $body .= "Please do not ";
58
+   $body .= 'reply to this e-mail -- use the reply form at the URL above. ';
59
+   $body .= "\n\n-- UTD-Hosting support";
60
+   
61
+   mail($to, $subject, $body, 'From: support@utd-hosting.com (UTD-Hosting support)');
62
+  }
63
+
64
+ }
65
+
66
+?>

+ 21
- 0
scripts/analyselog.php View File

@@ -0,0 +1,21 @@
1
+#!/usr/bin/php -q
2
+<?PHP
3
+
4
+$log = 3;
5
+
6
+$log = str_pad($log, 3, '0', STR_PAD_LEFT);
7
+
8
+$fh = fopen('/usr/local/apache/logs/'.$log.'-access_log','r');
9
+
10
+while (!feof($fh)) {
11
+ $line = trim(fgets($fh));
12
+ if (preg_match('/^.*?"[A-Z]+ (.*?) [^ ]*?" .* ([0-9]+)$/',$line,$m)) {
13
+  if ((int)$m[2] > 100000) {
14
+   echo $m[1]."\r\n";
15
+  }
16
+ } 
17
+}
18
+
19
+fclose($fh);
20
+
21
+?>

+ 96
- 0
scripts/bandwidth.php View File

@@ -0,0 +1,96 @@
1
+#!/usr/local/php-stable/bin/php -q
2
+<?PHP
3
+
4
+ foreach ($argv as $v) {
5
+  if ($v == '--force-update') {
6
+   echo 'Forcing config update.'."\n";
7
+   define('UPDATE', true);
8
+  } elseif ($v == '--debug') {
9
+   echo 'Debug mode enabled.'."\n";
10
+   define('DEBUG', true);
11
+  } elseif ($v == '--double-debug') {
12
+   echo 'Double debug mode enabled.'."\n";
13
+   define('DOUBLEDEBUG', true);
14
+  }
15
+ }
16
+
17
+ chdir('/home/utd/control');
18
+ require_once('lib/database.php');
19
+ require_once('lib/common.php');
20
+ require_once('lib/log.php');
21
+ chdir('/home/utd/scripts');
22
+
23
+ $sql  = 'SELECT site_bandin, site_bandout, site_logpos';
24
+ $sql .= ', site_id, user_id FROM sites';
25
+
26
+ $res = mysql_query($sql);
27
+
28
+ $users = array();
29
+
30
+ while ($row = mysql_fetch_array($res)) {
31
+  if (defined('DEBUG')) { echo "Checking site ".$row['site_id']."\n"; }
32
+  $number = str_pad($row['site_id'], 3, '0', STR_PAD_LEFT);
33
+
34
+  if (file_exists('/usr/local/apache/logs/'.$number.'-access_log')) {
35
+   $access = fopen('/usr/local/apache/logs/'.$number.'-access_log','r');
36
+   if (defined('DEBUG')) { echo 'Opening /usr/local/apache/logs/'.$number.'-access_log for reading.'."\n"; }
37
+   fseek($access, (float)$row['site_logpos']);
38
+   while (!feof($access)) {
39
+    $line = trim(fgets($access));
40
+    if (defined('DOUBLEDEBUG') && $line != '') { echo "Read: $line\n"; }
41
+    if (preg_match('/^.* ([0-9]+) ([0-9]+)$/', $line, $matches)) {
42
+     list( , $in, $out) = $matches;
43
+     $row['site_bandin'] += (float)$in;
44
+     $row['site_bandout'] += (float)$out; 
45
+    } elseif (trim($line) != '') {
46
+     if (defined('DEBUG')) { echo "Unrecognised line: $line\n"; }
47
+    } 
48
+   }
49
+   $pos = ftell($access); fclose($access);
50
+  } else {
51
+   $pos = $row['site_logpos'];
52
+  }
53
+
54
+  if (!isset($users[($row['user_id'])])) { $users[($row['user_id'])] = 0; }
55
+  $users[($row['user_id'])] += $row['site_bandin'] + $row['site_bandout'];
56
+
57
+  if ($pos > 1024*1024*10) {
58
+   logger::log('Archiving /usr/local/apache/logs/'.$number.'-access_log (>10M)', logger::information);
59
+   $dir = '/usr/local/apache/logs/archived/'.$number;
60
+   if (!is_dir($dir)) {
61
+    mkdir($dir);
62
+    chown($dir, 'admin');
63
+    chmod($dir, 0700);
64
+   }
65
+   $count = count(glob($dir.'/*.log'))+1;
66
+   $target = $dir.'/'.str_pad($count,5,'0',STR_PAD_LEFT).'.log';
67
+   $pos = 0;
68
+   rename('/usr/local/apache/logs/'.$number.'-access_log', $target);
69
+  }
70
+
71
+  $sql  = 'UPDATE sites SET site_bandin = '.$row['site_bandin'];
72
+  $sql .= ', site_bandout = '.$row['site_bandout'];
73
+  $sql .= ', site_logpos = '.$pos.' WHERE site_id = ';
74
+  $sql .= $row['site_id'];
75
+
76
+  mysql_query($sql);
77
+ }
78
+
79
+ foreach ($users as $key => $val) {
80
+  mysql_query('UPDATE users SET band_used = '.$val.' WHERE user_id = '.$key);
81
+  if (defined('DEBUG')) { echo "User $key has used $val Bytes.\n"; }
82
+ }
83
+
84
+ $sql  = "UPDATE sites SET site_curdocroot = site_docroot WHERE ";
85
+ $sql .= "site_curdocroot = '/usr/local/apache/htdocs/bandquota'";
86
+ mysql_query($sql);
87
+
88
+ $sql  = "UPDATE users AS u, sites AS s SET s.site_curdocroot = ";
89
+ $sql .= "'/usr/local/apache/htdocs/bandquota' WHERE s.user_id = u.user_id AND ";
90
+ $sql .= "u.band_used > u.band_total";
91
+
92
+ mysql_query($sql);
93
+
94
+ require('updateconf.php'); 
95
+
96
+?>

+ 118
- 0
scripts/billing.php View File

@@ -0,0 +1,118 @@
1
+#!/usr/bin/php -q
2
+<?PHP
3
+
4
+ chdir('/home/utd/control');
5
+ require_once('lib/database.php');
6
+ require_once('lib/log.php');
7
+ require_once('lib/common.php');
8
+ chdir('/home/utd/scripts');
9
+
10
+ // First off, let's disable anything that's not been paid
11
+ $sql  = 'SELECT user_id, user_email, package_name, up_expires, up_cost, ';
12
+ $sql .= 'up_id FROM userpackages NATURAL JOIN packages NATURAL JOIN ';
13
+ $sql .= 'users WHERE up_active = 1 AND up_expires < '.time();
14
+
15
+ $res  = mysql_query($sql);
16
+
17
+ while ($row = mysql_fetch_array($res)) {
18
+  $user = $row['user_id'];
19
+  $addr = $row['user_email'];
20
+  $name = $row['package_name'];
21
+  $date = $row['up_expires'];
22
+  $upid = $row['up_id'];
23
+  $cost = $row['up_cost'];
24
+  
25
+  $subj  = 'UTD-Hosting package cancellation: '.$name;
26
+  $body  = 'This is an automatic notifcation. The "'.$name.'" package has now ';
27
+  $body .= 'been disabled on your account. You will no longer have access to ';
28
+  $body .= 'services provided as a part of this package. If you have no other ';
29
+  $body .= 'active packages, your account will be automatically closed within ';
30
+  $body .= '14 days.'."\n\n".'If you wish to retrieve data stored in your ';
31
+  $body .= 'account, or wish to renew a package, or have any enquiries about ';
32
+  $body .= 'this message, please e-mail support@utd-hosting.com.'."\n\n";
33
+  $body .= ' -- UTD-Hosting support';
34
+  $head  = 'From: UTD-Hosting support <support@utd-hosting.com>';
35
+ 
36
+  mail($addr, $subj, $body, $head); 
37
+
38
+  $sql = 'UPDATE userpackages SET up_active = 0 WHERE up_id = '.$upid;
39
+
40
+  mysql_query($sql);
41
+
42
+  logger::log("Package '$name' cancelled (no payment)", $user, logger::info);
43
+ }
44
+
45
+ // Now select anything that's outstanding and doesn't have an invoice
46
+ $inv  = array();
47
+
48
+ $sql  = 'SELECT up_id, package_id, user_id, up_expires, up_cost FROM ';
49
+ $sql .= 'userpackages WHERE up_invoice = 1 AND up_active = 1 AND up_expires ';
50
+ $sql .= '< '.strtotime('+1 month');
51
+ $res  = mysql_query($sql) or print(mysql_error()."\n".$sql);
52
+
53
+ while ($row = mysql_fetch_assoc($res)) {
54
+  $sql  = 'SELECT bill_id FROM billitems NATURAL JOIN bills WHERE user_id = ';
55
+  $sql .= $row['user_id'].' AND up_id = '.$row['up_id'].' AND bill_paid = 0';
56
+  $re2  = mysql_query($sql);
57
+  
58
+  if (mysql_num_rows($re2) > 0) {
59
+   continue;
60
+  }
61
+
62
+  if (!isset($inv[$row['user_id']])) {
63
+   $inv[$row['user_id']] = array();
64
+  }
65
+
66
+  $inv[$row['user_id']][] = array($row['up_id'], $row['up_cost']);
67
+ }
68
+
69
+ // And now iterate through any invoices we need to make
70
+ foreach ($inv as $user => $items) {
71
+  $sql  = 'SELECT user_email FROM users WHERE user_id = '.$user;
72
+  $res  = mysql_query($sql);
73
+  $row  = mysql_fetch_assoc($res);
74
+ 
75
+  $tot  = 0;
76
+
77
+  foreach ($items as $data) {
78
+   $tot += $data[1];
79
+  }
80
+
81
+  // Add it to the db
82
+  $sql  = 'INSERT INTO bills (user_id, bill_due, bill_generated, bill_total) ';
83
+  $sql .= 'VALUES ('.$user.', '.strtotime('+1 month').', '.time().', '.$tot.')';
84
+  $res  = mysql_query($sql);
85
+  $bil  = mysql_insert_id();
86
+
87
+  // And the items
88
+  foreach ($items as $data) {
89
+   list($pid, $cst) = $data;
90
+
91
+   $sql  = 'INSERT INTO billitems (bill_id, up_id, bi_cost) VALUES ('.$bil.', ';
92
+   $sql .= $pid.', '.$cst.')';
93
+   $res  = mysql_query($sql);
94
+  }
95
+
96
+  $tot  = sprintf('%01.2f', $tot/100);
97
+  $pkg  = count($items).' package'.(count($items) != 1 ? 's' : '');
98
+
99
+  // And send them mail
100
+  $to   = $row['user_email'];
101
+  $subj = 'UTD-Hosting invoice notification';
102
+  $msg  = 'This is an automatic notification. An invoice for £'.$tot.' has ';
103
+  $msg .= 'been issued to you. This is for the extension of '.$pkg.' due to ';
104
+  $msg .= 'expire within the next month.'."\n\n";
105
+  $msg .= 'You may view and pay this invoice via the UTD-Hosting control panel';
106
+  $msg .= ' at the following address: https://secure.utd-hosting.com/control/';
107
+  $msg .= 'viewinvoice/'.$bil.' or you can log in normally and follow the ';
108
+  $msg .= '"My Invoices" link in the main menu.'."\n\n";
109
+  $msg .= 'If you have any queries about this invoice, please contact ';
110
+  $msg .= 'sales@utd-hosting.com.'."\n\n".' -- UTD-Hosting';
111
+  $head = 'From: UTD-Hosting accounts <sales@utd-hosting.com>';
112
+
113
+  mail($to, $subj, $msg, $head); 
114
+
115
+  logger::log("Bill issued for £$tot", $user, logger::normal);
116
+ }
117
+  
118
+?>

+ 12
- 0
scripts/build-support-db.php View File

@@ -0,0 +1,12 @@
1
+#!/usr/bin/php -q
2
+<?PHP
3
+
4
+ chdir('/home/utd/control/sup');
5
+ $files = glob('*.php');
6
+ chdir('/home/utd/scripts');
7
+ foreach ($files as $file) {
8
+  if ((int)$file != 0 || (int)$file > 900) {
9
+   system('./get-support-article.php '.substr($file,0,3));
10
+  }
11
+ }
12
+?>

+ 14
- 0
scripts/cplogs.php View File

@@ -0,0 +1,14 @@
1
+#!/usr/bin/php -q
2
+<?php
3
+  mysql_connect('localhost', 'admin', 'admin7521');
4
+  mysql_select_db('admin');
5
+  $message = 'Time'."\t\t\t\t\t".'User                '."\t".'Level     '."\t".'Message'."\r\n";
6
+  $message .= '----'."\t\t\t\t\t".'----               '."\t".'----     '."\t".'----'."\r\r";
7
+  $sql  = 'SELECT user_name, log_level, log_time, log_message FROM log ';
8
+  $sql .= 'NATURAL JOIN users WHERE log_time > UNIX_TIMESTAMP()-86400';
9
+  $res = mysql_query($sql);
10
+  while ($row = mysql_fetch_array($res)) {
11
+    $message .= date('r', $row['log_time'])."\t\t".str_pad($row['user_name'],20)."\t".str_pad($row['log_level'], 10)."\t".$row['log_message']."\r\r";
12
+  }
13
+  echo $message;
14
+?>

+ 46
- 0
scripts/emailconfig.php View File

@@ -0,0 +1,46 @@
1
+#!/usr/bin/php -q
2
+<?PHP
3
+
4
+ chdir('/home/utd/control');
5
+ require_once('lib/database.php');
6
+ 
7
+ // Build the vmaildomains file
8
+ $fh = fopen('/etc/postfix/vmaildomains','w');
9
+ $sql = 'SELECT DISTINCT(domain_name) FROM email NATURAL JOIN domains';
10
+ $res = mysql_query($sql);
11
+ while ($row = mysql_fetch_assoc($res)) {
12
+  fputs($fh, $row['domain_name']."\tplaceholder\n");
13
+ } 
14
+ fclose($fh);
15
+
16
+ // Build the vmailbox file
17
+ $fh = fopen('/etc/postfix/vmailbox','w');
18
+ $sql  = 'SELECT email_user, e.domain_name AS ed, mailbox_user, m.domain_name AS md FROM ';
19
+ $sql .= 'email, mailboxes, domains AS e, domains AS m WHERE mailboxes.mailbox_id = email.mailbox_id AND ';
20
+ $sql .= 'e.domain_id = email.domain_id AND m.domain_id = mailboxes.domain_id';
21
+ $res  = mysql_query($sql);
22
+ while ($row = mysql_fetch_assoc($res)) {
23
+  if ($row['email_user'] == '%') { $row['email_user'] = ''; }
24
+  fputs($fh,$row['email_user'].'@'.$row['ed']."\t".$row['md'].'/'.$row['mailbox_user']."\n");
25
+ }
26
+ fclose($fh);
27
+
28
+ // And write the password file
29
+ $sql = 'SELECT mailbox_user, mailbox_password, domain_name FROM mailboxes NATURAL JOIN domains';
30
+ $res = mysql_query($sql);
31
+ $fhs = array();
32
+ while ($row = mysql_fetch_array($res)) {
33
+  $dir = $row['domain_name'];
34
+  if (!is_dir('/etc/virtual/'.$dir)) {
35
+   mkdir('/etc/virtual/'.$dir);
36
+  }
37
+  if (!isset($fhs[$dir])) {
38
+   $fhs[$dir] = fopen('/etc/virtual/'.$dir.'/passwd','w');
39
+  }
40
+  fputs($fhs[$dir],$row['mailbox_user'].':'.$row['mailbox_password']."\n");
41
+ }
42
+ foreach ($fhs as $fh) { fclose($fh); }
43
+
44
+ $sql = 'INSERT INTO actions (action_type, action_value, user_id) VALUES (\'restart\', \'postfix\', 5)';
45
+ mysql_query($sql);
46
+?>

+ 20
- 0
scripts/get-support-article.php View File

@@ -0,0 +1,20 @@
1
+#!/usr/bin/php -q
2
+<?PHP
3
+
4
+ if (!ctype_digit($argv[1])) { die('Usage: ./get-support-article.php <id>'); }
5
+
6
+ chdir('/home/utd/control/');
7
+ define('NOLOGINREF', true);
8
+ require_once('lib/database.php');
9
+ require_once('lib/dashboard.php');
10
+ define('SUPPORT_INDEX', True);
11
+ 
12
+ $file = str_pad($argv[1],3,'0',STR_PAD_LEFT);
13
+
14
+ if (file_exists('sup/'.$file.'.php')) {
15
+  require_once('sup/'.$file.'.php');
16
+  file_put_contents('sup/search/'.$file.'.txt', SUPPORT_TITLE."\n\n".strip_tags(SUPPORT_BODY));
17
+ } else {
18
+  die('Support article not found');
19
+ }
20
+?>

+ 59
- 0
scripts/redflag.php View File

@@ -0,0 +1,59 @@
1
+#!/usr/bin/php -q
2
+<?PHP
3
+
4
+ chdir('/home/utd/control');
5
+ require_once('lib/common.php');
6
+ require_once('lib/database.php');
7
+ chdir('/home/utd/scripts');
8
+
9
+function sendToHost($host,$method,$path,$data,$useragent=0)
10
+{
11
+ // Supply a default method of GET if the one passed was empty
12
+ if (empty($method))
13
+  $method = 'GET';
14
+ $method = strtoupper($method);
15
+ $fp = fsockopen($host,80);
16
+ if ($method == 'GET')
17
+  $path .= '?' . $data;
18
+ fputs($fp, "$method $path HTTP/1.1\r\n");
19
+ fputs($fp, "Host: $host\r\n");
20
+ fputs($fp, "Content-Type: application/x-www-form-urlencoded\r\n");
21
+ if ($method == 'POST')
22
+  fputs($fp, "Content-length: " . strlen($data) . "\r\n");
23
+ if ($useragent)
24
+  fputs($fp, "User-Agent: MSIE\r\n");
25
+ fputs($fp, "Connection: close\r\n\r\n");
26
+ if ($method == 'POST')
27
+  fputs($fp, $data);
28
+
29
+ while (!feof($fp))
30
+  $buf .= fgets($fp,128);
31
+ fclose($fp);
32
+ return $buf;
33
+}
34
+
35
+ $sql = 'SELECT signup_id, signup_data FROM signups WHERE signup_checked = 0';
36
+ $res = mysql_query($sql) or print(mysql_error());
37
+ while ($row = mysql_fetch_array($res)) {
38
+  $data = unserialize($row['signup_data']);
39
+
40
+  $query = 'appid=MD87scripts&query='.urlencode($data['data']['phone']);
41
+  $query .= '&type=phrase&adult_ok=1&similar_ok=1&output=php';
42
+  $re = sendToHost('api.search.yahoo.com', 'get', '/WebSearchService/V1/webSearch',$query); 
43
+
44
+  if (preg_match('/"totalResultsAvailable";i:([0-9]+);/',$re, $m)) {
45
+   if ((int)$m[1] > 0) {
46
+    logger::log('Red flagged account '.$data['data']['user'],logger::important);
47
+    $sql = 'SELECT user_id FROM users WHERE user_name = \'';
48
+    $sql .= mysql_real_escape_string($data['data']['user']).'\'';
49
+    $re = mysql_query($sql);
50
+    $ro = mysql_fetch_array($re);
51
+    $sql = 'INSERT INTO actions (user_id, action_type) VALUES ('.$ro[0].', \'';
52
+    $sql .= 'lock\')';
53
+    mysql_query($sql);
54
+   } 
55
+  }
56
+  mysql_query('UPDATE signups SET signup_checked=1 WHERE signup_id = '.$row[0]);
57
+ }
58
+
59
+?>

+ 38
- 0
scripts/resetstats.php View File

@@ -0,0 +1,38 @@
1
+#!/usr/local/php-stable/bin/php -q
2
+<?PHP
3
+
4
+ foreach ($argv as $v) {
5
+  if ($v == '--debug') {
6
+   define('DEBUG', true);
7
+  }
8
+ }
9
+
10
+ mysql_connect('localhost', 'admin', 'admin7521');
11
+ mysql_select_db('admin');
12
+
13
+ $sql = 'SELECT user_id, user_limitstarts, user_limitends, band_used, hdd_used FROM users WHERE ';
14
+ $sql .= ' user_limitends < '.time();
15
+
16
+ $res = mysql_query($sql);
17
+
18
+ while ($row = mysql_fetch_array($res)) {
19
+  $sql = 'INSERT INTO historic_user (user_id, hu_start, hu_end, hu_hdd, hu_bw)';
20
+  $sql .= ' VALUES ('.$row['user_id'].', '.$row['user_limitstarts'].', ';
21
+  $sql .= time().', '.$row['hdd_used'].', '.$row['band_used'].')';
22
+
23
+  mysql_query($sql) or die(mysql_error());
24
+  
25
+  $sql = 'UPDATE users SET user_limitstarts = '.time().', user_limitends = ';
26
+  $sql .= (time() + 2629728).', band_used = 0 WHERE user_id = ';
27
+  $sql .= $row['user_id'];
28
+
29
+  mysql_query($sql) or die(mysql_error());
30
+
31
+  $sql = 'UPDATE sites SET site_bandin = 0, site_bandout = 0 WHERE user_id = ';
32
+  $sql .= $row['user_id'];
33
+
34
+  mysql_query($sql) or die(mysql_error());
35
+ 
36
+ }
37
+
38
+?>

+ 22
- 0
scripts/stats.php View File

@@ -0,0 +1,22 @@
1
+#!/usr/local/php-stable/bin/php -q
2
+<?PHP
3
+
4
+ mysql_connect('', '', '');
5
+ mysql_select_db('');
6
+
7
+ $sql = 'SELECT site_id, site_name FROM sites';
8
+ $res = mysql_query($sql);
9
+ while ($row = mysql_fetch_array($res)) {
10
+  $id = str_pad($row[0],3,'0',STR_PAD_LEFT);
11
+  if (!is_dir('/home/utd/stats/'.$id)) {
12
+   mkdir('/home/utd/stats/'.$id);
13
+  }
14
+  if (!file_exists('/usr/local/apache/logs/'.$id.'-access_log')) {
15
+   continue;
16
+  }
17
+  $row[1] = addslashes($row[1]);
18
+  system('/usr/local/bin/webalizer -o /home/utd/stats/'.$id.'/ -n \''.$row[1].'\' -t \''.$row[1].'\' -N 5 -D /home/utd/dnscache /usr/local/apache/logs/'.$id.'-access_log');
19
+ }
20
+
21
+
22
+?>

+ 28
- 0
scripts/tacmail.php View File

@@ -0,0 +1,28 @@
1
+#!/usr/bin/php -q
2
+<?PHP
3
+
4
+ chdir('/home/utd/control/');
5
+ require_once('lib/database.php');
6
+
7
+ function tacmail() {
8
+  $sql  = 'SELECT user_email FROM users';
9
+  
10
+  $res = mysql_query($sql);
11
+  
12
+  while ($usr = mysql_fetch_array($res)) { 
13
+   $to = $usr['user_email'];
14
+   $subject = 'UTD-Hosting terms and conditions update'; 
15
+   $body  = 'This is an automated message. The terms and conditions governing'; 
16
+   $body .= ' your UTD-Hosting account have been updated. Please review these';
17
+   $body .= ' changes by logging into the customer control panel, located at';
18
+   $body .= ' https://secure.utd-hosting.com/control/. If you do not agree to';
19
+   $body .= ' these new terms and conditions, please contact support@utd-hosting.com';
20
+   $body .= ' within two weeks.';
21
+   $body .= "\n\n-- UTD-Hosting support";
22
+   mail($to, $subject, $body, 'From: support@utd-hosting.com (UTD-Hosting support)'); 
23
+  }
24
+ }
25
+
26
+ tacmail();
27
+
28
+?>

+ 33
- 0
scripts/tickets.php View File

@@ -0,0 +1,33 @@
1
+#!/usr/local/php-stable/bin/php -q
2
+<?PHP
3
+
4
+ require('/home/utd/common/ticketmail.php');
5
+
6
+ mysql_connect('', '', '');
7
+ mysql_select_db('');
8
+
9
+ $sql  = 'SELECT ticket_id, user_id FROM tickets WHERE ticket_status = \'new\'';
10
+ $sql .= ' AND ticket_time <= '.(time()-60*60*24*3).' AND ticket_time > ';
11
+ $sql .= (time()-60*60*24*2); 
12
+
13
+ $res = mysql_query($sql);
14
+
15
+ while ($row = mysql_fetch_array($res)) {
16
+  $sql  = 'UPDATE billing SET bill_due = bill_due + 5356800 WHERE user_id = ';
17
+  $sql .= $row['user_id'].' AND bill_paid < 2';
18
+  mysql_query($sql);
19
+
20
+  $sql  = 'INSERT INTO tickets (user_id, ticket_status, ticket_thread, ';
21
+  $sql .= ' ticket_title, ticket_body, ticket_time) VALUES (5, \'reply\',';
22
+  $sql .= ' '.$row['ticket_id'].', \'Apologies.\', \'This ticket has been ';
23
+  $sql .= 'unaddressed for over 48 hours. Your account has been automatically';
24
+  $sql .= ' credited with an extra two months hosting.'."\r\n\r\n".' We apologise';
25
+  $sql .= ' for the inconvenience.\', '.time();
26
+  $sql .= ')';
27
+
28
+  mysql_query($sql);
29
+
30
+  ticketmail(mysql_insert_id());
31
+ }
32
+
33
+?>

+ 5
- 0
scripts/updateconf.php View File

@@ -0,0 +1,5 @@
1
+<?PHP
2
+
3
+ mysql_query('INSERT INTO actions (user_id, action_type, action_value) VALUES (5, \'updateconf\', \'apache\')');
4
+
5
+?>

+ 5
- 0
signup/.htaccess View File

@@ -0,0 +1,5 @@
1
+RewriteEngine On
2
+
3
+RewriteRule ^(/?signup)?/?([a-z]+)$ /signup/$2.php [L]
4
+RewriteRule ^(/?signup)?/?([0-9])$ /signup/index.php [L]
5
+RewriteRule ^(/?signup)?/?:([0-9]+)$ /signup/index.php?ref=$2 [L]

+ 32
- 0
signup/1.php View File

@@ -0,0 +1,32 @@
1
+<?PHP
2
+
3
+ if (isset($_POST['type']) && ($_POST['type'] == 'newuser' || $_POST['type'] == 'olduser')) {
4
+  $_SESSION['stage'] = 2;
5
+  $_SESSION['type'] = $_POST['type'];
6
+  header('Location: /signup/2');
7
+  exit; 
8
+ }
9
+
10
+
11
+?>
12
+<p>
13
+ Welcome to UTD-Hosting. Please select the type of package you wish to purchase.
14
+</p>
15
+<form action="/signup/1" method="post">
16
+<ul id="main">
17
+ <li>
18
+  <dl>
19
+   <dt><input type="radio" name="type" value="newuser" checked="checked"> New user</dt>
20
+   <dd>If you are new to UTD-Hosting, or wish to open an additional completely seperate account, select this option.</dd>
21
+  </dl>
22
+ </li>
23
+ <li>
24
+  <dl>
25
+   <dt><input type="radio" name="type" value="olduser"> Existing user</dt>
26
+   <dd>If you already have a UTD-Hosting account and wish to purchase
27
+    additional bandwidth/hdd space, select this option.</dd>
28
+  </dl>
29
+ </li>
30
+</ul>
31
+<input type="submit" value="Next" style="float: right;">
32
+</form>

+ 9
- 0
signup/2.php View File

@@ -0,0 +1,9 @@
1
+<?PHP
2
+
3
+ if ($_SESSION['type'] == 'newuser') {
4
+  require_once('2new.php');
5
+ } else {
6
+  require_once('2old.php');
7
+ }
8
+
9
+?>

+ 136
- 0
signup/2new.php View File

@@ -0,0 +1,136 @@
1
+<?PHP
2
+
3
+ if (isset($_POST['back'])) {
4
+  $_SESSION['stage'] = 1;
5
+  header('Location: /signup/1');
6
+  exit;
7
+ }
8
+
9
+ if (isset($_SESSION['data']) && !isset($_POST['user'])) {
10
+  $_POST = $_SESSION['data'];
11
+ }
12
+
13
+ function moo() {
14
+  if (!isset($_POST['user'])) {
15
+   return;
16
+  }
17
+  if (!ctype_alnum($_POST['user'])) {
18
+   echo '<div id="message">Please choose a username that only contains letters and/or numbers.</div>';
19
+   return;
20
+  }
21
+  if (!isset($_POST['pass1']) || !isset($_POST['pass2'])) {
22
+   echo '<div id="message">Please enter a password.</div>';
23
+   return;
24
+  }
25
+  if (($err = validPass($_POST['pass1'])) !== true) {
26
+   echo '<div id="message">'.$err.'</div>';
27
+   return;
28
+  }
29
+  if ($_POST['pass1'] != $_POST['pass2']) {
30
+   echo '<div id="message">Passwords do not match. Please confirm your password.</div>'; 
31
+   return;
32
+  }
33
+  if (strlen($_POST['name']) < 5 || strpos($_POST['name'],' ') === false) {
34
+   echo '<div id="message">Please enter your full name.</div>';
35
+   return;
36
+  }
37
+  if (empty($_POST['email']) || !preg_match('/^[^@]+@([^\.@:\[\]\(\)]+\.)+[a-z]{2,}$/i', $_POST['email'])) {
38
+   echo '<div id="message">Please enter a valid e-mail address.</div>';
39
+   return;
40
+  }
41
+ 
42
+  require_once('../control/lib/database.php');
43
+
44
+  $sql = 'SELECT bu_name FROM banneduser';
45
+  $res = mysql_query($sql);
46
+  while ($row = mysql_fetch_array($res)) {
47
+   $nick = $row[0];
48
+   if (strpos(strtolower($_POST['user']), strtolower($nick)) !== false) {
49
+    echo '<div id="message">That username is not permitted. Please chose another.</div>';
50
+    return;
51
+   }
52
+  }
53
+
54
+  $sql = 'SELECT user_id FROM users WHERE LCASE(user_name) = \''.mysql_real_escape_string(strtolower($_POST['user'])).'\'';
55
+  $res = mysql_query($sql);
56
+  if (mysql_num_rows($res) > 0) {
57
+   echo '<div id="message">That username is in use. Please select another.</div>';
58
+   return;
59
+  }
60
+
61
+  if (isset($_POST['proceed'])) {
62
+   unset($_POST['proceed']);
63
+   $_SESSION['data'] = $_POST; 
64
+   $_SESSION['stage'] = 3;
65
+   header('Location: /signup/3');
66
+   exit;
67
+  }
68
+
69
+ }
70
+
71
+ moo();
72
+
73
+
74
+?>
75
+<p>
76
+ Your username and password will be the ones you use to log in to the control
77
+ panel and FTP. Your password should be between 5 and 20 characters, and contain
78
+ at least one upper case letter, one lower case letter, and one number.
79
+</p>
80
+<form action="/signup/2" method="post">
81
+<input type="hidden" name="proceed" value="...">
82
+<table>
83
+ <tr>
84
+  <th>Username:</th>
85
+  <td><input type="text" name="user"<?PHP if (isset($_POST['user'])) { echo ' value="'.htmlentities($_POST['user']).'"'; } ?>></td>
86
+ </tr>
87
+ <tr>
88
+  <th>Password:</th>
89
+  <td><input type="password" name="pass1"<?PHP if (isset($_POST['pass1'])) { echo ' value="'.htmlentities($_POST['pass1']).'"'; } ?>></td>
90
+ </tr>
91
+ <tr>
92
+  <th>Confirm password:</th>
93
+  <td><input type="password" name="pass2"<?PHP if (isset($_POST['pass2'])) { echo ' value="'.htmlentities($_POST['pass2']).'"'; } ?>></td>
94
+ </tr>
95
+</table>
96
+<p>
97
+ The following basic contact information is required.
98
+</p>
99
+<table>
100
+ <tr>
101
+  <th>Full name:</th>
102
+  <td><input type="text" name="name"<?PHP if (isset($_POST['name'])) { echo ' value="'.htmlentities($_POST['name']).'"'; } ?>></td>
103
+ </tr>
104
+ <tr>
105
+  <th>E-mail address:</th>
106
+  <td><input type="text" name="email"<?PHP if (isset($_POST['email'])) { echo ' value="'.htmlentities($_POST['email']).'"'; } ?>></td>
107
+ </tr>
108
+</table>
109
+<p>
110
+ Optional extended contact details.
111
+</p>
112
+<table style="margin-bottom: 10px;">
113
+ <tr>
114
+  <th>Telephone:</th>
115
+  <td><input type="text" name="phone"<?PHP if (isset($_POST['phone'])) { echo ' value="'.htmlentities($_POST['phone']).'"'; } ?>></td>
116
+ </tr>
117
+ <tr>
118
+  <th>Address:</th>
119
+  <td><input type="text" name="addr"<?PHP if (isset($_POST['addr'])) { echo '
120
+value="'.htmlentities($_POST['addr']).'"'; } ?>></td>
121
+ </tr>
122
+</table>
123
+<p>
124
+ Your personal information will be stored on this server (which is located in
125
+ the United States of America), will not be disclosed to any third parties
126
+ unless required by law,
127
+ and will only be used by UTD-Hosting to contact you with regard to matters
128
+ directly concerning your UTD-Hosting account. All resonable actions will be undertaken to safeguard this data from external access.
129
+ If you do not agree to this,
130
+ please discontinue the signup process.
131
+</p>
132
+<input type="submit" name="forward" value="Next" style="float: right;">
133
+</form>
134
+<form action="/signup/2" method="post">
135
+ <input type="submit" name="back" value="Previous">
136
+</form>

+ 46
- 0
signup/2old.php View File

@@ -0,0 +1,46 @@
1
+<?PHP
2
+
3
+ if (isset($_POST['back'])) {
4
+  $_SESSION['stage'] = 1;
5
+  header('Location: /signup/1');
6
+  exit;
7
+ }
8
+
9
+ if (isset($_POST['user']) && isset($_POST['pass'])) {
10
+  require_once('../control/lib/database.php');
11
+  $pass = md5($_POST['user'].$_POST['pass']);
12
+  $user = mysql_real_escape_string($_POST['user']);
13
+  $sql = 'SELECT user_id FROM users WHERE user_name = \''.$user.'\' AND user_pass = \''.$pass.'\'';
14
+  $res = mysql_query($sql);
15
+  if (mysql_num_rows($res) != 1) {
16
+   echo '<div id="message">Invalid username or password</div>';
17
+  } else {
18
+   $row = mysql_fetch_array($res);
19
+   $_SESSION['UID'] = $row[0];
20
+   $_SESSION['stage'] = 3;
21
+   header('Location: /signup/3');
22
+   exit;
23
+  }
24
+ }
25
+
26
+
27
+?>
28
+<p>
29
+ Please enter your existing UTD-Hosting username and password.
30
+</p>
31
+<form action="/signup/2" method="post">
32
+<table style="margin-bottom: 20px;">
33
+ <tr>
34
+  <th>Username:</th>
35
+  <td><input type="text" name="user"<?PHP if (isset($_POST['user'])) { echo ' value="'.htmlentities($_POST['user']).'"'; } ?>></td>
36
+ </tr>
37
+ <tr>
38
+  <th>Password:</th>
39
+  <td><input type="password" name="pass"></td>
40
+ </tr>
41
+</table>
42
+<input type="submit" name="forward" value="Next" style="float: right;">
43
+</form>
44
+<form action="/signup/2" method="post">
45
+ <input type="submit" name="back" value="Previous">
46
+</form>

+ 42
- 0
signup/3.php View File

@@ -0,0 +1,42 @@
1
+<?PHP
2
+ if (isset($_POST['back'])) {
3
+  $_SESSION['stage'] = 2;
4
+  header('Location: /signup/2');
5
+  exit;
6
+ }
7
+ if (isset($_POST['agree'])) {
8
+  if (strtoupper($_POST['agree']) == 'I AGREE') {
9
+   $_SESSION['stage'] = 4;
10
+   $_SESSION['tac'] = $_SESSION['TAC_L'];
11
+   header('Location: /signup/4');
12
+   exit;
13
+  } else {
14
+   echo '<div id="message">If you agree to the terms and conditions please type <code>I AGREE</code> into the text box.</div>';
15
+  }
16
+ }
17
+?>
18
+<p class="blurb">
19
+ Please review the UTD-Hosting terms &amp; conditions. If you do not agree to
20
+ these terms, please discontinue with the signup procedure.
21
+</p>
22
+<hr>
23
+<?PHP
24
+
25
+ $stuff = file_get_contents('../common/tac.txt');
26
+ $_SESSION['TAC_L'] = substr($stuff,0,4);
27
+ echo substr($stuff,4);
28
+
29
+?>
30
+<hr>
31
+<p class="blurb">
32
+ Please indicate your acceptance of these terms and conditions by typing 
33
+ <code>I AGREE</code> in the box below.
34
+</p>
35
+<form action="/signup/3" method="post">
36
+ <input type="text" name="agree" style="margin-bottom: 20px;">
37
+ <input type="submit" name="forward" value="Next" style="float: right;">
38
+</form>
39
+<form action="/signup/3" method="post">
40
+ <input type="submit" name="back" value="Previous">
41
+</form>
42
+

+ 81
- 0
signup/4.php View File

@@ -0,0 +1,81 @@
1
+<?PHP
2
+ if (isset($_POST['back'])) {
3
+  $_SESSION['stage'] = 3;
4
+  header('Location: /signup/3');
5
+  exit;
6
+ }
7
+ if (isset($_POST['slot'])) {
8
+  $_SESSION['slot'] = $_POST['slot'];
9
+  $_SESSION['discount'] = $_POST['discount'];
10
+  if ($_SESSION['type'] != 'newuser') {
11
+   $_SESSION['action'] = 'deferred';
12
+   mysql_query('INSERT INTO signups (signup_ip, signup_time, signup_data) VALUES (\''.$_SERVER['REMOTE_ADDR'].'\', '.time().', \''.mysql_real_escape_string(serialize($_SESSION)).'\')');
13
+   logger::log('Deferred signup (type: '.$_SESSION['type'].'; slots: '.$_SESSION['slot'].')',logger::important);
14
+  } else {
15
+   addUser($_SESSION['data']['user'], $_SESSION['data']['email'], $_SESSION['data']['pass1'], $_SESSION['tac'], $_POST['slot']);
16
+   logger::log('Autoprocessed signup for user '.$_SESSION['data']['user'].' ['.$_POST['slot'].' slots]',logger::normal);
17
+   $name = $_SESSION['data']['name'];
18
+   $user = strtolower($_SESSION['data']['user']);
19
+   $message = "Dear $name,
20
+
21
+Thank you for signing up for UTD-Hosting. Your account has been created, and as soon as you've paid you will be able to start uploading your website.
22
+
23
+Your username is $user
24
+
25
+To log in to the customer control panel, go to https://secure.utd-hosting.com/control (don't worry if your browser gives you an error message about the ssl certificate - the connection is still encrypted), and enter your username as it appears above, and the password you used during the signup procedure.
26
+
27
+When you are ready to upload your site, use an FTP client to connect to asimov.utd-hosting.com, using your control panel login details. A default site has been created for you, which can be accessed via the address http://$user.utd-hosting.com/. To upload files to this site, navigate to the public_html directory once you are connected.
28
+
29
+If you have any questions, please check the support section of the control panel at https://secure.utd-hosting.com/control/support. If you still have queries, please raise a ticket via the control panel, or e-mail support@utd-hosting.com.
30
+
31
+-- UTD-Hosting support 
32
+
33
+[ If you did not sign up to UTD-Hosting, please e-mail admins@utd-hosting.com and we will remove your e-mail address ]";
34
+   mail($_SESSION['data']['email'], 'Your UTD-Hosting account', $message, "From: support@utd-hosting.com");
35
+   $_SESSION['action'] = 'processed';
36
+   mysql_query('INSERT INTO signups (signup_ip, signup_time, signup_data, signup_processed) VALUES (\''.$_SERVER['REMOTE_ADDR'].'\', '.time().', \''.mysql_real_escape_string(serialize($_SESSION)).'\', 1)');
37
+  }
38
+  $_SESSION['stage'] = 5;
39
+  header('Location: /signup/5');
40
+  exit;
41
+ }
42
+?>
43
+<form action="/signup/4" method="post">
44
+<p class="blurb">
45
+ Please select the amount of
46
+ <?PHP if ($_SESSION['type'] != 'newuser') { echo 'additional'; } ?>
47
+ server slots you would like to purchase
48
+</p>
49
+<table>
50
+ <tr>
51
+  <td><input type="radio" name="slot" value="1" checked="checked"></td>
52
+  <td>One slot</td>
53
+  <td>£35 / year</td>
54
+  <td>3.5 GB Storage</td>
55
+  <td>50 GB Transfer / month</td>
56
+ </tr>
57
+ <tr>
58
+  <td><input type="radio" name="slot" value="2"></td>
59
+  <td>Two slots</td>
60
+  <td>£70 / year</td>
61
+  <td>7.0 GB Storage</td>
62
+  <td>100 GB Transfer / month</td>
63
+ </tr>
64
+ <tr>
65
+  <td><input type="radio" name="slot" value="3"></td>
66
+  <td>Three slots</td>
67
+  <td>£100 / year</td>
68
+  <td>10.5 GB Storage</td>
69
+  <td>150 GB Transfer / month</td>
70
+ </tr>
71
+</table>
72
+<p class="blurb">
73
+ If you have a discount code, please enter it in the text box below.
74
+</p>
75
+<input type="text" name="discount" style="width: 300px; margin: 10px;">
76
+<br>
77
+ <input type="submit" name="forward" value="Next" style="float: right;">
78
+</form>
79
+<form action="/signup/4" method="post">
80
+ <input type="submit" name="back" value="Previous">
81
+</form>

+ 34
- 0
signup/5.php View File

@@ -0,0 +1,34 @@
1
+<p>
2
+<?PHP if ($_SESSION['action'] == 'deferred' && $_SESSION['type'] == 'newuser') { ?>
3
+ Thank you. Your application has been deferred to our admin team, and your account will be set up shortly. You should receive an e-mail within 24 hours containing details on how to access the control panel and how to pay your first bill. If you have any questions before you get a control panel login, please mail <a href="mailto:support@utd-hosting.com">support@utd-hosting.com</a>.
4
+<?PHP } elseif ($_SESSION['action'] == 'deferred') { ?>
5
+Thank you. Your request has been deferred to our admin team, who will contact you shortly about new billing arrangements and your new account limits. 
6
+<?PHP } else { ?>
7
+Thank you. Your application has been processed and you may now log into our <a href="/control">control panel</a> and pay for your account. If you require any assistance, please mail <a href="mailto:support@utd-hosting.com">support@utd-hosting.com</a>.
8
+</p>
9
+<p>
10
+<form action="/control" method="post">
11
+ <input type="submit" value="Continue">
12
+</form>
13
+<?PHP } ?>
14
+</p>
15
+<!-- Google Code for SIGNUP Conversion Page -->
16
+<script language="JavaScript" type="text/javascript">
17
+<!--
18
+var google_conversion_id = 1065381349;
19
+var google_conversion_language = "en_GB";
20
+var google_conversion_format = "1";
21
+var google_conversion_color = "666666";
22
+if (35.0) {
23
+  var google_conversion_value = 35.0;
24
+}
25
+var google_conversion_label = "SIGNUP";
26
+//-->
27
+</script>
28
+<script language="JavaScript" src="https://www.googleadservices.com/pagead/conversion.js">
29
+</script>
30
+<noscript>
31
+<img height=1 width=1 border=0 src="https://www.googleadservices.com/pagead/conversion/1065381349/?value=35.0&label=SIGNUP&script=0">
32
+</noscript>
33
+
34
+                                    

+ 14
- 0
signup/inc/sessions.php View File

@@ -0,0 +1,14 @@
1
+<?PHP
2
+
3
+session_name('UTDsignup');
4
+session_start();
5
+
6
+if (!isset($_SESSION['stage'])) {
7
+ $_SESSION['stage'] = 1;
8
+}
9
+
10
+if (isset($_GET['ref'])) {
11
+ $_SESSION['ref'] = $_GET['ref'];
12
+}
13
+
14
+?>

+ 107
- 0
signup/index.php View File

@@ -0,0 +1,107 @@
1
+<?PHP
2
+
3
+chdir('/home/utd/control');
4
+define('NOLOGINREF', true);
5
+require_once('lib/account.php');
6
+require_once('lib/common.php');
7
+require_once('lib/database.php');
8
+
9
+chdir('/home/utd/signup');
10
+require('inc/sessions.php');
11
+
12
+ob_start();
13
+
14
+?>
15
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
16
+<html>
17
+ <head>
18
+  <title>UTD-Hosting :: Signup</title>
19
+  <style type="text/css">
20
+   body {
21
+    margin: 80px 200px;
22
+    font-family: Tahoma, Arial, sans-serif; 
23
+    background-color: #fff;
24
+   }
25
+
26
+   p.blurb { font-style: italic; }
27
+
28
+   div.status {
29
+    float: right;
30
+    font-size: small;
31
+    font-variant: small-caps;
32
+    color: #aaa; 
33
+    text-align: center;
34
+    margin: 0px 10px;
35
+    width: 60px;
36
+   }
37
+   div.status span {
38
+    font-size: 60px;
39
+    font-weight: bold;
40
+   }
41
+   div.past { color: #eee; }
42
+   div.current { color: #000; } 
43
+
44
+   div#content {
45
+    clear: both;
46
+    padding-top: 20px;
47
+    font-size: small;
48
+   }
49
+   
50
+   th { text-align: right; width: 150px; }
51
+
52
+   ul#main {
53
+    list-style-type: none;
54
+    margin: 30px 0px;
55
+   }
56
+   dt { font-weight: bold; }
57
+   dd { margin: 5px 0px 20px 30px; }
58
+  
59
+   p#footer { clear: both; padding-top: 20px; font-style: italic; font-size: x-small; text-align: center; } 
60
+   
61
+   img#logo { float: left; }
62
+
63
+   hr { border: 0px; border-top: 1px solid #aaa; background-color: transparent; }
64
+
65
+   div#message {
66
+    border: 2px dashed #FAA;	
67
+    background-color: #FEE;
68
+    margin-bottom: 20px;
69
+    padding: 10px;
70
+   }
71
+  </style>
72
+ </head>
73
+ <body>
74
+  <img src="/control/res/logo.png" alt="UTD-Hosting" id="logo">
75
+<?PHP
76
+
77
+ $status = array(1=>'Signup type',2=>'Account details',3=>'Terms &amp; Conditions',4=>'Advanced details',5=>'Payment');
78
+
79
+ for ($i = 5; $i > 0; $i--) {
80
+  echo '<div class="status';
81
+  if ($_SESSION['stage'] == $i) {
82
+   echo ' current';
83
+  } elseif ($_SESSION['stage'] > $i) {
84
+   echo ' past';
85
+  } else {
86
+   echo ' future';
87
+  }
88
+  echo '"><span>'.$i.'</span><br>'.$status[$i].'</div>';
89
+ }
90
+
91
+?>
92
+  <div id="content">
93
+<?PHP
94
+
95
+ if (file_exists($_SESSION['stage'].'.php')) {
96
+  require_once($_SESSION['stage'].'.php');
97
+ }
98
+
99
+?> 
100
+  </div>
101
+  <p id="footer">
102
+   Copyright (&copy;) UTD-Hosting, 2005-2006. All rights reserved.
103
+   <br>PROBLEMS? E-mail <a href="mailto:support@utd-hosting.com">support@utd-hosting.com</a> for assistance.
104
+  </p>
105
+ </body>
106
+</html>
107
+<?PHP ob_end_flush(); ?>

BIN
signup/res/1a.png View File


BIN
signup/res/1b.png View File


BIN
signup/res/1c.png View File


BIN
signup/res/2a.png View File


BIN
signup/res/2b.png View File


BIN
signup/res/2c.png View File


.htaccess → www/.htaccess View File


403.php → www/403.php View File


account.php → www/account.php View File


addsite.php → www/addsite.php View File


admin.menu.php → www/admin.menu.php View File


admin.php → www/admin.php View File


adminannouncements.php → www/adminannouncements.php View File


adminbans.php → www/adminbans.php View File


adminbw.php → www/adminbw.php View File


admindiscounts.php → www/admindiscounts.php View File


admindomains.php → www/admindomains.php View File


adminfinances.php → www/adminfinances.php View File


admininvoices.php → www/admininvoices.php View File


adminreports.php → www/adminreports.php View File


adminsites.php → www/adminsites.php View File


admintickets.php → www/admintickets.php View File


adminusers.php → www/adminusers.php View File


alltickets.php → www/alltickets.php View File


bandwidth.php → www/bandwidth.php View File


bans.php → www/bans.php View File


billing.php → www/billing.php View File


billingref.php → www/billingref.php View File


changepass.php → www/changepass.php View File


checkuser.php → www/checkuser.php View File


database.php → www/database.php View File


discount.php → www/discount.php View File


discounts.php → www/discounts.php View File


domains.php → www/domains.php View File


doticket.php → www/doticket.php View File


doticketreply.php → www/doticketreply.php View File


editpref.php → www/editpref.php View File


editsite.php → www/editsite.php View File


email.php → www/email.php View File


enabledomain.php → www/enabledomain.php View File


ext/pie.php → www/ext/pie.php View File


fileman.php → www/fileman.php View File


history.php → www/history.php View File


index.php → www/index.php View File


invoices.php → www/invoices.php View File


ipn.php → www/ipn.php View File


lib/account.php → www/lib/account.php View File


lib/bandwidth.php → www/lib/bandwidth.php View File


lib/common.php → www/lib/common.php View File


lib/dashboard.php → www/lib/dashboard.php View File


lib/database.php → www/lib/database.php View File


lib/footer.php → www/lib/footer.php View File


lib/header.php → www/lib/header.php View File


lib/log.php → www/lib/log.php View File


lib/profiler.php → www/lib/profiler.php View File


login.php → www/login.php View File


logout.php → www/logout.php View File


pages/adddomain.php → www/pages/adddomain.php View File


pages/addemail.php → www/pages/addemail.php View File


pages/addmailbox.php → www/pages/addmailbox.php View File


pages/addsite.php → www/pages/addsite.php View File


pages/admin.actions.php → www/pages/admin.actions.php View File


pages/admin.addannouncement.php → www/pages/admin.addannouncement.php View File


pages/admin.adddiscount.php → www/pages/admin.adddiscount.php View File


pages/admin.addfinances.php → www/pages/admin.addfinances.php View File


pages/admin.addipban.php → www/pages/admin.addipban.php View File


pages/admin.announcements.php → www/pages/admin.announcements.php View File


pages/admin.discounts.php → www/pages/admin.discounts.php View File


pages/admin.domains.php → www/pages/admin.domains.php View File


pages/admin.finances.php → www/pages/admin.finances.php View File


pages/admin.invoices.php → www/pages/admin.invoices.php View File


pages/admin.ipbans.php → www/pages/admin.ipbans.php View File


Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save