Gallery Uploader Error

Started on the old forum in February 2007 · view the original in the archive · old links redirect here

5 replies · 728 views · started 19 years ago · 1 min read

Guest #1

CODE<?php include("config.php"); include("core.php"); connectdb(); echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html> <head> <meta http-equiv="Content-Type" content="text/html"/> <meta http-equiv="Cache-Control" content="no-cache" forua="true"/>'; $bcon = connectdb(); if (!$bcon) { echo '<title>ERROR</title></head> <body bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080">'; echo "<img src=\"images/exit.gif\" alt=\"*\"/> "; echo "ERROR! cannot connect to database

"; echo "This error happens usually when backing up the database, please be patient, The site will be up any minute

"; echo "you can temperoray be in this site <a href="http://chatheaven.wen.ru">$site_name</a> while $site_name is offline "; echo "THANK YOU VERY MUCH"; echo " "; echo "</html>"; echo "</body>"; exit(); } $brws = explode(" ",$_SERVER[HTTP_USER_AGENT] ); $ubr = $brws[0]; $uip = getip(); $action = $_GET["action"]; $sid = $_GET["sid"]; $page = $_GET["page"]; $who = $_GET["who"];

$uid = getuid_sid($sid);

cleardata();

if(isipbanned($uip,$ubr)) { if(!isshield(getuid_sid($sid))) { echo '<title>IP Banned</title></head>

<body bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080">'; echo "<img src=\"images/notok.gif\" alt=\"x\"/> "; echo "This IP address is blocked "; echo " "; echo "How ever we grant a shield against IP-Ban for our great users, you can try to see if you are shielded by trying to log-in, if you kept coming to this page that means you are not shielded, so come back when the ip-ban period is over

"; $banto = mysql_fetch_array(mysql_query("SELECT timeto FROM ibwf_penalties WHERE penalty='2' AND ipadd='".$uip."' AND browserm='".$ubr."' LIMIT 1 ")); //echo mysql_error(); $remain = $banto[0] - time(); $rmsg = gettimemsg($remain); echo " IP: $rmsg

";

  echo "

"; echo "</body>"; echo "</html>"; exit(); } } if(($action != "") && ($action!="terms")) { $uid = getuid_sid($sid); if((islogged($sid)==false)||($uid==0)) { echo '<title>Uploader</title></head> <body bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080">'; echo " "; echo "You are not logged in "; echo "Or Your session has been expired

"; echo "<a href="index.php">Login</a>

"; echo " "; echo "</body>"; echo "</html>"; exit(); }

} //echo isbanned($uid); if(isbanned($uid)) { echo '<title>Banned</title></head> <body bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080">'; echo " "; echo "<img src="images/notok.gif" alt="x"/> "; echo "You are Banned "; $banto = mysql_fetch_array(mysql_query("SELECT timeto FROM ibwf_penalties WHERE uid='".$uid."' AND penalty='1'")); $banres = mysql_fetch_array(mysql_query("SELECT lastpnreas FROM ibwf_users WHERE id='".$uid."'"));

  $remain = $banto[0]- time();
  $rmsg = gettimemsg($remain);
  echo "Time to finish your penalty: $rmsg

"; echo "Ban Reason: $banres[0]"; //echo "<a href="index.php">Login</a>"; echo " "; echo "</body>"; echo "</html>"; exit(); }

$res = mysql_query("UPDATE ibwf_users SET browserm='".$ubr."', ipadd='".$uip."' WHERE id='".getuid_sid($sid)."'"); echo '<title>Uploader</title></head>

<body bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080"> ';

$nick = getnick_sid($sid); echo "Welcome $nick "; //get file name if ($upload="upload"&&$file_name){ if (!eregi(".(jpeg|jpg)$",$file_name)){ print "Unsuported File extention!!!"; }else{ $superdat_name = preg_replace( '/[^a-zA-Z0-9.$%'`-@{}~!#()&_^]/' ,'',str_replace(array(' ','%20'),array('',''),$file_name)); if(strlen($file_name)>53){ print "File Name to long!!!"; }else{ if (empty($file)) { print "No input file specified!!!"; }else{ $pics = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM gallery where uid='".$uid."'")); $cpic = $pics[0]+1; $rev = strrev ($file_name); $exp = explode (".", $rev); $true = strrev ($exp[0]); $trueext = strtolower ($true); $picn = $nick$cpic.$trueext; //rename and copy file name copy("$superdat", "gallery/$picn") or die("Couldn't copy file.");

//add new file name to database $adds=mysql_query("INSERT INTO gallery SET file='".$picn."',uid='".$uid."'"); if ($adds) {

      echo "pic added $picn

";

     } else {

          echo "Please try again

"; }

echo "file has been successfully uploaded"; } } } } ?>

<form align="left" action="upload.php&amp;sid=$sid" method="post" ENCTYPE="multipart/form-data"> File: <input type="file" name="file" size="30"/> <input type="submit" value="Upload!"/>

Home

Script by:Tommie©

</form> </body> </html> I cant find the error on this page can some one pls help me to fix it because I want users to uploud the own pics it gives me this error CODEParse error: syntax error, unexpected T_VARIABLE in /home/chath/public_html/upload.php on line 127 I dont know wicth line to look in.
Guest #4

dont worry I will use PHP DESIGNER it counts the lines so I can find the error that way.

Guest #5

it line 128 I changed it form CODE$picn = $nick$cpic.$trueext; toCODE$picn = "$nick$cpic.$trueext"; now it works

Guest #6

all error and bugs are fixed thanks 2 PHP DESIGNER I found the errors really fast and fixed them my gallery script is up and running now users can upload there own pics. External image (may be gone)

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close