<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Code The World — Simple register form]]></title>
	<link rel="self" href="https://codetheworld.com/extern.php?action=feed&amp;tid=76&amp;type=atom" />
	<updated>2008-06-16T04:09:12Z</updated>
	<generator>PunBB</generator>
	<id>https://codetheworld.com/viewtopic.php?id=76</id>
		<entry>
			<title type="html"><![CDATA[Simple register form]]></title>
			<link rel="alternate" href="https://codetheworld.com/viewtopic.php?pid=217#p217" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>function register(){
        
        
        switch($_GET[&#039;op&#039;]){
    
        case &#039;submit&#039;:
        $clean = array();
        $mysql = array();
    
        $now = time();
        $max = $now - 15;    
        $salt = $sitekey;
        $email = $_POST[&#039;email&#039;];
        
        if (ctype_alnum($_POST[&#039;username&#039;])){
          $clean[&#039;username&#039;] = $_POST[&#039;username&#039;];
        
        }
            
        $clean[&#039;password&#039;] = md5($salt . md5($_POST[&#039;password&#039;] . $salt));
        $mysql[&#039;username&#039;] = mysql_real_escape_string($clean[&#039;username&#039;]);
        $uname = $mysql[&#039;username&#039;];
        $upass = $clean[&#039;password&#039;]; 
        $ip_address = $_SERVER[&#039;HTTP_REFERER&#039;];
        $sql = &quot;INSERT into users(username, password, email, ip_address)
                VALUES (&#039;$uname&#039;,&#039;$upass&#039;,&#039;$email&#039;, &#039;$ip_address&#039;)&quot;;
        $result = mysql_query($sql) or die(&#039;error inserting data&#039;);
        break;
        
        default:
        echo &quot;&lt;form action=\&quot;login.php?action=register&amp;op=submit\&quot; method=\&quot;post\&quot; enctype=\&quot;application/x-www-form-urlencoded\&quot;&gt;
                  &lt;label&gt;Username&lt;br&gt;
                  &lt;input type=\&quot;text\&quot; name=\&quot;username\&quot;&gt;
                  &lt;/label&gt;
                  &lt;br&gt;
                  &lt;label&gt;Password&lt;br&gt;
                  &lt;input type=\&quot;password\&quot; name=\&quot;password\&quot;&gt;
                  &lt;/label&gt;
                  &lt;br&gt;
                  &lt;label&gt;Email&lt;br&gt;
                  &lt;input type=\&quot;text\&quot; name=\&quot;email\&quot;&gt;
                  &lt;/label&gt;
                  &lt;br&gt;
                  &lt;label&gt;
                  &lt;input type=\&quot;submit\&quot; name=\&quot;Submit\&quot; value=\&quot;Register\&quot;&gt;
                  &lt;/label&gt;
                &lt;/form&gt;&quot;;
        break;
    }

}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[a3d2i2]]></name>
				<uri>https://codetheworld.com/profile.php?id=145</uri>
			</author>
			<updated>2008-06-16T04:09:12Z</updated>
			<id>https://codetheworld.com/viewtopic.php?pid=217#p217</id>
		</entry>
</feed>
