Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > General > Member Archives
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
whats wrong with these scripts i made????? Details »»
whats wrong with these scripts i made?????
Version: , by pattox2k1 pattox2k1 is offline
Developer Last Online: Dec 2005 Show Printable Version Email this Page

Version: Unknown Rating:
Released: 05-20-2002 Last Update: Never Installs: 0
 
No support by the author.

first of all i have this number guessing game i made and this is the code i have:

PHP Code:
<?php
$num_to_guess
=73;
$message="";
if(!isset(
$guess))
$message="Welcome to the number guessing game, please type in a guess in the box below. All numbers are between 1 and 100 and will change evry week. HINT: This number is over 50 and under 80.";
elseif (
$guess>$num_to_guess)
$messgae="$guess is too high, try a lower number";
elseif (
$guess<$num_to_guess)
$message="$guess is too low, try a higher number:;
else//must be equivalent
$message="Well done!";
?>

<html>
<head>
<title>The Number Guessing Game</title>
</head>
<body>
<h1>
<?php print 
$message ?>
</h1>
<form method="
POST">
Thye in your guess here: <input type="
text" name="guess">
</form>
</body>
</html>
and the server gives me this error:

Code:
Parse error: parse error in /mnt/host-users/homeworkhh/guess.php on line 11


i can't find any errors..... and my second problem is on my upload script, my code is:

PHP Code:
<HTML>
<HEAD>
<TITLE>Your Site Uploader</TITLE>
<?php
$file_dir
"/path/to/fokder/uploads";
$file_ url"http://www.yoursite.com/uploads";

foreach( 
$HTTP_POST_FILES as $file_name => $file_array ) { print "path: ".$file_array['tmp_name']."<BR>\n"; print 
"name: ".$file_array['name']."<BR>\n"; print "type: 
"
.$file_array['type']."<BR>\n"; print "size: ".$file_array['size']."<BR>\n"; if 
is_uploaded_file$file_array['tmp_name;] ) &amp;&amp; $file_array['type'] == 
"image/gif' 
) { move_uploaded_file$file_array['tmp_name'], 
"$file_dir/$file_name") or die ("Couldn't copy"); print "<IMG 
src='\"
$file_url/$file_name\"'>
<P>\n\n"
; } } ?&gt; </P>
<
FORM method=post encType=multipart/form-data>
<
P><INPUT type=hidden value=100024 name=MAX_FILE_SIZE> <INPUT type=file 
name
=fupload><BR><INPUT type=submit value="Upload" name="Upload File"
</
P>
<
P>&nbsp;</P>
<
P>&nbsp;</P>
<
P>&nbsp;</P>
<
TABLE cellSpacing=0 cellPadding=0 width="100%" border=1>
  <
TBODY>
  <
TR>
    <
TD>

and the server gives me this error (when all variables are filled in):

Code:
Parse error: parse error in /mnt/host-users/homeworkhh/mtuploader.php on line 6
and again, i cant find any errors.....i have even sent that one to others and they cant find anything wrong with it can someone PLZ help me???

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #2  
Old 05-20-2002, 09:18 AM
Logician's Avatar
Logician Logician is offline
 
Join Date: Nov 2001
Location: inside vb code
Posts: 4,449
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

1- Missing " at the end of line:
$message="$guess is too low, try a higher number:;
should be:
$message="$guess is too low, try a higher number:";

2- Unnecessary space at:
$file_ url= "http://www.yoursite.com/uploads";
Should be:
$file_url= "http://www.yoursite.com/uploads";

Reply With Quote
  #3  
Old 05-20-2002, 09:24 AM
pattox2k1's Avatar
pattox2k1 pattox2k1 is offline
 
Join Date: Jan 2002
Posts: 128
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

ok thx for #1 that worked (jus a typo, typed it up quickly) but i did what u say on #2 but it say this error:

Code:
Parse error: parse error, expecting `']'' in /mnt/host-users/homeworkhh/mtuploader.php on line 11



what might it be????
Reply With Quote
  #4  
Old 05-20-2002, 09:38 AM
Logician's Avatar
Logician Logician is offline
 
Join Date: Nov 2001
Location: inside vb code
Posts: 4,449
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

$file_array['tmp_name;]
is wrong. Should be:
$file_array['tmp_name'];

These are very easy to catch syntax errors. Please check your code carefully, I'm sure you can easily correct them..

Regards,
Logician
Reply With Quote
  #5  
Old 05-20-2002, 09:44 AM
pattox2k1's Avatar
pattox2k1 pattox2k1 is offline
 
Join Date: Jan 2002
Posts: 128
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

ok thx i typed 1 up quickly and one late at night so i wouldnt know, and i aint that good wif PHP and they r my first scripts so i wouldnt know where to look for errors .....BTW i jus did what u say and i get this error:

Code:
Parse error: parse error in /mnt/host-users/homeworkhh/mtuploader.php on line 11





PLZ help...........
Reply With Quote
  #6  
Old 05-20-2002, 10:15 AM
Logician's Avatar
Logician Logician is offline
 
Join Date: Nov 2001
Location: inside vb code
Posts: 4,449
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

file_array['type'] == "image/gif'
is wrong. Should be:
file_array['type'] == "image/gif"

You better use this code below. I edited all your syntax errors so you wouldnt get any parse errors with this one. (However this only applies to syntax errors, I cant say anything with your coding algorithm.

And may I suggest you begining PHP from the begining with learning the basics first? You are going too fast to write this script if you really dont know how to correct these simple errors. My 2 cents..

-- cut ---
$file_dir= "/path/to/fokder/uploads";
$file_url= "http://www.yoursite.com/uploads";

foreach( $HTTP_POST_FILES as $file_name => $file_array )
{
print "path: ".$file_array['tmp_name']."<BR>\n";
print "name: ".$file_array['name']."<BR>\n";
print "type: ".$file_array['type']."<BR>\n";
print "size: ".$file_array['size']."<BR>\n";
$filename=(string)$file_array['tmp_name'];
$filetype=(string) $file_array['type'];
if (is_uploaded_file($filename) AND $filetype=="image/gif" )
{

$log_v1=$file_array['tmp_name']; //$log_v2=$file_dir."/".$file_name;

move_uploaded_file($log_v1, $log_v2) or die ("Couldn't copy");

print "<IMG src='\"$file_url/$file_name\"'><P>\n\n"; }
}
-- cut ---
Reply With Quote
  #7  
Old 05-20-2002, 10:23 AM
pattox2k1's Avatar
pattox2k1 pattox2k1 is offline
 
Join Date: Jan 2002
Posts: 128
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

that dont work....neither of them
Reply With Quote
  #8  
Old 05-20-2002, 10:27 AM
Logician's Avatar
Logician Logician is offline
 
Join Date: Nov 2001
Location: inside vb code
Posts: 4,449
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

pattox2k1, the code I posted is free of syntax errors, you wouldnt get any parse errors or anything with that code.

But as I said, I dont know if it works as it should be or not, because I am not aware of what you are trying to do with this script. You asked the correction of the errors you get and I fixed them. If your algorithm is wrong, the code might not do what you are aiming to do, even if it gives no errors..
Reply With Quote
  #9  
Old 05-22-2002, 06:08 AM
pattox2k1's Avatar
pattox2k1 pattox2k1 is offline
 
Join Date: Jan 2002
Posts: 128
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

ok then i will try and type it up again and see what happens........if it dont work i will ask someone else for help
Reply With Quote
Reply


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

Forum Jump


All times are GMT. The time now is 10:36 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04267 seconds
  • Memory Usage 2,301KB
  • Queries Executed 22 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (4)bbcode_code
  • (2)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (9)post_thanks_box
  • (9)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (9)post_thanks_postbit_info
  • (8)postbit
  • (9)postbit_onlinestatus
  • (9)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete