Jump to content

Recommended Posts

Well with the help of MadTechie in my other thread i managed to get the script i was using working (its a script to upload and sell images, the script was pre-made but not working so i had to fix bits here and there to get it working). Basically the two pages i was having problems with are now giving me a new problem, I will show screenshots below:

 

I put my pass into the admin page:

prob1rh8.th.jpg

 

that goes fine, it takes me to this page:

 

prob2rb7.th.jpg

 

and it takes me to a password page again.... is this right...?

 

prob3bn3.th.jpg

 

okay so i type my pass in and i get this... i fill it all in....

 

prob4ml0.th.jpg

 

then i press submit and look it asks me for my pass again.

 

prob5wo0.th.jpg

 

and bang it puts me back here with no image uploaded :-(

 

prob6hi8.th.jpg

 

 

okay so heres the code for those two pages:

 

admin.php

 

<html>
<head>
<title>upload form</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript">
function pre() {
form2.preview.src = 'thumbnails/image'+form2.choiceimage.options[form2.choiceimage.selectedIndex].value+'.jpg';
}
</script>
</head>
<body bgcolor="#000000" text="#CCCCCC" link="#FF3300" vlink="#FF3300">
<div align="center"><font color="#FF3300" face="Arial, Helvetica, sans-serif"><strong>GALLERY
  ADMIN PAGE</strong></font><br>
</div>
<?php
include("config.inc");
if ($_POST['password']==$adpass) {
if ($_POST['submit']=="Edit") {
echo "<script language='JavaScript'>
window.location = 'uploadform.php?i=$choiceimage&password=$password';
</script>";
}elseif ($_POST['submit']=="Delete") {
for ($i=1; file_exists("images/image".strval($i).".jpg"); $i++) {
}
$num=$i-1;
function unlinkk($f) {
if (!file_exists($f)) return true;
else return unlink($f);
}
function del($i) {
if (unlinkk("images/image$i.jpg") and unlinkk("thumbnails/image$i.jpg") and unlinkk("down/image$i.zip")
and unlinkk("des/image$i.txt")) return true;
}
if (!del($choiceimage)) echo "Error";
for ($i=intval($choiceimage)+1; $i<$num; $i--) {
$j=$i-1;
if (!rename("images/image$i.jpg", "images/image$j.jpg")) $error="r";
}
if ($error=="") echo "Image$choiceimage deleted successfully";
} else {
echo "<form name=\"form2\" action=\"$PHP_SELF\" method=\"post\">
  <p align=\"center\"><font color=\"#CCCCCC\" size=\"1\" face=\"verdana\"><strong><font size=\"2\">Upload
    New Picture</font></strong></font></p>
  <p align=\"center\"><strong><font color=\"#CCCCCC\" size=\"1\" face=\"verdana\"><a href=\"uploadform.php?password=$password\">click
    here</a> </font></strong></p>
  <p align=\"center\"><strong><font color=\"#CCCCCC\" size=\"1\" face=\"verdana\">OR</font></strong></p>
  <p align=\"center\"><strong><font color=\"#CCCCCC\" size=\"1\" face=\"verdana\"><strong><font size=\"2\">EDIT
    Existing Picture</font></strong></font></strong></p>
  <p align=\"center\"><font color=\"#CCCCCC\" size=\"1\" face=\"verdana\"><strong>Image
    Select :<br>
    <table border=0><tr><td><select name=\"choiceimage\" size=10 onChange=\"pre()\">";
       for ($i=1; file_exists("thumbnails/image".strval($i).".jpg"); $i++) {
    echo "<option value=$i>Image$i</option>";
}
    echo "</select></td>
    </strong></font></p>
  <p align=center>
    <td><img src=\"noth.gif\" border=0 name=preview></td></p></tr></table>
  <p align=\"center\"><strong><font color=\"#CCCCCC\" size=\"1\" face=\"verdana\">
    <input type=\"submit\" name=\"submit\" value=\"Edit\">
    <input type=\"hidden\" name=\"password\" value=\"$password\">
    <input type=\"submit\" name=\"submit\" value=\"Delete\">
    </font></strong> </p>
</form>";
}
} else echo "<form name=\"form1\" action=\"$PHP_SELF\" method=\"post\">Password : <input type=\"password\" name=\"password\" size=20>
<input type=submit name=submit value=OK>
</form>";
?>
<div align="center"><br><font color="#CCCCCC" size="1" face="verdana"><a href="index.php">Go To Gallery</a><br>
  <br>©Kyscorp.tk -2000-2003- Kys
  Gallery 1.0
  </font></div>
<style>
BODY { scrollbar-face-color: "#000000"; scrollbar-arrow-color: "#000000"; scrollbar-track-color: "#000000"; scrollbar-3dlight-color:"#333333"; scrollbar-darkshadow-color: "#333333"; }
</style></body>
</html>

 

uploadform.php

 

<html>
<head>
<title>upload form</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript" type="text/JavaScript">
function validate(){
if (form1.name.value=="" | form1.author.value=="" | form1.des.value=="" | form1.image.value=="" | form1.thumb.value=="")  {
alert("Name, author, File Source, Description and Thumbnail fields are required");
return false;
} else if((form1.web.value!="") & (form1.web.value.indexOf("http://")!=0)) {
alert("the web address must begin with 'http://'");
return false;
} else {
return true;
form1.submit();
}
}
</script>
</head>
<body bgcolor="#000000" text="#CCCCCC" link="#FF3300" vlink="#FF3300">
<div align="center"><font color="#FF3300" face="Arial, Helvetica, sans-serif"><strong>GALLERY
  ADMIN PAGE</strong></font><br>
</div>
<?php include("config.inc");
if ($_POST['password']==$adpass) {
if ($_POST['action']=="save") {
if ($i=="") for ($i=1; file_exists("images/image".strval($i).".jpg"); $i++) {
}
$file ="des/image$i.txt";
$fp =fopen($file, "w+");
$name=stripslashes($_POST['name']);
$des=stripslashes($_POST['des']);
$code=stripslashes($_POST['code']);
$author=stripslashes($_POST['author']);
$w ="name=".$name."&price=".$price."&code=".$code."&des=".$des."&author=".$author."&mail=".$mail."&date=".$date."&web=".$web;
for ($ii=1; $ii<100; $ii++) {
$w=stripcslashes($w);
}
if ($down<>"") $w = $w."&counter=0";
fwrite($fp, $w);
fclose($fp);
if (copy($thumb, "thumbnails/image".strval($i).".jpg"))  echo "Thumbnail copied<br>";
if (copy($image, "images/image".strval($i).".jpg"))  echo "Image copied<br>";
if (copy($down, "down/image".strval($i).".zip"))  echo "Download File copied";
} else {
$file="des/image$i.txt";
///
if (file_exists("des/image$i.txt")) {
$fp=fopen($file, "r");
$w=fread($fp, filesize($file));
for ($j=1; $j<10; $j++) {
$w=stripcslashes($w);
}
parse_str($w);
$name=stripslashes($_POST['name']);
$des=stripslashes($_POST['des']);
$code=stripslashes($_POST['code']);
$author=stripslashes($_POST['author']);
fclose($fp);
}
echo "<form method=\"post\" onsubmit=\"return validate();\" enctype=\"multipart/form-data\" name=\"form1\" action=\"$PHP_SELF\">
  <p> <font size=\"1\" face=\"verdana\">File Source:
    <input name=\"image\" type=\"file\" id=\"image\" value='images/image$i.jpg'>
    <input name=\"i\" type=\"hidden\" id=\"i\" value=$i>
    </font></p>
  <p><font size=\"1\" face=\"verdana\"> Name:
    <input name=\"name\" type=\"text\" id=\"name\" value='$name'>
    </font></p>
  <p><font size=\"1\" face=\"verdana\">Thumbnail:
    <input name=\"thumb\" type=\"file\" id=\"thumb\" value='thumbnails/image$i.jpg'>
    </font></p>
  <p><font size=\"1\" face=\"verdana\">Download File: (Not required)
    <input name=\"down\" type=\"file\" id=\"down\" value='down/image$i.jpg'>
    </font></p>
  <p><font size=\"1\" face=\"verdana\">Date:
    <input name=\"date\" type=\"text\" id=\"date\" value='$date'>
    <input name=\"action\" type=\"hidden\" id=\"action\" value=\"save\">
    <input name=\"password\" type=\"hidden\" id=\"action\" value=\"$password\">
    </font></p>
  <p><font size=\"1\" face=\"verdana\">Author:
    <input name=\"author\" type=\"text\" id=\"author\" value='$author'><br><br>
Author Web: <input name=\"web\" type=\"text\" id=\"web\" value='$web'>
    </font></p>
  <p><font size=\"1\" face=\"verdana\">E-mail:
    <input name=\"mail\" type=\"text\" id=\"mail\" value='$mail'><br><br>Price :
<input name=\"price\" type=\"text\" id=\"price\" value=\"$price\">
    </font></p>
  <p><font size=\"1\" face=\"verdana\">Description:</font></p>
  <p> <font size=\"1\" face=\"verdana\">
    <textarea name=\"des\" id=\"des\">$des</textarea>
    </font></p>
  <p><font size=\"1\" face=\"verdana\">Paypal HTML Code:</font></p>
  <p> <font size=\"1\" face=\"verdana\">
    <textarea name=\"code\" id=\"code\">$code</textarea>
    </font></p>
  <p align=\"center\">  </p>
  <p align=\"center\"> <font size=\"1\" face=\"verdana\">
    <input type=\"submit\" name=\"Submit\" value=\"Submit\">
    </font></p>
</form>";

}
} else echo "<form name=\"form1\" action=\"$PHP_SELF\" method=\"post\">Password : <input type=\"password\" name=\"password\" size=20>
<input type=submit name=submit value=OK>
</form>";
?>
<div align="center"><br><font color="#CCCCCC" size="1" face="verdana"><a href="index.php">Go To Gallery</a><br>
  <br>©Kyscorp.tk -2000-2003- Kys
  Gallery 1.0
  </font></div>
<style>
BODY { scrollbar-face-color: "#000000"; scrollbar-arrow-color: "#000000"; scrollbar-track-color: "#000000"; scrollbar-3dlight-color:"#333333"; scrollbar-darkshadow-color: "#333333"; }
</style></body>
</html>

 

 

sorry i suck at php.. everyone learns by failing a few times first, thanks in advance guys :-)

 

- Demix

Link to comment
https://forums.phpfreaks.com/topic/106584-another-problem-doh-sorry-guys/
Share on other sites

Try this

<?php
session_start();
?>

<html>
<head>
<title>upload form</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript">
function pre() {
form2.preview.src = 'thumbnails/image'+form2.choiceimage.options[form2.choiceimage.selectedIndex].value+'.jpg';
}
</script>
</head>
<body bgcolor="#000000" text="#CCCCCC" link="#FF3300" vlink="#FF3300">
<div align="center"><font color="#FF3300" face="Arial, Helvetica, sans-serif"><strong>GALLERY
  ADMIN PAGE</strong></font><br>
</div>
<?php
include("config.inc");
if ($_POST['password']==$adpass || $_SESSION=['Access'] ) {
$_SESSION=['Access'] = true;
if ($_POST['submit']=="Edit") {
echo "<script language='JavaScript'>
window.location = 'uploadform.php?i=$choiceimage&password=$password';
</script>";
}elseif ($_POST['submit']=="Delete") {
for ($i=1; file_exists("images/image".strval($i).".jpg"); $i++) {
}
$num=$i-1;
function unlinkk($f) {
if (!file_exists($f)) return true;
else return unlink($f);
}
function del($i) {
if (unlinkk("images/image$i.jpg") and unlinkk("thumbnails/image$i.jpg") and unlinkk("down/image$i.zip")
and unlinkk("des/image$i.txt")) return true;
}
if (!del($choiceimage)) echo "Error";
for ($i=intval($choiceimage)+1; $i<$num; $i--) {
$j=$i-1;
if (!rename("images/image$i.jpg", "images/image$j.jpg")) $error="r";
}
if ($error=="") echo "Image$choiceimage deleted successfully";
} else {
echo "<form name=\"form2\" action=\"$PHP_SELF\" method=\"post\">
  <p align=\"center\"><font color=\"#CCCCCC\" size=\"1\" face=\"verdana\"><strong><font size=\"2\">Upload
    New Picture</font></strong></font></p>
  <p align=\"center\"><strong><font color=\"#CCCCCC\" size=\"1\" face=\"verdana\"><a href=\"uploadform.php?password=$password\">click
    here</a> </font></strong></p>
  <p align=\"center\"><strong><font color=\"#CCCCCC\" size=\"1\" face=\"verdana\">OR</font></strong></p>
  <p align=\"center\"><strong><font color=\"#CCCCCC\" size=\"1\" face=\"verdana\"><strong><font size=\"2\">EDIT
    Existing Picture</font></strong></font></strong></p>
  <p align=\"center\"><font color=\"#CCCCCC\" size=\"1\" face=\"verdana\"><strong>Image
    Select :<br>
    <table border=0><tr><td><select name=\"choiceimage\" size=10 onChange=\"pre()\">";
       for ($i=1; file_exists("thumbnails/image".strval($i).".jpg"); $i++) {
    echo "<option value=$i>Image$i</option>";
}
    echo "</select></td>
    </strong></font></p>
  <p align=center>
    <td><img src=\"noth.gif\" border=0 name=preview></td></p></tr></table>
  <p align=\"center\"><strong><font color=\"#CCCCCC\" size=\"1\" face=\"verdana\">
    <input type=\"submit\" name=\"submit\" value=\"Edit\">
    <input type=\"hidden\" name=\"password\" value=\"$password\">
    <input type=\"submit\" name=\"submit\" value=\"Delete\">
    </font></strong> </p>
</form>";
}
} else echo "<form name=\"form1\" action=\"$PHP_SELF\" method=\"post\">Password : <input type=\"password\" name=\"password\" size=20>
<input type=submit name=submit value=OK>
</form>";
?>
<div align="center"><br><font color="#CCCCCC" size="1" face="verdana"><a href="index.php">Go To Gallery</a><br>
  <br>©Kyscorp.tk -2000-2003- Kys
  Gallery 1.0
  </font></div>
<style>
BODY { scrollbar-face-color: "#000000"; scrollbar-arrow-color: "#000000"; scrollbar-track-color: "#000000"; scrollbar-3dlight-color:"#333333"; scrollbar-darkshadow-color: "#333333"; }
</style></body>
</html>

thanks again madtechie your really helpful, i appreciate you giving your time to help with this.

 

just throws me a blank page though hehe >_<

 

edit:

 

if i go straight to the uploadform.php page that tells me to put in the password so basically im bypassing the admin.php so its got to be something to do with uploadform.php >_< its like its going straight to the last "else" in the script

had typos

clean version (should be ok)

<?php
session_start();
?>

<html>
<head>
<title>upload form</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript">
function pre() {
	form2.preview.src = 'thumbnails/image'+form2.choiceimage.options[form2.choiceimage.selectedIndex].value+'.jpg';
}
</script>
</head>
<body bgcolor="#000000" text="#CCCCCC" link="#FF3300" vlink="#FF3300">
<div align="center"><font color="#FF3300" face="Arial, Helvetica, sans-serif"><strong>GALLERY
  ADMIN PAGE</strong></font><br>
</div>
<?php
include("config.inc");
if ($_POST['password']==$adpass || $_SESSION['Access'] ) {
	$_SESSION['Access'] = true;
	if ($_POST['submit']=="Edit") {
		echo "<script language='JavaScript'>
window.location = 'uploadform.php?i=$choiceimage&password=$password';
</script>";
	}elseif ($_POST['submit']=="Delete") {
		for ($i=1; file_exists("images/image".strval($i).".jpg"); $i++) {
		}
	$num=$i-1;
	if (!del($choiceimage)) echo "Error";
	for ($i=intval($choiceimage)+1; $i<$num; $i--)
	{
		$j=$i-1;
		if (!rename("images/image$i.jpg", "images/image$j.jpg")) $error="r";
	}
	if ($error=="") echo "Image$choiceimage deleted successfully";
	} else {
		echo "<form name=\"form2\" action=\"$PHP_SELF\" method=\"post\">
  <p align=\"center\"><font color=\"#CCCCCC\" size=\"1\" face=\"verdana\"><strong><font size=\"2\">Upload
    New Picture</font></strong></font></p>
  <p align=\"center\"><strong><font color=\"#CCCCCC\" size=\"1\" face=\"verdana\"><a href=\"uploadform.php?password=$password\">click
    here</a> </font></strong></p>
  <p align=\"center\"><strong><font color=\"#CCCCCC\" size=\"1\" face=\"verdana\">OR</font></strong></p>
  <p align=\"center\"><strong><font color=\"#CCCCCC\" size=\"1\" face=\"verdana\"><strong><font size=\"2\">EDIT
    Existing Picture</font></strong></font></strong></p>
  <p align=\"center\"><font color=\"#CCCCCC\" size=\"1\" face=\"verdana\"><strong>Image
    Select :<br>
    <table border=0><tr><td><select name=\"choiceimage\" size=10 onChange=\"pre()\">";
		for ($i=1; file_exists("thumbnails/image".strval($i).".jpg"); $i++) {
    			echo "<option value=$i>Image$i</option>";
		}
    		echo "</select></td>
    </strong></font></p>
  <p align=center>
    <td><img src=\"noth.gif\" border=0 name=preview></td></p></tr></table>
  <p align=\"center\"><strong><font color=\"#CCCCCC\" size=\"1\" face=\"verdana\">
    <input type=\"submit\" name=\"submit\" value=\"Edit\">
    <input type=\"hidden\" name=\"password\" value=\"$password\">
    <input type=\"submit\" name=\"submit\" value=\"Delete\">
    </font></strong> </p>
</form>";
	}
} else
	echo "<form name=\"form1\" action=\"$PHP_SELF\" method=\"post\">Password : <input type=\"password\" name=\"password\" size=20>
<input type=submit name=submit value=OK>
</form>";
?>
<div align="center"><br><font color="#CCCCCC" size="1" face="verdana"><a href="index.php">Go To Gallery</a><br>
  <br>©Kyscorp.tk -2000-2003- Kys
  Gallery 1.0
  </font></div>
<style>
BODY { scrollbar-face-color: "#000000"; scrollbar-arrow-color: "#000000"; scrollbar-track-color: "#000000"; scrollbar-3dlight-color:"#333333"; scrollbar-darkshadow-color: "#333333"; }
</style></body>
</html>

<?php
function unlinkk($f) {
	if (!file_exists($f)) return true;
	else return unlink($f);
}
function del($i)
{
	if (unlinkk("images/image$i.jpg") and unlinkk("thumbnails/image$i.jpg") and unlinkk("down/image$i.zip") and unlinkk("des/image$i.txt")) return true;
}
?>

thanks loads for that, its sorted the session problem and i can delete images and edit them now, but i still get the password page appearing right after ive writen in the details and pressed okay when uploading an image (the image still isnt uploading) apart from that everything else is working great now, ^^

 

edit: just to say i know the theory, the upload page needs to be linked to that session somehow, im gonna give it a go :-)

Nope >_< I know its something to do with that problem though, i apologise for taking a while to fix this and being pretty stumped, i know all the php basics but when its something i havent writen (like the base of this script) then im kinda clueless and i lose myself >_< well thanks again for helping :-)

 

 

Uploadform.php

 

<html>
<head>
<title>upload form</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript" type="text/JavaScript">
function validate(){
if (form1.name.value=="" | form1.author.value=="" | form1.des.value=="" | form1.image.value=="" | form1.thumb.value=="")  {
alert("Name, author, File Source, Description and Thumbnail fields are required");
return false;
} else if((form1.web.value!="") & (form1.web.value.indexOf("http://")!=0)) {
alert("the web address must begin with 'http://'");
return false;
} else {
return true;
form1.submit();
}
}
</script>
</head>
<body bgcolor="#000000" text="#CCCCCC" link="#FF3300" vlink="#FF3300">
<div align="center"><font color="#FF3300" face="Arial, Helvetica, sans-serif"><strong>GALLERY
  ADMIN PAGE</strong></font><br>
</div>
<?php include("config.inc");
if ($_POST['password']==$adpass || $_SESSION['Access'] )
if ($_POST['action']=="save") {
if ($i=="") for ($i=1; file_exists("images/image".strval($i).".jpg"); $i++) {
}
$file ="des/image$i.txt";
$fp =fopen($file, "w+");
$name=stripslashes($_POST['name']);
$des=stripslashes($_POST['des']);
$code=stripslashes($_POST['code']);
$author=stripslashes($_POST['author']);
$w ="name=".$name."&price=".$price."&code=".$code."&des=".$des."&author=".$author."&mail=".$mail."&date=".$date."&web=".$web;
for ($ii=1; $ii<100; $ii++) {
$w=stripcslashes($w);
}
if ($down<>"") $w = $w."&counter=0";
fwrite($fp, $w);
fclose($fp);
if (copy($thumb, "thumbnails/image".strval($i).".jpg"))  echo "Thumbnail copied<br>";
if (copy($image, "images/image".strval($i).".jpg"))  echo "Image copied<br>";
if (copy($down, "down/image".strval($i).".zip"))  echo "Download File copied";
} else {
$file="des/image$i.txt";
///
if (file_exists("des/image$i.txt")) {
$fp=fopen($file, "r");
$w=fread($fp, filesize($file));
for ($j=1; $j<10; $j++) {
$w=stripcslashes($w);
}
parse_str($w);
$name=stripslashes($_POST['name']);
$des=stripslashes($_POST['des']);
$code=stripslashes($_POST['code']);
$author=stripslashes($_POST['author']);
fclose($fp);
}
echo "<form method=\"post\" onsubmit=\"return validate();\" enctype=\"multipart/form-data\" name=\"form1\" action=\"$PHP_SELF\">
  <p> <font size=\"1\" face=\"verdana\">File Source:
    <input name=\"image\" type=\"file\" id=\"image\" value='images/image$i.jpg'>
    <input name=\"i\" type=\"hidden\" id=\"i\" value=$i>
    </font></p>
  <p><font size=\"1\" face=\"verdana\"> Name:
    <input name=\"name\" type=\"text\" id=\"name\" value='$name'>
    </font></p>
  <p><font size=\"1\" face=\"verdana\">Thumbnail:
    <input name=\"thumb\" type=\"file\" id=\"thumb\" value='thumbnails/image$i.jpg'>
    </font></p>
  <p><font size=\"1\" face=\"verdana\">Download File: (Not required)
    <input name=\"down\" type=\"file\" id=\"down\" value='down/image$i.jpg'>
    </font></p>
  <p><font size=\"1\" face=\"verdana\">Date:
    <input name=\"date\" type=\"text\" id=\"date\" value='$date'>
    <input name=\"action\" type=\"hidden\" id=\"action\" value=\"save\">
    <input name=\"password\" type=\"hidden\" id=\"action\" value=\"$password\">
    </font></p>
  <p><font size=\"1\" face=\"verdana\">Author:
    <input name=\"author\" type=\"text\" id=\"author\" value='$author'><br><br>
Author Web: <input name=\"web\" type=\"text\" id=\"web\" value='$web'>
    </font></p>
  <p><font size=\"1\" face=\"verdana\">E-mail:
    <input name=\"mail\" type=\"text\" id=\"mail\" value='$mail'><br><br>Price :
<input name=\"price\" type=\"text\" id=\"price\" value=\"$price\">
    </font></p>
  <p><font size=\"1\" face=\"verdana\">Description:</font></p>
  <p> <font size=\"1\" face=\"verdana\">
    <textarea name=\"des\" id=\"des\">$des</textarea>
    </font></p>
  <p><font size=\"1\" face=\"verdana\">Paypal HTML Code:</font></p>
  <p> <font size=\"1\" face=\"verdana\">
    <textarea name=\"code\" id=\"code\">$code</textarea>
    </font></p>
  <p align=\"center\">  </p>
  <p align=\"center\"> <font size=\"1\" face=\"verdana\">
    <input type=\"submit\" name=\"Submit\" value=\"Submit\">
    </font></p>
</form>";

}
} else echo "<form name=\"form1\" action=\"$PHP_SELF\" method=\"post\">Password : <input type=\"password\" name=\"password\" size=20>
<input type=submit name=submit value=OK>
</form>";
?>
<div align="center"><br><font color="#CCCCCC" size="1" face="verdana"><a href="index.php">Go To Gallery</a><br>
  <br>©Kyscorp.tk -2000-2003- Kys
  Gallery 1.0
  </font></div>
<style>
BODY { scrollbar-face-color: "#000000"; scrollbar-arrow-color: "#000000"; scrollbar-track-color: "#000000"; scrollbar-3dlight-color:"#333333"; scrollbar-darkshadow-color: "#333333"; }
</style></body>
</html>

throwing me a blank page again >_<

 

<?php
session_start();
?>

<html>
<head>
<title>upload form</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript" type="text/JavaScript">
function validate(){
if (form1.name.value=="" | form1.author.value=="" | form1.des.value=="" | form1.image.value=="" | form1.thumb.value=="")  {
alert("Name, author, File Source, Description and Thumbnail fields are required");
return false;
} else if((form1.web.value!="") & (form1.web.value.indexOf("http://")!=0)) {
alert("the web address must begin with 'http://'");
return false;
} else {
return true;
form1.submit();
}
}
</script>
</head>
<body bgcolor="#000000" text="#CCCCCC" link="#FF3300" vlink="#FF3300">
<div align="center"><font color="#FF3300" face="Arial, Helvetica, sans-serif"><strong>GALLERY
  ADMIN PAGE</strong></font><br>
</div>
<?php 
include("config.inc");
if ($_POST['password']==$adpass || $_SESSION['Access'] ) (
	if ($_POST['action']=="save") {
		if ($i=="") for ($i=1; file_exists("images/image".strval($i).".jpg"); $i++) {
}
$file ="des/image$i.txt";
$fp =fopen($file, "w+");
$name=stripslashes($_POST['name']);
$des=stripslashes($_POST['des']);
$code=stripslashes($_POST['code']);
$author=stripslashes($_POST['author']);
$w ="name=".$name."&price=".$price."&code=".$code."&des=".$des."&author=".$author."&mail=".$mail."&date=".$date."&web=".$web;
for ($ii=1; $ii<100; $ii++) {
$w=stripcslashes($w);
}
if ($down<>"") $w = $w."&counter=0";
fwrite($fp, $w);
fclose($fp);
if (copy($thumb, "thumbnails/image".strval($i).".jpg"))  echo "Thumbnail copied<br>";
if (copy($image, "images/image".strval($i).".jpg"))  echo "Image copied<br>";
if (copy($down, "down/image".strval($i).".zip"))  echo "Download File copied";
} else {
$file="des/image$i.txt";
///
if (file_exists("des/image$i.txt")) {
$fp=fopen($file, "r");
$w=fread($fp, filesize($file));
for ($j=1; $j<10; $j++) {
$w=stripcslashes($w);
}
parse_str($w);
$name=stripslashes($_POST['name']);
$des=stripslashes($_POST['des']);
$code=stripslashes($_POST['code']);
$author=stripslashes($_POST['author']);
fclose($fp);
}
echo "<form method=\"post\" onsubmit=\"return validate();\" enctype=\"multipart/form-data\" name=\"form1\" action=\"$PHP_SELF\">
  <p> <font size=\"1\" face=\"verdana\">File Source:
    <input name=\"image\" type=\"file\" id=\"image\" value='images/image$i.jpg'>
    <input name=\"i\" type=\"hidden\" id=\"i\" value=$i>
    </font></p>
  <p><font size=\"1\" face=\"verdana\"> Name:
    <input name=\"name\" type=\"text\" id=\"name\" value='$name'>
    </font></p>
  <p><font size=\"1\" face=\"verdana\">Thumbnail:
    <input name=\"thumb\" type=\"file\" id=\"thumb\" value='thumbnails/image$i.jpg'>
    </font></p>
  <p><font size=\"1\" face=\"verdana\">Download File: (Not required)
    <input name=\"down\" type=\"file\" id=\"down\" value='down/image$i.jpg'>
    </font></p>
  <p><font size=\"1\" face=\"verdana\">Date:
    <input name=\"date\" type=\"text\" id=\"date\" value='$date'>
    <input name=\"action\" type=\"hidden\" id=\"action\" value=\"save\">
    <input name=\"password\" type=\"hidden\" id=\"action\" value=\"$password\">
    </font></p>
  <p><font size=\"1\" face=\"verdana\">Author:
    <input name=\"author\" type=\"text\" id=\"author\" value='$author'><br><br>
Author Web: <input name=\"web\" type=\"text\" id=\"web\" value='$web'>
    </font></p>
  <p><font size=\"1\" face=\"verdana\">E-mail:
    <input name=\"mail\" type=\"text\" id=\"mail\" value='$mail'><br><br>Price :
<input name=\"price\" type=\"text\" id=\"price\" value=\"$price\">
    </font></p>
  <p><font size=\"1\" face=\"verdana\">Description:</font></p>
  <p> <font size=\"1\" face=\"verdana\">
    <textarea name=\"des\" id=\"des\">$des</textarea>
    </font></p>
  <p><font size=\"1\" face=\"verdana\">Paypal HTML Code:</font></p>
  <p> <font size=\"1\" face=\"verdana\">
    <textarea name=\"code\" id=\"code\">$code</textarea>
    </font></p>
  <p align=\"center\">  </p>
  <p align=\"center\"> <font size=\"1\" face=\"verdana\">
    <input type=\"submit\" name=\"Submit\" value=\"Submit\">
    </font></p>
</form>";

}
} else echo "<form name=\"form1\" action=\"$PHP_SELF\" method=\"post\">Password : <input type=\"password\" name=\"password\" size=20>
<input type=submit name=submit value=OK>
</form>";
?>
<div align="center"><br><font color="#CCCCCC" size="1" face="verdana"><a href="index.php">Go To Gallery</a><br>
  <br>©Kyscorp.tk -2000-2003- Kys
  Gallery 1.0
  </font></div>
<style>
BODY { scrollbar-face-color: "#000000"; scrollbar-arrow-color: "#000000"; scrollbar-track-color: "#000000"; scrollbar-3dlight-color:"#333333"; scrollbar-darkshadow-color: "#333333"; }
</style></body>
</html>

if (copy($thumb, "thumbnails/image".strval($i).".jpg"))  echo "Thumbnail copied<br>";
if (copy($image, "images/image".strval($i).".jpg"))  echo "Image copied<br>";
if (copy($down, "down/image".strval($i).".zip"))  echo "Download File copied";

 

am i not supposed to have a confirmation of the image uploaded? >_< it still will not allow me to upload an image

 

the main page just says "No images uploaded"

 

heres the layout of the directory by the way incase that helps

 

dhfhdfhgc3.th.jpg

i just reviewed the code and the page your getting is correct, by the logic you have..

what was you expecting to have displayed ?

 

the problem is here

if ($_POST['action']=="save") {

 

as theirs no post this will fail.. and theirs no if so.. nothing will display.. what are you expecting?

i just reviewed the code and the page your getting is correct, by the logic you have..

what was you expecting to have displayed ?

 

the problem is here

if ($_POST['action']=="save") {

 

as theirs no post this will fail.. and theirs no if so.. nothing will display.. what are you expecting?

 

well im not too sure what to expect as it was a pre-made script which wasnt working before i tried to fix it, im assuming it was made for an old version of php, im just expecting it to upload the image for me and give me a confirmation >_< i really suck at php, i dont even know where i should begin

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.