Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums

Go Back   Code Forums > Application and Web Development > PHP

Reply
 
LinkBack Thread Tools Display Modes
Old 05-29-2003, 04:19 PM   #1 (permalink)
eugene1
Registered User
 
Join Date: May 2003
Posts: 2
eugene1 is on a distinguished road
I need help with my article/blog script I have been writting

maybe someone here can help me out.... i'll give it a shot
below is my script it is part of a article/blog manager I have been writting for the past 3 days ....
can someone tell me what Im doing wrong in my code?
by the way I am only 3 or so months into php coding so I am fairly new

the errors I am getting are :

Warning: Unexpected character in input: '' (ASCII=92) state=1 in C:\Documents and Settings\Owner\Desktop\zz\Abyss Web Server\htdocs\0\doitonetest.php on line 157

Warning: Unexpected character in input: '' (ASCII=92) state=1 in C:\Documents and Settings\Owner\Desktop\zz\Abyss Web Server\htdocs\0\doitonetest.php on line 157

Parse error: parse error, unexpected T_VARIABLE in C:\Documents and Settings\Owner\Desktop\zz\Abyss Web Server\htdocs\0\doitonetest.php on line 158

================================================== ===========
<?
//user defined variables
$urlpath = "my url";
$abpath = "/Documents and Settings/Owner/Desktop/zz/Abyss Web Server/htdocs/0"; //Absolute path to where images are uploaded. No trailing slash
$sizelim = "no"; //Do you want size limit, yes or no
$size = "2500000"; //What do you want size limited to be if there is one

//all image types to upload
$cert1 = "image/pjpeg"; //Jpeg type 1
$cert2 = "image/jpeg"; //Jpeg type 2
$cert3 = "image/gif"; //Gif type

$log = "";
$random1 = rand(1, 99999999);
$random2 = rand(1, 99999999);
$random3 = rand(1, 99999999);
$random4 = rand(1, 99999999);
$random5 = rand(1, 99999999);


//begin upload 1
$nimg[]=1;
//checks if file exists
if ($img1_name == "") {
$log .= "No file selected for upload 4<br>";
} else {
//checks if file exists
if (file_exists("$abpath/$img1_name")) {
$log .= "File 1 already existed<br>";
} else {
//checks if files to big
if ($sizelim == "yes") {
if ($img1_size > $size) {
$log .= "File 1 was too big<br>";
}
}
//Checks if file is an image
if (($img1_type == $cert1) or ($img1_type == $cert2) or ($img1_type == $cert3)) {
if (($img1_type == $cert1) or ($img1_type == $cert2)) {
$img1_name = $random4 . ".jpeg";
}
if ($img1_type == $cert3) {
$img1_name = $random1 . ".gif";
}
@copy($img1, "$abpath/$img1_name") or $log .= "Couldn't copy image 1 to server<br>";
if (file_exists("$abpath/$img1_name")) {
$log .= "File 1 was uploaded<br>";
$nimg[]=0;
}
} else {
$log .= "File 1 is not an image<br>";
}
}
}
//begin upload2
$nimg[]=1;
//checks if file exists
if ($img2_name == "") {
$log .= "No file selected for upload 2<br>";
} else {
//checks if file exists
if (file_exists("$abpath/$img2_name")) {
$log .= "File 2 already existed<br>";
} else {
//checks if files to big
if ($sizelim == "yes") {
if ($img2_size > $size) {
$log .= "File 2 was too big<br>";
}
}
//Checks if file is an image
if (($img2_type == $cert1) or ($img2_type == $cert2) or ($img2_type == $cert3)) {
if (($img2_type == $cert1) or ($img2_type == $cert2)) {
$img2_name = $random2 . ".jpeg";
}
if ($img2_type == $cert3) {
$img2_name = $random2 . ".gif";
}
@copy($img2, "$abpath/$img2_name") or $log .= "Couldn't copy image 2 to server<br>";
if (file_exists("$abpath/$img2_name")) {
$log .= "File 2 was uploaded<br>";
$nimg[]=0;
}
} else {
$log .= "File 2 is not an image<br>";
}
}
}
//upload3
$nimg[]=1;
//checks if file exists
if ($img3_name == "") {
$log .= "No file selected for upload 3<br>";
} else {
//checks if file exists
if (file_exists("$abpath/$img3_name")) {
$log .= "File 3 already existed<br>";
} else {
//checks if files to big
if ($sizelim == "yes") {
if ($img3_size > $size) {
$log .= "File 3 was too big<br>";
}
}
//Checks if file is an image
if (($img3_type == $cert1) or ($img3_type == $cert2) or ($img3_type == $cert3)) {
if (($img3_type == $cert1) or ($img3_type == $cert2)) {
$img3_name = $random3 . ".jpeg";
}
if ($img3_type == $cert3) {
$img3_name = $random3 . ".gif";
}
@copy($img3, "$abpath/$img3_name") or $log .= "Couldn't copy image 3 to server<br>";
if (file_exists("$abpath/$img3_name")) {
$log .= "File 3 was uploaded<br>";
$nimg[]=0;
}
} else {
$log .= "File 3 is not an image<br>";
}
}
}
//upload4
$nimg[]=1;
//checks if file exists
if ($img4_name == "") {
$log .= "No file selected for upload 4<br>";
} else {
//checks if file exists
if (file_exists("$abpath/$img4_name")) {
$log .= "File 4 already existed<br>";
} else {
//checks if files to big
if ($sizelim == "yes") {
if ($img4_size > $size) {
$log .= "File 4 was too big<br>";
}
}
//Checks if file is an image
if (($img4_type == $cert1) or ($img4_type == $cert2) or ($img4_type == $cert3)) {
if (($img4_type == $cert1) or ($img4_type == $cert2)) {
$img4_name = $random4 . ".jpeg";
}
if ($img4_type == $cert3) {
$img4_name = $random4 . ".gif";
}
@copy($img4, "$abpath/$img4_name") or $log .= "Couldn't copy image 4 to server<br>";
if (file_exists("$abpath/$img4_name")) {
$log .= "File 4 was uploaded<br>";
$nimg[]=0;
}
} else {
$log .= "File 4 is not an image<br>";
}
}
}
\\upload5
$nimg[]=1;
//checks if file exists
if ($img5_name == "") {
$log .= "No file selected for upload 5<br>";
} else {
//checks if file exists
if (file_exists("$abpath/$img5_name")) {
$log .= "File 5 already existed<br>";
} else {
//checks if files to big
if ($sizelim == "yes") {
if ($img5_size > $size) {
$log .= "File 5 was too big<br>";
}
}
//Checks if file is an image
if (($img5_type == $cert1) or ($img5_type == $cert2) or ($img5_type == $cert3)) {
if (($img5_type == $cert1) or ($img5_type == $cert2)) {
$img5_name = $random5 . ".jpeg";
}
if ($img5_type == $cert3) {
$img5_name = $random5 . ".gif";
}
@copy($img5, "$abpath/$img5_name") or $log .= "Couldn't copy image 5 to server<br>";
if (file_exists("$abpath/$img5_name")) {
$log .= "File 5 was uploaded<br>";
$nimg[]=0;
}
} else {
$log .= "File 5 is not an image<br>";
}
}
}
?>
<?
function nameone($nameone) {

$nameone = wordwrap( $nameone, 8, "\n\n", 1);

return $nameone;

}
function titleone($titleone) {

$titleone = wordwrap( $titleone, 8, "\n\n", 1);

return $titleone;

}


function mu($articleone) {

$articleone = preg_replace ("/([^\s]{50,})/e", "''.wordwrap('\\1', 50, ' ', 1).''", $articleone);

return $articleone;

}
function WriteToFile

($articleone) {
$TheFile = "one.php";
$Open = fopen($TheFile, "w");
if ($Open) {
fwrite ($Open, "$articleone\n");
fclose ($Open);
return true;
} else {
return false;
}
}
$articleone = mu($articleone);
$nameone = nameone($nameone);
$titleone = titleone($titleone);
$myfile=" <head> </head>



<TABLE width='500' BGCOLOR='000000'><TR><TD width='500' BGCOLOR='DEDECE'><b><font face=arial size=2 color=000000> Article author</font></b>

<font face='arial' size='2' color='000000'>: <a href='mailtoemailone'>$nameone</a> <br> <b>Article Title</b>: $titleone</font><br></table>

</tr></td><br><TABLE BGCOLOR='000000' width='500'><TR><TD BGCOLOR='DEDECE' width='500'> <BR>


<font face='arial' size='2' color='000000'><blockquote>$articleone <br><br>";



if($img[0]=0)

$myfile.="<a href='$urlpath$img1_name'><img src='$urlpath$img1_name' height='90' width='90' border='1' title='$img1_name'></a> "



if($img[1]=0)

$myfile.="

<a href='$urlpath$img2_name'><img src='$urlpath$img2_name' height='90' width='90' border='1' title='$img2_name'></a> "



if($img[2]=0)

$myfile.="

<a href='$urlpath$img3_name'><img src='$urlpath$img3_name' height='90' width='90' border='1' title='$img3_name'></a> "



if($img[3]=0)

$myfile.="<a href='$urlpath$img4_name'><img src='$urlpath$img4_name' height='90' width='90' border='1' title='$img4_name'></a> "



if($img[4]=0)

$myfile.="<a href='$urlpath$img5_name'><img src='$urlpath$img5_name' height='90' width='90' border='1' title='$img5_name'></a> "



$myfile.="</font></blockquote><br><br></table></tr></td><br>";



$CallFunction = WriteToFile ($myfile);
if ($CallFunction) { ?>
<?
include ('one.php');
?>
<?
echo"
your article has been added<br> <a href='mainpanel.php'>Return to the main manager</a>"
?>
<?
}
?>
</body>
eugene1 is offline   Reply With Quote
Old 05-29-2003, 05:35 PM   #2 (permalink)
joe_bruin
LOAD "*",8,1
 
Join Date: Feb 2003
Location: la.ca.us
Posts: 254
joe_bruin is on a distinguished road
well, let's look at line 157:

\\upload5

you probably mean:

//upload5
joe_bruin is offline   Reply With Quote
Old 05-29-2003, 05:37 PM   #3 (permalink)
eugene1
Registered User
 
Join Date: May 2003
Posts: 2
eugene1 is on a distinguished road
thanx

I didnt catch that one thank you Im gonna see if that solves the issue

what do you think about my code overall? is it decent or sloppy
for only coding about 4 months be honest.

I fixed the \\upload5 to
//upload5
but now im getting this error

Parse error: parse error, unexpected T_STRING in C:\Documents and Settings\Owner\Desktop\zz\Abyss Web Server\htdocs\0\doitonetest.php on line 45

? not to sure what is causing it.
eugene1 is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Something wrong with the view script redhead Lounge 1 10-11-2004 01:58 PM
running a script at designated time tzarin PHP 5 05-12-2004 07:11 PM
JS Script question M3GAPL3X HTML, XML, Javascript, AJAX 5 04-20-2003 09:21 PM
cgi script Henry PHP 25 12-30-2002 06:54 AM


All times are GMT -8. The time now is 05:13 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting