Have A Little Problem

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Have A Little Problem

    Ok, hear me out.

    In my script im coding i want to add a code in register so folders and stuff on my surver cant be used if someone register with one of that names.

    Example, if someone tries registering with the username downloads it should tell them

    Name not allowed or something. heres my register page. help please?

    Code:
    elseif($spider=="register1")
    {
    echo "<div style=\"background-color:#FF0000; color:#FFFFFF;\" align=\"center\">\n";
    echo "[b][size="1"]Register[/size][/b]";
    echo "</div>\n";
    echo "<div align=\"center\">\n";
    if($name!=""||$pass!=""){
    $name = $_POST[&#39;name&#39;];
    $name= strtolower($name);
    $query= ("INSERT INTO `users`
            ( `id`,
            `name` ,
            `pass`,
            `rtime`,
            `ip`,
            `soft` )
            values(&#39;&#39;,&#39;$name&#39;,&#39;$pass&#39;,&#39;".time()."&#39;,&#39;".getenv(REMOTE_ADDR)."&#39;,&#39;".getenv(HTTP_USER_AGENT)."&#39;);");
    $name=$_POST[&#39;name&#39;];
    $result = mysql_query($query);
    if(!$result) echo "Error
    \n";
    if(!$result){echo "Username exists, try another one
    <a href=\"$PHP_SELF?spider=register\">Register</a>
    \n";
    }else{
    $name=$_POST[&#39;name&#39;];
    mkdir("$name");
    @ chmod("$name",0755);
    mkdir("$name/files");
    @ chmod("$name/files",0755);
    mkdir("$name/pics");
    @ chmod("$name/pics",0755);
    $fp = fopen(addslashes($_POST[&#39;name&#39;]) . &#39;/index.php&#39;, &#39;w&#39;);
    $clear_page = <<<CLEARPAGE
    <?
    header("location: ../sites/index.php?name=$name");
    CLEARPAGE;
    fputs($fp, $clear_page);
    
    /*
    file("http://$cpaneluser:$cpanelpass@$domain:2082/frontend/x/subdomain/doadddomain.html?domain=$name&rootdomain=$domain
    ");
    */
    echo "Registration Successful!
    \n";
    echo "<hr />\n";
    echo "</div>\n";
    echo "[b]Username:[/b] ".$name."
    \n";
    echo "[b]Password:[/b] ".$pass."
    \n";
    echo "------
    \n";
    echo "Your site can be viewd at:
    \n";
    echo "http://spiderwap.co.za/".$name."";
    echo "<div align=\"center\">\n";
    echo "<hr />\n";
    echo "<a href=\"$PHP_SELF?spider=menu&amp;name=$name&amp;pass=$pass\">Enter</a>
    \n";
    }}else{
    echo "Please Fill in all Fields!
    ";
    }
    echo "<hr />\n";
    echo "<a href=\"$PHP_SELF\">Home</a>
    \n";
    echo "</div>\n";
    echo "<div style=\"background-color:#FF0000; color:#FFFFFF;\" align=\"center\">\n";
    echo "[b][size="1"]&copy; SpiderWap[/size][/b]";
    echo "</div>\n";
    echo "</body>\n";
    echo "</html>\n";
    exit();
    }

    Click here!!!

    #2
    Funmobile script already got reserved/forbiden nicks included..... So take a look there nd ull came up with idea
    sigpiceeeeerrr....

    Comment


      #3
      thanx alesh

      Click here!!!

      Comment


        #4
        This should work $forbidden_dirs = Array("cgi-bin","tmp","folder3","folder4"); are the names of the files and directories you dont want using

        Code:
        elseif($spider=="register1")
        {
        $forbidden_dirs = Array("cgi-bin","tmp","folder3","folder4");
        echo "<div style=\"background-color:#FF0000; color:#FFFFFF;\" align=\"center\">\n";
        echo "[b][size="1"]Register[/size][/b]";
        echo "</div>\n";
        echo "<div align=\"center\">\n";
        if($name!=""||$pass!=""){
        $name = $_POST[&#39;name&#39;];
        $name= strtolower($name);
        $query= ("INSERT INTO `users`
                ( `id`,
                `name` ,
                `pass`,
                `rtime`,
                `ip`,
                `soft` )
                values(&#39;&#39;,&#39;$name&#39;,&#39;$pass&#39;,&#39;".time()."&#39;,&#39;".getenv(REMOTE_ADDR)."&#39;,&#39;".getenv(HTTP_USER_AGENT)."&#39;);");
        $name=$_POST[&#39;name&#39;];
        $result = mysql_query($query);
        if(!$result) echo "Error
        \n";
        if(!$result){echo "Username exists, try another one
        <a href=\"$PHP_SELF?spider=register\">Register</a>
        \n";
        }else{
        $name=$_POST[&#39;name&#39;];
        if(in_array($name)){
        echo "[b]The name ".$name." is reserved please use another one[/b]
        ";
        echo "<hr />\n";
        echo "<a href=\"$PHP_SELF\">Home</a>
        \n";
        echo "</div>\n";
        echo "<div style=\"background-color:#FF0000; color:#FFFFFF;\" align=\"center\">\n";
        echo "[b][size="1"]&copy; SpiderWap[/size][/b]";
        echo "</div>\n";
        echo "</body>\n";
        echo "</html>\n";
        exit();
        }
        
        mkdir("$name");
        @ chmod("$name",0755);
        mkdir("$name/files");
        @ chmod("$name/files",0755);
        mkdir("$name/pics");
        @ chmod("$name/pics",0755);
        $fp = fopen(addslashes($_POST[&#39;name&#39;]) . &#39;/index.php&#39;, &#39;w&#39;);
        $clear_page = <<<CLEARPAGE
        <?
        header("location: ../sites/index.php?name=$name");
        CLEARPAGE;
        fputs($fp, $clear_page);
        
        /*
        file("http://$cpaneluser:$cpanelpass@$domain:2082/frontend/x/subdomain/doadddomain.html?domain=$name&rootdomain=$domain
        ");
        */
        echo "Registration Successful!
        \n";
        echo "<hr />\n";
        echo "</div>\n";
        echo "[b]Username:[/b] ".$name."
        \n";
        echo "[b]Password:[/b] ".$pass."
        \n";
        echo "------
        \n";
        echo "Your site can be viewd at:
        \n";
        echo "http://spiderwap.co.za/".$name."";
        echo "<div align=\"center\">\n";
        echo "<hr />\n";
        echo "<a href=\"$PHP_SELF?spider=menu&amp;name=$name&amp;pass=$pass\">Enter</a>
        \n";
        }}else{
        echo "Please Fill in all Fields!
        ";
        }
        echo "<hr />\n";
        echo "<a href=\"$PHP_SELF\">Home</a>
        \n";
        echo "</div>\n";
        echo "<div style=\"background-color:#FF0000; color:#FFFFFF;\" align=\"center\">\n";
        echo "[b][size="1"]&copy; SpiderWap[/size][/b]";
        echo "</div>\n";
        echo "</body>\n";
        echo "</html>\n";
        exit();
        }

        Comment


          #5
          Thank you m8 I&#39;m trying it now. to be honest i never thought of doing it that way....

          Thank you very much.

          Click here!!!

          Comment


            #6
            i just noticed something i did wrong

            in_array($name)

            should be

            in_array($name,$forbidden_dirs)

            Comment


              #7
              Thanx m8, well ya, coding my own script, but thanx you helped me alot with this one.

              Click here!!!

              Comment


                #8
                M8, still something wrong...

                When registering it says that the name is reserved but it still puts the username into the database, i&#39;ll check quick if i cant see whats wrong.

                Click here!!!

                Comment


                  #9
                  the query was above the check that should fix that

                  Code:
                  elseif($spider=="register1")
                  {
                  $forbidden_dirs = Array("cgi-bin","tmp","folder3","folder4");
                  echo "<div style=\"background-color:#FF0000; color:#FFFFFF;\" align=\"center\">\n";
                  echo "[b][size="1"]Register[/size][/b]";
                  echo "</div>\n";
                  echo "<div align=\"center\">\n";
                  if($name!=""||$pass!=""){
                  $name = $_POST[&#39;name&#39;];
                  $name= strtolower($name);
                  if(in_array($name,$forbidden_dirs)){
                  echo "[b]The name ".$name." is reserved please use another one[/b]
                  ";
                  echo "<hr />\n";
                  echo "<a href=\"$PHP_SELF\">Home</a>
                  \n";
                  echo "</div>\n";
                  echo "<div style=\"background-color:#FF0000; color:#FFFFFF;\" align=\"center\">\n";
                  echo "[b][size="1"]&copy; SpiderWap[/size][/b]";
                  echo "</div>\n";
                  echo "</body>\n";
                  echo "</html>\n";
                  exit();
                  }
                  $query= ("INSERT INTO `users`
                          ( `id`,
                          `name` ,
                          `pass`,
                          `rtime`,
                          `ip`,
                          `soft` )
                          values(&#39;&#39;,&#39;$name&#39;,&#39;$pass&#39;,&#39;".time()."&#39;,&#39;".getenv(REMOTE_ADDR)."&#39;,&#39;".getenv(HTTP_USER_AGENT)."&#39;);");
                  $name=$_POST[&#39;name&#39;];
                  $result = mysql_query($query);
                  if(!$result) echo "Error
                  \n";
                  if(!$result){echo "Username exists, try another one
                  <a href=\"$PHP_SELF?spider=register\">Register</a>
                  \n";
                  }else{
                  $name=$_POST[&#39;name&#39;];
                  mkdir("$name");
                  @ chmod("$name",0755);
                  mkdir("$name/files");
                  @ chmod("$name/files",0755);
                  mkdir("$name/pics");
                  @ chmod("$name/pics",0755);
                  $fp = fopen(addslashes($_POST[&#39;name&#39;]) . &#39;/index.php&#39;, &#39;w&#39;);
                  $clear_page = <<<CLEARPAGE
                  <?
                  header("location: ../sites/index.php?name=$name");
                  CLEARPAGE;
                  fputs($fp, $clear_page);
                  
                  /*
                  file("http://$cpaneluser:$cpanelpass@$domain:2082/frontend/x/subdomain/doadddomain.html?domain=$name&rootdomain=$domain
                  ");
                  */
                  echo "Registration Successful!
                  \n";
                  echo "<hr />\n";
                  echo "</div>\n";
                  echo "[b]Username:[/b] ".$name."
                  \n";
                  echo "[b]Password:[/b] ".$pass."
                  \n";
                  echo "------
                  \n";
                  echo "Your site can be viewd at:
                  \n";
                  echo "http://spiderwap.co.za/".$name."";
                  echo "<div align=\"center\">\n";
                  echo "<hr />\n";
                  echo "<a href=\"$PHP_SELF?spider=menu&amp;name=$name&amp;pass=$pass\">Enter</a>
                  \n";
                  }}else{
                  echo "Please Fill in all Fields!
                  ";
                  }
                  echo "<hr />\n";
                  echo "<a href=\"$PHP_SELF\">Home</a>
                  \n";
                  echo "</div>\n";
                  echo "<div style=\"background-color:#FF0000; color:#FFFFFF;\" align=\"center\">\n";
                  echo "[b][size="1"]&copy; SpiderWap[/size][/b]";
                  echo "</div>\n";
                  echo "</body>\n";
                  echo "</html>\n";
                  exit();
                  }

                  Comment


                    #10
                    Lol thanx m8 i&#39;ll try this one.

                    Click here!!!

                    Comment


                      #11
                      Code:
                      elseif($spider=="register1")
                      {
                      $forbidden_dirs = array("cgi-bin","tmp","_vti_bin","_vti_cnf","_vti_log","_vti_pvt","_vti_txt","downloads","emulator","flags","flags","ringtones","top","wap");
                      echo "<div style=\"background-color:#FF0000; color:#FFFFFF;\" align=\"center\">\n";
                      echo "[b][size="1"]Register[/size][/b]";
                      echo "</div>\n";
                      echo "<div align=\"center\">\n";
                      if($name!=""||$pass!=""){
                      $name = $_POST[&#39;name&#39;];
                      $name= strtolower($name);
                      if(array($name)){
                      echo "[b]The name ".$name." is reserved please use another one[/b]
                      ";
                      echo "<hr />\n";
                      echo "<a href=\"$PHP_SELF\">Home</a>
                      \n";
                      echo "</div>\n";
                      echo "<div style=\"background-color:#FF0000; color:#FFFFFF;\" align=\"center\">\n";
                      echo "[b][size="1"]&copy; SpiderWap[/size][/b]";
                      echo "</div>\n";
                      echo "</body>\n";
                      echo "</html>\n";
                      exit();
                      }
                      $query= ("INSERT INTO `users`
                              ( `id`,
                              `name` ,
                              `pass`,
                              `rtime`,
                              `ip`,
                              `soft` )
                              values(&#39;&#39;,&#39;$name&#39;,&#39;$pass&#39;,&#39;".time()."&#39;,&#39;".getenv(REMOTE_ADDR)."&#39;,&#39;".getenv(HTTP_USER_AGENT)."&#39;);");
                      $name=$_POST[&#39;name&#39;];
                      $result = mysql_query($query);
                      if(!$result) echo "Error
                      \n";
                      if(!$result){echo "Username exists, try another one
                      <a href=\"$PHP_SELF?spider=register\">Register</a>
                      \n";
                      }else{
                      $name=$_POST[&#39;name&#39;];
                      mkdir("$name");
                      @ chmod("$name",0755);
                      mkdir("$name/files");
                      @ chmod("$name/files",0755);
                      mkdir("$name/pics");
                      @ chmod("$name/pics",0755);
                      $fp = fopen(addslashes($_POST[&#39;name&#39;]) . &#39;/index.php&#39;, &#39;w&#39;);
                      $clear_page = <<<CLEARPAGE
                      <?
                      header("location: ../sites/index.php?name=$name");
                      CLEARPAGE;
                      fputs($fp, $clear_page);
                      
                      /*
                      file("http://$cpaneluser:$cpanelpass@$domain:2082/frontend/x/subdomain/doadddomain.html?domain=$name&rootdomain=$domain
                      ");
                      */
                      echo "Registration Successful!
                      \n";
                      echo "<hr />\n";
                      echo "</div>\n";
                      echo "[b]Username:[/b] ".$name."
                      \n";
                      echo "[b]Password:[/b] ".$pass."
                      \n";
                      echo "------
                      \n";
                      echo "Your site can be viewd at:
                      \n";
                      echo "http://spiderwap.co.za/".$name."";
                      echo "<div align=\"center\">\n";
                      echo "<hr />\n";
                      echo "<a href=\"$PHP_SELF?spider=menu&amp;name=$name&amp;pass=$pass\">Enter</a>
                      \n";
                      }}else{
                      echo "Please Fill in all Fields!
                      ";
                      }
                      echo "<hr />\n";
                      echo "<a href=\"$PHP_SELF\">Home</a>
                      \n";
                      echo "</div>\n";
                      echo "<div style=\"background-color:#FF0000; color:#FFFFFF;\" align=\"center\">\n";
                      echo "[b][size="1"]&copy; SpiderWap[/size][/b]";
                      echo "</div>\n";
                      echo "</body>\n";
                      echo "</html>\n";
                      exit();
                      }
                      Ok m8 this is how i done it now, now i get

                      The name quintin is reserved please use another one[/b]

                      Click here!!!

                      Comment


                        #12
                        Good luck with your builder mate

                        Comment


                          #13
                          lol thanx, im always ready for go only a few things, but this is my main worry atm.

                          Click here!!!

                          Comment


                            #14
                            try this you did it wrong

                            Code:
                            elseif($spider=="register1")
                            {
                            $forbidden_dirs = array("cgi-bin","tmp","_vti_bin","_vti_cnf","_vti_log","_vti_pvt","_vti_txt","downloads","emulator","flags","flags","ringtones","top","wap");
                            echo "<div style=\"background-color:#FF0000; color:#FFFFFF;\" align=\"center\">\n";
                            echo "[b][size="1"]Register[/size][/b]";
                            echo "</div>\n";
                            echo "<div align=\"center\">\n";
                            if($name!=""||$pass!=""){
                            $name = $_POST[&#39;name&#39;];
                            $name= strtolower($name);
                            if(in_array($name,$forbidden_dirs)){
                            echo "[b]The name ".$name." is reserved please use another one[/b]
                            ";
                            echo "<hr />\n";
                            echo "<a href=\"$PHP_SELF\">Home</a>
                            \n";
                            echo "</div>\n";
                            echo "<div style=\"background-color:#FF0000; color:#FFFFFF;\" align=\"center\">\n";
                            echo "[b][size="1"]&copy; SpiderWap[/size][/b]";
                            echo "</div>\n";
                            echo "</body>\n";
                            echo "</html>\n";
                            exit();
                            }
                            $query= ("INSERT INTO `users`
                                    ( `id`,
                                    `name` ,
                                    `pass`,
                                    `rtime`,
                                    `ip`,
                                    `soft` )
                                    values(&#39;&#39;,&#39;$name&#39;,&#39;$pass&#39;,&#39;".time()."&#39;,&#39;".getenv(REMOTE_ADDR)."&#39;,&#39;".getenv(HTTP_USER_AGENT)."&#39;);");
                            $name=$_POST[&#39;name&#39;];
                            $result = mysql_query($query);
                            if(!$result) echo "Error
                            \n";
                            if(!$result){echo "Username exists, try another one
                            <a href=\"$PHP_SELF?spider=register\">Register</a>
                            \n";
                            }else{
                            $name=$_POST[&#39;name&#39;];
                            mkdir("$name");
                            @ chmod("$name",0755);
                            mkdir("$name/files");
                            @ chmod("$name/files",0755);
                            mkdir("$name/pics");
                            @ chmod("$name/pics",0755);
                            $fp = fopen(addslashes($_POST[&#39;name&#39;]) . &#39;/index.php&#39;, &#39;w&#39;);
                            $clear_page = <<<CLEARPAGE
                            <?
                            header("location: ../sites/index.php?name=$name");
                            CLEARPAGE;
                            fputs($fp, $clear_page);
                            
                            /*
                            file("http://$cpaneluser:$cpanelpass@$domain:2082/frontend/x/subdomain/doadddomain.html?domain=$name&rootdomain=$domain
                            ");
                            */
                            echo "Registration Successful!
                            \n";
                            echo "<hr />\n";
                            echo "</div>\n";
                            echo "[b]Username:[/b] ".$name."
                            \n";
                            echo "[b]Password:[/b] ".$pass."
                            \n";
                            echo "------
                            \n";
                            echo "Your site can be viewd at:
                            \n";
                            echo "http://spiderwap.co.za/".$name."";
                            echo "<div align=\"center\">\n";
                            echo "<hr />\n";
                            echo "<a href=\"$PHP_SELF?spider=menu&amp;name=$name&amp;pass=$pass\">Enter</a>
                            \n";
                            }}else{
                            echo "Please Fill in all Fields!
                            ";
                            }
                            echo "<hr />\n";
                            echo "<a href=\"$PHP_SELF\">Home</a>
                            \n";
                            echo "</div>\n";
                            echo "<div style=\"background-color:#FF0000; color:#FFFFFF;\" align=\"center\">\n";
                            echo "[b][size="1"]&copy; SpiderWap[/size][/b]";
                            echo "</div>\n";
                            echo "</body>\n";
                            echo "</html>\n";
                            exit();
                            }

                            Comment


                              #15
                              lol alright, thanx m8, just edited again... gana ftp, if it works right then im gana call it a early night, im so dumm cause of little sleep lol

                              Click here!!!

                              Comment

                              Working...
                              X