Its working well in html but ive get errors after trying to modify it to xhtml. When i try to check it to a validator to get the errors and fix it, i just ended up getting more errors and 1 of the error is, the UPLOAD Button doesnt work.
Can sumone help me fix it? Ill be thankful if anyone will do. Btw, heres the code..
<div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-space:pre;overflow:auto'><?php
header("Content-Type: application/xhtml+xml");
echo '<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"><head>
<meta http-equiv="cache-Control" content="no-cache" />
<title>MobileShare :: Upload Files</title>
<link rel="shortcut icon" href="data/favicon.ico" type="image/x-icon" />
<link href="upload_script.css" rel="stylesheet" type="text/css"/>
</head><body>
<div><a accesskey="2" id="top"></a></div>
<p class="head">Upload Files</p>';
include 'config.php';
include 'count.php';
$brws = explode(" ",$_SERVER[HTTP_USER_AGENT] );
$ubr = $brws[0];
$ip=getenv('REMOTE_ADDR');
$brws2= mysql_fetch_array(mysql_query("SELECT * FROM ipban WHERE browser='".$ubr."' and ip='".$ip."'"));
if ($brws2){
echo '<title>Banned!!!</title>
[img]images/exit.gif[/img]
If u see this this means your IP and browser has been banned from uploading
</p>
</body></html>';
exit();
}
echo '<title>Upload Files</title>';
if ($upload="upload"&&$superdat_name){
if (!eregi("\.(mid|gif|bmp|midi|3gp|mp4|avi|mp3|m4a|a ac|wav|mpn|nth|mpc|jar|jpeg|jpg|sis
sisx|mmf|amr|thm|png|wbmp){:content:}quot;,$superd at_name)){
echo "
Unsuported File extention!!!";
}else{
$superdat_name = preg_replace(
'/[^a-zA-Z0-9\.\$\%\'\`\-\@\{\}\~\!\#\(\)\&\_\^]/'
,'',str_replace(array(' ','%20'),array('_','_' ),$superdat_name));
if(strlen($superdat_name)>53){
echo "File Name to long!!!";
}else{
if (empty($superdat)) {
echo "No input file specified!!!";
}else{
if (file_exists("".$dir."/".$superdat.""))
{
echo "File already exists!!!
<a href=\"upload.php\">Upload xhtml</a>
<a href=\"index.php\">File Categories</a></p>
<p class='foot'>
^
</p>
</body>
</html>";
exit();
}
copy("$superdat", "$dir/$superdat_name") or
die("Couldn't copy file.");
$fsize=round($superdat_size/1024,1);
$brws = explode(" ",$_SERVER[HTTP_USER_AGENT] );
$ubr = $brws[0];
$ip=getenv('REMOTE_ADDR');
$rev = strrev ($superdat_name);
$exp = explode (".", $rev);
$true = strrev ($exp[0]);
$trueext = strtolower ($true);
$adds=mysql_query("INSERT INTO upload SET file='".$superdat_name."',name='".$nam e."',description='".$desc."',size=' ;".$fsize."',filename='".$fname."',fty pe='".$trueext."',dir='".$dir."',b rowser='".$ubr."',ip='".$ip."'");
if ($adds) {
echo "Added
File: $superdat_name
File Name: $fname
Name: $name
Description: $desc
File Size: $fsize KB
File Type:*.$trueext
";
} else {
echo "Please try again
";
}
echo "File has been successfully uploaded";
}
}
}
}
echo '<form action="upload.php" method="post" ENCTYPE="multipart/form-data" />
Your Name:
<input type="text" name="name" size="30" />
File Name:
<input type="text" name="fname" size="30" />
Description:
<textarea name="desc" rows="3" cols="40"></textarea>
File to be uploaded:
<input type="file" name="superdat" size="30"/>
Upload files with folowing extentions: *.mid *.gif *.bmp *.midi *.3gp *.mp4 *.avi *.mp3 *.m4a *.aac *.wav *.mpn *.nth *.mpc *.jar *.jpeg *.jpg *.sis *.sisx *.mmf *.amr *.thm *.png *.wbmp
Select Category:
<select name="dir" value="">
<option value="">Select Here</option>
<option value="wallpapers">Wallpapers/Photos</option>
<option value="videos">Videos</option>
<option value="games">Games</option>
<option value="ringtones">Ringtones</option>
<option value="applications">Applications</option>
<option value="themes">Themes</option>
<option value="personal">PersonalPhotos/Videos</option>
<option value="other">Other</option>
<option value="adultp">Adult Wallpapers/Photos 18+</option>
<option value="adultv">Adult Videos 18+</option>
</select>
<input type="submit" value="Upload File"/>
<p class="foot">
MobileShare
^
</p>
</body>
</html>';
?>
</div>
Can sumone help me fix it? Ill be thankful if anyone will do. Btw, heres the code..
<div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-space:pre;overflow:auto'><?php
header("Content-Type: application/xhtml+xml");
echo '<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"><head>
<meta http-equiv="cache-Control" content="no-cache" />
<title>MobileShare :: Upload Files</title>
<link rel="shortcut icon" href="data/favicon.ico" type="image/x-icon" />
<link href="upload_script.css" rel="stylesheet" type="text/css"/>
</head><body>
<div><a accesskey="2" id="top"></a></div>
<p class="head">Upload Files</p>';
include 'config.php';
include 'count.php';
$brws = explode(" ",$_SERVER[HTTP_USER_AGENT] );
$ubr = $brws[0];
$ip=getenv('REMOTE_ADDR');
$brws2= mysql_fetch_array(mysql_query("SELECT * FROM ipban WHERE browser='".$ubr."' and ip='".$ip."'"));
if ($brws2){
echo '<title>Banned!!!</title>
[img]images/exit.gif[/img]
If u see this this means your IP and browser has been banned from uploading
</p>
</body></html>';
exit();
}
echo '<title>Upload Files</title>';
if ($upload="upload"&&$superdat_name){
if (!eregi("\.(mid|gif|bmp|midi|3gp|mp4|avi|mp3|m4a|a ac|wav|mpn|nth|mpc|jar|jpeg|jpg|sis
sisx|mmf|amr|thm|png|wbmp){:content:}quot;,$superd at_name)){
echo "
Unsuported File extention!!!";
}else{
$superdat_name = preg_replace(
'/[^a-zA-Z0-9\.\$\%\'\`\-\@\{\}\~\!\#\(\)\&\_\^]/'
,'',str_replace(array(' ','%20'),array('_','_' ),$superdat_name));
if(strlen($superdat_name)>53){
echo "File Name to long!!!";
}else{
if (empty($superdat)) {
echo "No input file specified!!!";
}else{
if (file_exists("".$dir."/".$superdat.""))
{
echo "File already exists!!!
<a href=\"upload.php\">Upload xhtml</a>
<a href=\"index.php\">File Categories</a></p>
<p class='foot'>
^
</p>
</body>
</html>";
exit();
}
copy("$superdat", "$dir/$superdat_name") or
die("Couldn't copy file.");
$fsize=round($superdat_size/1024,1);
$brws = explode(" ",$_SERVER[HTTP_USER_AGENT] );
$ubr = $brws[0];
$ip=getenv('REMOTE_ADDR');
$rev = strrev ($superdat_name);
$exp = explode (".", $rev);
$true = strrev ($exp[0]);
$trueext = strtolower ($true);
$adds=mysql_query("INSERT INTO upload SET file='".$superdat_name."',name='".$nam e."',description='".$desc."',size=' ;".$fsize."',filename='".$fname."',fty pe='".$trueext."',dir='".$dir."',b rowser='".$ubr."',ip='".$ip."'");
if ($adds) {
echo "Added
File: $superdat_name
File Name: $fname
Name: $name
Description: $desc
File Size: $fsize KB
File Type:*.$trueext
";
} else {
echo "Please try again
";
}
echo "File has been successfully uploaded";
}
}
}
}
echo '<form action="upload.php" method="post" ENCTYPE="multipart/form-data" />
Your Name:
<input type="text" name="name" size="30" />
File Name:
<input type="text" name="fname" size="30" />
Description:
<textarea name="desc" rows="3" cols="40"></textarea>
File to be uploaded:
<input type="file" name="superdat" size="30"/>
Upload files with folowing extentions: *.mid *.gif *.bmp *.midi *.3gp *.mp4 *.avi *.mp3 *.m4a *.aac *.wav *.mpn *.nth *.mpc *.jar *.jpeg *.jpg *.sis *.sisx *.mmf *.amr *.thm *.png *.wbmp
Select Category:
<select name="dir" value="">
<option value="">Select Here</option>
<option value="wallpapers">Wallpapers/Photos</option>
<option value="videos">Videos</option>
<option value="games">Games</option>
<option value="ringtones">Ringtones</option>
<option value="applications">Applications</option>
<option value="themes">Themes</option>
<option value="personal">PersonalPhotos/Videos</option>
<option value="other">Other</option>
<option value="adultp">Adult Wallpapers/Photos 18+</option>
<option value="adultv">Adult Videos 18+</option>
</select>
<input type="submit" value="Upload File"/>
<p class="foot">
MobileShare
^
</p>
</body>
</html>';
?>
</div>
Comment