billb Posted September 4, 2007 Share Posted September 4, 2007 Hi to all I have a forum with severe problem. will not allow any member to upload any type of files. I am unfamiliar with PHP when I contacted the web host they said it is a program issue not the server. Is it possible for someone to write the entire code to do the trick? I was told it is very risky for the entire forum just to copy a simple code for upload.php file....I am not sure what information you need but any help is greatly appreciated. Thanks to you all...... Quote Link to comment https://forums.phpfreaks.com/topic/67854-forum-does-not-allow-members-to-upload-files/ Share on other sites More sharing options...
darkfreaks Posted September 4, 2007 Share Posted September 4, 2007 code please? Quote Link to comment https://forums.phpfreaks.com/topic/67854-forum-does-not-allow-members-to-upload-files/#findComment-341085 Share on other sites More sharing options...
teng84 Posted September 4, 2007 Share Posted September 4, 2007 http://w3schools.com/php/php_file_upload.asp :-\read Quote Link to comment https://forums.phpfreaks.com/topic/67854-forum-does-not-allow-members-to-upload-files/#findComment-341090 Share on other sites More sharing options...
billb Posted September 4, 2007 Author Share Posted September 4, 2007 This is what is coded in the upload.php file.....The funny looking letters are only foreign language translation...Is this what you mean by the code? Thanks for your fast reply. </head></html> <html dir="rtl"> <div align="center"> <center> <table border="0" cellspacing="1" style="border-collapse: collapse" width="750" id="AutoNumber1"> <tr> <td width="100%"> <html dir="rtl"> <body> <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#547886" width="77%" id="AutoNumber1"> <tr> <td width="100%" background="http://www.xxxxxxxxxxxx/images/bbb2.jpg" height="124"> <img border="0" src="http://www.xxxxxxxxxxxx/images/bbb.jpg" width="750" height="124"></td> </tr> <tr> <td width="100%" background="http://www.xxxxxxxxxxxxx/images/bbb4.jpg" height="90"> <map name="FPMap0"> <area href="http://www.xxxxxxxxxxxxx/vb/index.php" shape="rect" coords="640, 28, 726, 53" target="_blank"> <area href="http://www.xxxxxxxxxxx/dros/" shape="rect" coords="544, 30, 614, 49" target="_blank"> <area href="http://www.xxxxxxxxxx/gallery/" shape="rect" coords="467, 30, 532, 43" target="_blank"> <area href="http://www.xxxxxxxxxxx/upload/upload.php" shape="rect" coords="321, 31, 378, 47" target="_blank"> <area href="http://www.xxxxx/card" shape="rect" coords="238, 31, 313, 47" target="_blank"> <area href="http://www.xxxxxxxx/downloads/pafiledb.php" shape="rect" coords="159, 31, 223, 43" target="_blank"> <area href="http://www.xxxxxxxxx/my40h/40h.php" shape="rect" coords="73, 30, 147, 49" target="_blank"> <area href="http://www.xxxxxxxxxx/mail/" shape="rect" coords="19, 29, 66, 44" target="_blank"> </map> <img border="0" src="http://www.xxxxxxxxxx/images/bbb3.jpg" width="750" height="90" usemap="#FPMap0"></td> </tr> </table> </center> </html> <body bgcolor="#D4E8EF"> </div> <?PHP include "config.php"; $exten=""; $number_of_exten = count ($allowed_extensions); $number_of_uploads = count ($path); switch ( $ta7meel ) { default: echo "<body topmargin=\"10\" leftmargin=\"0\" bgcolor=\"#254652\" link=\"#818EA0\" vlink=\"#5C697A\" alink=\"#818EA0\" text=\"#254652\" style=\"font-family: Verdana; font-size: 8pt; color: #254652\"> <div align=\"center\"> <center> <table border=1 cellpadding=0 cellspacing=\"0\" style=\"\"\"""border-collapse:;border-width:4; border-style:ridge; border-collapse:collapse\" border-width:3; border-collapse:collapse\" bordercolor=#056085 width=750 id=\"AutoNumber1\" height=340> <td bgcolor=#EDF9FC colspan=\"3\" height=285 width=639> <ul type=\"square\" dir=rtl> <li dir=rtl> <p dir=rtl align=right> <font color=\"#2B515F\" face=\"Tahoma\">ÇáãáÝÇÊ ÇáãÓãæÍ ÈåÇ<font size=\"2\"> <b>"; // ÇäÊåíäÇ ãä ØÈÇÚÉ ÇáÅØÇÑ ÇáÎÇÑÌí ááÌÏæá ¡ æ ÇáåíÏÑ if (($limited_ext != "äÚã") or ($allowed_extensions == "")) echo "Ãí ÇãÊÏÇÏ"; else for($i=0; $i<$number_of_exten; $i++) echo " $allowed_extensions[$i]"; if (($size_limited != "äÚã") or ($limited_size == "") ) $limited_size = "Ãí ÍÌã"; else $limited_size .= " ÈÇíÊ"; //limited_size åÐí ÚÑÝäÇåÇ Ýí ãáÝ ÇáßæäÝíÞ ¡ äÖíÝ áå ÝÞØ ßáãÉ ÈÇíÊ echo"</b></font></font></li> <li dir=rtl> <p dir=rtl align=right> <font color=\"#2B515F\" face=\"Tahoma\"> ÃÞÕì ÍÌã ãÓãæÍ Èå: <font size=\"2\">$limited_size</font></font></li> <li dir=rtl> <p dir=rtl align=right> <font color=\"#2B515F\" face=\"Tahoma\">ÇÓã ÇáãáÝ íÌÈ ÃáÇ íÍÊæí Úáì ãÓÇÝÇÊ Ãæ ÑãæÒ</font></li> </li> <li dir=rtl> <p dir=rtl align=right> <font color=\"#2B515F\" face=\"Tahoma\">íÌÈ ßÊÇÈÉ ÇÓã ÇáãáÝ ÈÃÍÑÝ ÅäÌáíÒíå ÝÞØ</font></li> </li> <li dir=rtl> <p dir=rtl align=right> <font color=\"#2B515F\" face=\"Tahoma\">ÅÓã ÇáãÓÊÎÏã æßáãÉ ÇáãÑæÑ ÊÕáßã ÚÈÑ ÇáÑÓÇÆá ÇáÎÇÕÉ ÈÇáãäÊÏì </font></li> <li dir=rtl> <p dir=rtl align=right> <font color=\"#E60C35\" face=\"Tahoma\">ÞÇá Çááå ÓÈÍÇä æÊÚÇáì : (æãÇ íáÝÙ ãä ÞæáÇ ÇáÇ áÏíå ÑÞíÈ ÚÊíÏ ) ÝÅÊÞí Çááå íÇ ÇÎí æÇÍÓä ÇÓÊÎÏÇã åÐ Ç ÇáÈÑäÇãÌ </font></li> </li> </ul> <form method=\"POST\" action=\"$PHP_SELF?ta7meel=uploading\" enctype=\"multipart/form-data\">"; if ($protect_uploader=="äÚã") echo" <p align=right dir=\"rtl\"> <font color=\"#2B515F\"> <span lang=\"ar-sa\"><font face=\"Tahoma\"> ÇÓã ÇáãÓÊÎÏã:</font> </span> <input type=\"text\" name=\"username1\" size=\"20\"></p> <p align=right dir=\"rtl\"> <font face=\"Tahoma\"> <span lang=\"ar-sa\"> ßáãÉ ÇáãÑæÑ:</span></font><span lang=\"ar-sa\"><font face=\"Tahoma\"> </font> </span><input type=\"password\" name=\"password1\" size=\"20\"> "; echo" <p align=center dir=\"rtl\"> <input type=file name=file size=30 style=\"\"border-style:; border-style:groove; border-width:2; \" groove; border-width: 1\"></p> <p align=center> <button name=\"submit\" type=\"submit\" style=\"\"border-style:; border-style:groove; border-width:2; \" groove; border-width: 1\"> ÊÍãíá</button></p></form></td></tr> <tr><td bgcolor=#71A1AD height=24 colspan=\"3\" width=639> </tr></p></table></center></div></center></div></body></html><p align=\"center\">"; break; //============================================================================================================ case "uploading": $result = "<font size=\"2\" color=\"black\"><BR>Êã ÊÍãíá ÇáãáÝ ÈäÌÇÍ !!<BR></font>"; if (($protect_uploader=="äÚã") && ($password!=$password1 || $username!=$username1)) $result = "<font size=\"2\" color=\"sienna\"><BR><BR>ÊÃßÏ ãä ÕÍÉ ßáãÉ ÇáãÑæÑ æ ÇÓã ÇáãÓÊÎÏã !!<BR><BR></font>"; elseif ($file_name == "") $result = "<BR><BR><font size=\"2\" color=\"sienna\">áã ÊÞã ÈÇÎÊíÇÑ Ãí ãáÝ !</font><BR><BR>"; elseif(file_exists("$path/$file_name")) $result = "<BR><BR><font size=\"2\" color=\"sienna\">ÇáãáÝ ãæÌæÏ ãÓÈÞÇ</font><BR><BR>"; elseif (($size_limited == "äÚã") && ($file_size > $limited_size)) $result = "<BR><BR><font size=\"2\" color=\"sienna\">ÍÌã ÇáãáÝ ÃßÈÑ ãä ÇáãÓãæÍ Èå ¡ ÃÞÕì ÍÌã ãÓãæÍ Èå åæ $limited_size ÈÇíÊ</font><BR><BR>"; else{ // ÈÏÇíÉ else $exten = strrchr($file_name,'.'); if (($limited_ext == "äÚã") && (!in_array( $exten , $allowed_extensions )) && ($exten!="")) $result = "<BR><BR><font size=\"2\" color=\"sienna\">ÚÐÑÇ -- áÇ íÓãÍ ÈÑÝÚ ÇáãáÝÇÊ ÐÇÊ ÇáÇãÊÏÇÏ $exten</font><BR><BR>"; else { for ($i=0;$i<$number_of_uploads;$i++) (@copy($file, "$path[$i]/$file_name") and $uploading_result[$i]="Êã ÊÍãíá ÇáãáÝ ÈäÌÇÍ") or $uploading_result[$i]="ÍÏË ÎØà Ýí äÓÎ ÇáãÌáÏ $path[$i]"; } } // else echo "<html><head><title></title></head><BR><BR><BR><BR><body topmargin=\"10\"leftmargin=\"0\" bgcolor=#51747E link=\"#818EA0\" vlink=\"#5C697A\"alink=\"#818EA0\" text=\"#000000\"></p> <div align=\"center\"><center><table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"border-collapse: collapse\" bordercolor=\"#51747E\" width=\"400\" id=\"AutoNumber1\"><tr><td bgcolor=\"51747E\" height=\"25\"> <p align=center><b> ÏÈí</b></td></tr><tr><td bgcolor=\"#EDF9FC\"><center>"; if ($result=="<font size=\"2\" color=\"black\"><BR> !!<BR></font>"){ if (empty($uploading_result)) echo $result; else for ($i=0;$i<=$number_of_uploads;$i++) echo ("$uploading_result[$i] <BR>");} else echo $result; "<BR>"; if ($result=="<font size=\"2\" color=\"black\"><BR>Êã ÊÍãíá ÇáãáÝ ÈäÌÇÍ !!<BR></font>") { if (($exten=='.jpg' || $exten=='.gif' || $exten=='.bmp' || $exten=='.png' || $exten=='.jpe')) echo :<BR><BR><img src=$path[0]/$file_name><BR>"; echo ("http://xxxxxxxxx/upload/dant/$file_name<font color=2B515F></font");} echo"</center></td></tr> <tr><td bgcolor=\"51747E\" height=\"25\"> <p align=\"center\">www.xxxxxxxxxxxx</td></tr></table></center></div></body></html> <p align=\"center\">"; /*echo "<font color=blue>"; $dir=dir($DOCUMENT_ROOT.dirname($PHP_SELF)); while ($dir_entry=$dir->read()) { echo $dir->path ."/" . $dir_entry; echo"<BR>"; } echo"</font>";*/ break; }// switch ?> Quote Link to comment https://forums.phpfreaks.com/topic/67854-forum-does-not-allow-members-to-upload-files/#findComment-341104 Share on other sites More sharing options...
billb Posted September 4, 2007 Author Share Posted September 4, 2007 http://w3schools.com/php/php_file_upload.asp :-\read This is very useful and for sure in the right direction....Can you tell me if implemented in the exact manner will it be secured ? ie can members upload some bad files affecting the database etc? Thank you for the help....This is a great forum indeed. Sorry it is PHP 4.4.7 Quote Link to comment https://forums.phpfreaks.com/topic/67854-forum-does-not-allow-members-to-upload-files/#findComment-341108 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.