Location: PHPKode > projects > Program E > docs/developer/__filesource/fsource_Loader__adminbotloaderinc.php.html
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  <html xmlns="http://www.w3.org/1999/xhtml">
		<head>
			<!-- template designed by Marco Von Ballmoos  -->
			<title>File Source for botloaderinc.php</title>
			<link rel="stylesheet" href="../media/stylesheet.css" />
											</head>
		<body>
						
<h1>Source for file botloaderinc.php</h1>
<p>Documentation is available at <a href="../Loader/_admin_botloaderinc_php.html">botloaderinc.php</a></p>
<div class="src-code">
<pre><ol><li><a name="a1"></a><span class="src-php">&lt;?</span></li>
<li><a name="a2"></a>&nbsp;</li>
<li><a name="a3"></a><span class="src-comm">/*</span></li>
<li><a name="a4"></a><span class="src-comm">    Program E</span></li>
<li><a name="a5"></a><span class="src-comm">    Copyright 2002, Paul Rydell</span></li>
<li><a name="a6"></a>    </li>
<li><a name="a7"></a><span class="src-comm">    This file is part of Program E.</span></li>
<li><a name="a8"></a>    </li>
<li><a name="a9"></a><span class="src-comm">    Program E is free software; you can redistribute it and/or modify</span></li>
<li><a name="a10"></a><span class="src-comm">    it under the terms of the GNU General Public License as published by</span></li>
<li><a name="a11"></a><span class="src-comm">    the Free Software Foundation; either version 2 of the License, or</span></li>
<li><a name="a12"></a><span class="src-comm">    (at your option) any later version.</span></li>
<li><a name="a13"></a>&nbsp;</li>
<li><a name="a14"></a><span class="src-comm">    Program E is distributed in the hope that it will be useful,</span></li>
<li><a name="a15"></a><span class="src-comm">    but WITHOUT ANY WARRANTY; without even the implied warranty of</span></li>
<li><a name="a16"></a><span class="src-comm">    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</span></li>
<li><a name="a17"></a><span class="src-comm">    GNU General Public License for more details.</span></li>
<li><a name="a18"></a>&nbsp;</li>
<li><a name="a19"></a><span class="src-comm">    You should have received a copy of the GNU General Public License</span></li>
<li><a name="a20"></a><span class="src-comm">    along with Program E; if not, write to the Free Software</span></li>
<li><a name="a21"></a><span class="src-comm">    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA</span></li>
<li><a name="a22"></a><span class="src-comm">*/</span></li>
<li><a name="a23"></a>&nbsp;</li>
<li><a name="a24"></a>&nbsp;</li>
<li><a name="a25"></a><span class="src-doc">/**</span></li>
<li><a name="a26"></a><span class="src-doc"> * HTML interface for AIML loading</span></li>
<li><a name="a27"></a><span class="src-doc"> * </span></li>
<li><a name="a28"></a><span class="src-doc"> * This script is loading your AIML files one at a time to prevent the</span></li>
<li><a name="a29"></a><span class="src-doc"> * script from timing out. Only use this script if your PHP is running in safe mode.</span></li>
<li><a name="a30"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@author</span><span class="src-doc"> Paul Rydell</span></li>
<li><a name="a31"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@copyright</span><span class="src-doc"> 2002</span></li>
<li><a name="a32"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@version</span><span class="src-doc"> 0.0.8</span></li>
<li><a name="a33"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@package</span><span class="src-doc"> Loader</span></li>
<li><a name="a34"></a><span class="src-doc"> */</span></li>
<li><a name="a35"></a> </li>
<li><a name="a36"></a><span class="src-doc">/**</span></li>
<li><a name="a37"></a><span class="src-doc">* The general preferences and database details.</span></li>
<li><a name="a38"></a><span class="src-doc">*/ </span></li>
<li><a name="a39"></a><span class="src-inc">require_once </span><span class="src-str">&quot;dbprefs.php&quot;</span><span class="src-sym">;</span></li>
<li><a name="a40"></a>&nbsp;</li>
<li><a name="a41"></a>&nbsp;</li>
<li><a name="a42"></a><span class="src-doc">/**</span></li>
<li><a name="a43"></a><span class="src-doc">* Contains the actual functions used in this file to load the AIML files into MySQL.</span></li>
<li><a name="a44"></a><span class="src-doc">*/</span></li>
<li><a name="a45"></a><span class="src-inc">require_once </span><span class="src-str">&quot;botloaderfuncs.php&quot;</span><span class="src-sym">;</span></li>
<li><a name="a46"></a>&nbsp;</li>
<li><a name="a47"></a><a href="../Loader/_admin_botloaderfuncs_php.html#functionss_timing_start">ss_timing_start</a><span class="src-sym">(</span><span class="src-str">&quot;all&quot;</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a48"></a>&nbsp;</li>
<li><a name="a49"></a>print <span class="src-str">&quot;&lt;font size='3' color='black'&gt;This script is loading your AIML files one at a time to prevent the script from timing out. Only use this script if your PHP is running in safe mode. If you are still experiencing timeouts then you need to edit your AIML files into smaller files.&lt;/font&gt;&lt;br&gt;&lt;BR&gt;\n&quot;</span><span class="src-sym">;</span></li>
<li><a name="a50"></a>&nbsp;</li>
<li><a name="a51"></a>&nbsp;</li>
<li><a name="a52"></a><span class="src-var">$fp</span>=<span class="src-str">&quot;&quot;</span><span class="src-sym">;</span></li>
<li><a name="a53"></a>&nbsp;</li>
<li><a name="a54"></a><span class="src-var">$templatesinserted</span>=<span class="src-num">0</span><span class="src-sym">;</span></li>
<li><a name="a55"></a>&nbsp;</li>
<li><a name="a56"></a><span class="src-var">$depth </span>= <span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a57"></a><span class="src-var">$whaton</span>=<span class="src-str">&quot;&quot;</span><span class="src-sym">;</span></li>
<li><a name="a58"></a>&nbsp;</li>
<li><a name="a59"></a><span class="src-var">$pattern</span>=<span class="src-str">&quot;&quot;</span><span class="src-sym">;</span></li>
<li><a name="a60"></a><span class="src-var">$topic</span>=<span class="src-str">&quot;&quot;</span><span class="src-sym">;</span></li>
<li><a name="a61"></a><span class="src-var">$that</span>=<span class="src-str">&quot;&quot;</span><span class="src-sym">;</span></li>
<li><a name="a62"></a><span class="src-var">$template</span>=<span class="src-str">&quot;&quot;</span><span class="src-sym">;</span></li>
<li><a name="a63"></a>&nbsp;</li>
<li><a name="a64"></a><span class="src-var">$startupwhich</span>=<span class="src-str">&quot;&quot;</span><span class="src-sym">;</span></li>
<li><a name="a65"></a><span class="src-var">$splitterarray</span>=<span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a66"></a><span class="src-var">$inputarray</span>=<span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a67"></a><span class="src-var">$genderarray</span>=<span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a68"></a><span class="src-var">$personarray</span>=<span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a69"></a><span class="src-var">$person2array</span>=<span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a70"></a>&nbsp;</li>
<li><a name="a71"></a><span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span>isset<span class="src-sym">(</span><span class="src-var">$HTTP_GET_VARS</span><span class="src-sym">[</span><span class="src-str">'fileid'</span><span class="src-sym">]</span><span class="src-sym">))</span><span class="src-sym">{</span></li>
<li><a name="a72"></a>    <span class="src-comm">#deletebot();</span></li>
<li><a name="a73"></a>    <span class="src-var">$fileid</span>=<span class="src-num">1</span><span class="src-sym">;</span></li>
<li><a name="a74"></a><span class="src-sym">}</span></li>
<li><a name="a75"></a><span class="src-key">else </span><span class="src-sym">{</span></li>
<li><a name="a76"></a>    <span class="src-var">$fileid</span>=<span class="src-var">$HTTP_GET_VARS</span><span class="src-sym">[</span><span class="src-str">'fileid'</span><span class="src-sym">]</span><span class="src-sym">;</span></li>
<li><a name="a77"></a><span class="src-sym">}</span></li>
<li><a name="a78"></a>&nbsp;</li>
<li><a name="a79"></a><span class="src-comm">#deletejustbot();</span></li>
<li><a name="a80"></a><span class="src-var">$doneloading</span>=<a href="../Loader/_admin_botloaderfuncs_php.html#functionloadstartupinc">loadstartupinc</a><span class="src-sym">(</span><span class="src-var">$fileid</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a81"></a><span class="src-var">$fileid</span>++<span class="src-sym">;</span></li>
<li><a name="a82"></a><a href="../Loader/_admin_botloaderfuncs_php.html#functionmakesubscode">makesubscode</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a83"></a>&nbsp;</li>
<li><a name="a84"></a>&nbsp;</li>
<li><a name="a85"></a>print <span class="src-str">&quot;</span>&lt;<span class="src-id">font size</span>='3' <span class="src-id">color</span>='<span class="src-id">BLUE</span>'&gt;<span class="src-id">Inserted </span><span class="src-var">$templatesinserted </span><span class="src-id">categories into database</span>&lt;/<span class="src-id">font</span>&gt;&lt;<span class="src-id">br</span>&gt;&lt;<span class="src-id">BR</span>&gt;\n<span class="src-str">&quot;</span><span class="src-sym">;</span></li>
<li><a name="a86"></a>&nbsp;</li>
<li><a name="a87"></a><span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$doneloading</span>==<span class="src-num">0</span><span class="src-sym">)</span><span class="src-sym">{</span></li>
<li><a name="a88"></a>    print <span class="src-str">&quot;</span>&lt;<span class="src-id">p</span>&gt;&lt;<span class="src-id">font size</span>='3' <span class="src-id">color</span>='<span class="src-id">BLACK</span>'&gt;&lt;<span class="src-id">a href</span>='<span class="src-id">botloaderinc</span>.<span class="src-id">php</span>?<span class="src-id">fileid</span>=<span class="src-var">$fileid</span>'&gt;<span class="src-id">Click here to load the </span><a href="http://www.php.net/next">next</a> <a href="http://www.php.net/file">file</a>.&lt;/<span class="src-id">a</span>&gt;&lt;/<span class="src-id">p</span>&gt;&lt;/<span class="src-id">font</span>&gt;\n<span class="src-str">&quot;</span><span class="src-sym">;</span></li>
<li><a name="a89"></a><span class="src-sym">}</span></li>
<li><a name="a90"></a><span class="src-key">else </span><span class="src-sym">{</span></li>
<li><a name="a91"></a>    print <span class="src-str">&quot;&lt;font size='3' color='RED'&gt;&lt;b&gt;DONE LOADING&lt;/B&gt;&lt;BR&gt;&lt;/font&gt;\n&quot;</span><span class="src-sym">;</span></li>
<li><a name="a92"></a>    print <span class="src-str">&quot;&lt;font size='3' color='RED'&gt;&lt;b&gt;WARNING!&lt;/b&gt; You should password protect the admin directory or remove the botloader.php script or people may be able to abuse your server.&lt;/b&gt;&lt;/font&gt;\n&quot;</span><span class="src-sym">;</span></li>
<li><a name="a93"></a>    print <span class="src-str">&quot;&lt;p&gt;&lt;font size='3' color='BLACK'&gt;&lt;a href='../talk.php'&gt;Click here to talk to the bot&lt;/a&gt;&lt;/p&gt;&lt;/font&gt;\n&quot;</span><span class="src-sym">;</span></li>
<li><a name="a94"></a><span class="src-sym">}</span></li>
<li><a name="a95"></a>&nbsp;</li>
<li><a name="a96"></a>print <span class="src-str">&quot;&lt;BR&gt;&quot;</span><span class="src-sym">;</span></li>
<li><a name="a97"></a>&nbsp;</li>
<li><a name="a98"></a><a href="../Loader/_admin_botloaderfuncs_php.html#functionss_timing_stop">ss_timing_stop</a><span class="src-sym">(</span><span class="src-str">&quot;all&quot;</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a99"></a>print <span class="src-str">&quot;&lt;BR&gt;&lt;BR&gt;&lt;font size='3' color='BLACK'&gt;execution time: &quot; </span>. <a href="../Loader/_admin_botloaderfuncs_php.html#functionss_timing_current">ss_timing_current</a><span class="src-sym">(</span><span class="src-str">&quot;all&quot;</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a100"></a><span class="src-var">$avgts</span>=<span class="src-var">$templatesinserted</span>/<a href="../Loader/_admin_botloaderfuncs_php.html#functionss_timing_current">ss_timing_current</a><span class="src-sym">(</span><span class="src-str">&quot;all&quot;</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a101"></a><span class="src-var">$avgtm</span>=<span class="src-var">$templatesinserted</span>/<span class="src-sym">((</span><a href="../Loader/_admin_botloaderfuncs_php.html#functionss_timing_current">ss_timing_current</a><span class="src-sym">(</span><span class="src-str">&quot;all&quot;</span><span class="src-sym">))</span>/<span class="src-num">60</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a102"></a>print <span class="src-str">&quot;</span>&lt;<span class="src-id">BR</span>&gt;&lt;<span class="src-id">font size</span>='3' <span class="src-id">color</span>='<span class="src-id">BLACK</span>'&gt;<span class="src-id">Templates per second</span>=<span class="src-var">$avgts</span>&lt;<span class="src-id">BR</span>&gt;<span class="src-str">&quot;</span><span class="src-sym">;</span></li>
<li><a name="a103"></a>print <span class="src-str">&quot;</span>&lt;<span class="src-id">font size</span>='3' <span class="src-id">color</span>='<span class="src-id">BLACK</span>'&gt;<span class="src-id">Templates per minute</span>=<span class="src-var">$avgtm</span>&lt;<span class="src-id">BR</span>&gt;<span class="src-str">&quot;</span><span class="src-sym">;</span></li>
<li><a name="a104"></a>&nbsp;</li>
<li><a name="a105"></a>&nbsp;</li>
<li><a name="a106"></a><span class="src-php">?&gt;</span></li>
</ol></pre>
</div>
	<p class="notes" id="credit">
		Documentation generated on Wed, 12 Jan 2005 12:24:45 +0100 by <a href="http://www.phpdoc.org" target="_blank">phpDocumentor 1.3.0RC3</a>
	</p>
	</body>
</html>
Return current item: Program E