Reply
Unexpected End
Old 12-24-2007, 10:08 AM Unexpected End
Experienced Talker

Posts: 33
Name: matt
Here is my error:
Code:
Parse error: syntax error, unexpected $end in /home/troop439/public_html/campouts/wiki.php on line 135
And here is my code:
PHP Code:
<?php
#####################################
#####################################
## File: wiki.php                  ##
## Project: List Confirm System    ##
## By: MeleFire                    ##
## Copyright 2007                  ##
#####################################
##            WARNING:             ##
#####################################
## THIS IS AN EXTENSION TO ERS     ##
## ------------------------------- ##
## -------------by t439----------- ##
## ------------------------------- ##
## IT REQUIRES MediaWiki           ##
#####################################
#####################################
// Call Global Config File
include("config.php");
// Call Password Protect File
include("password_protect.php");
//Call header file
include 'header.php';
###########################
# Extension Config

// Set Wiki DB User
$wiki_db_user "userName";
// Set Wiki DB Location
$wiki_db_loc "localhost";
// Set Wiki DB Password
$wiki_db_password "passWord";
// Set Wiki DB Name
$wiki_db_name "dbName";
// Set Wiki DB Prefix
$wiki_db_prefix "pf_";

# End Config
###########################

###########################
# Check for function
if(!isset($_GET['function'])) {
    echo 
"Error: No function defined! errorno ext-45322";
    exit;
}
# End Check
###########################

###########################
# Function: Search Users
if($_GET['function'] == "search") {
    if(isset(
$_POST['query'])) {
        
$search $_POST['query'];
        
$rawtname "user";
        
$table $wiki_db_prefix.$rawtname;
        
$sql "SELECT user_id,user_name FROM `$table` WHERE `user_name` LIKE '%$search%'";
        
mysql_connect($wiki_db_loc$wiki_db_user$wiki_db_password);
        @
mysql_select_db($wiki_db_name) or die( "Could not connect to wiki, check wiki.php! errorno ext-5612");
        
$result mysql_query($sql);
        
$result_num mysql_num_fields($result);
        echo 
"<center><h1>Results for Search: $search</h1>";
        echo 
"<table border='3' background=\"http://www.webmaster-talk.com/images/vortex.jpg\"><tr>";
        
// printing table headers
        
for($i=0$i<$result_num$i++)
        {
            
$field mysql_fetch_field($result);
            echo 
"<td><b><font color=\"#FFFFFF\">{$field->name}</font></b></td>";
        }
        echo 
"</tr>\n";
        
// table contents 
        
while($row mysql_fetch_assoc($result)) 
        { 
        echo 
"<tr>"
        
$url $row['user_id']; 
        foreach(
$row as $cell
        { 
        echo 
"<td><a href=wiki.php?function=edituser&user=$url><font color=\"#00FFFF\">$cell</font></a></td>"
        } 
        echo 
"</tr>\n"
        } 
        echo 
"</table></center>";
        
mysql_free_result($result);
    } else {
        echo 
"No search Defined";
    }
}
# End Function
###########################

###########################
# Function: Edit User
if($_GET['function'] == "edituser") {
    if(isset(
$_GET['user'])) {
        
$userid $_GET['user'];
        
$rawtname "user";
        
$table $wiki_db_prefix.$rawtname;
        
$sql "SELECT * FROM `$table` WHERE `user_id` = '$userid'";
        
mysql_connect($wiki_db_loc$wiki_db_user$wiki_db_password);
        @
mysql_select_db($wiki_db_name) or die( "Could not connect to wiki, check wiki.php! errorno ext-5612");
        
$result mysql_query($sql);
        
$num=mysql_num_rows($result);
        
$i=0;
        while(
$row mysql_fetch_array($result)) {
        echo <<<END
        <table border="0" width="100%" cellpadding="10">
        <tr>
        <td width="50%" valign="top">
        <form action="wiki.php?function=doedit?user=$userid" method="post">
        Userid: $userid <br />
        Username: <input type="text" name="username" value="$row
[user_name]" /><br />
        Realname: <input type="text" name="realname" value="$row
[user_real_name]" /><br />
        E-Mail: <input type="text" name="email" value="$row
[user_email]" /><br />
        Token: $row
[user_token]<br />
        </td>
        <td width="50%" valign="top">
        Email Authenticated: <input type="text" name="emailauthenticated" value="$row
[user_email_authenticated]" /><br />
        Registration Date: <input type="text" name="registration" value="$row
[user_registration]" /><br />
        Editcount: <input type="text" name="edits" value="$row
[user_editcount]" /><br />
        <input type="submit" />
        </form>
        </td>
        </tr>
        </table>
        END;
        mysql_free_result($result);
        }
    } else {
        echo "No User Defined!";
}
# End Function
###########################    
//Call Page Footer
include("footer.php");
?>
I have checked everything and can't find the issue.

thanks

Last edited by chrishirst : 12-28-2007 at 07:02 AM. Reason: passwords & username removed
melefire is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
Old 12-24-2007, 10:13 AM Re: Unexpected End
Experienced Talker

Posts: 30
hehe, you are missing a '}' at the end...
klaroen is offline
Reply With Quote
View Public Profile
 
Old 12-24-2007, 11:55 AM Re: Unexpected End
mgraphic's Avatar
Truth Seeker

Latest Blog Post:
Wireless Audio
Posts: 2,320
Name: Keith Marshall
Location: West Hartford, CT
On heridoc structure, your ending line should be on a newline without any whitespace before it.

PHP Code:
        echo <<<END 
        
<table border="0" width="100%" cellpadding="10"
        <
tr
        <
td width="50%" valign="top"
        <
form action="wiki.php?function=doedit?user=$userid" method="post"
        
Userid$userid <br /> 
        
Username: <input type="text" name="username" value="$row[user_name]" /><br /> 
        
Realname: <input type="text" name="realname" value="$row[user_real_name]" /><br /> 
        
E-Mail: <input type="text" name="email" value="$row[user_email]" /><br /> 
        
Token$row[user_token]<br /> 
        </
td
        <
td width="50%" valign="top"
        
Email Authenticated: <input type="text" name="emailauthenticated" value="$row[user_email_authenticated]" /><br /> 
        
Registration Date: <input type="text" name="registration" value="$row[user_registration]" /><br /> 
        
Editcount: <input type="text" name="edits" value="$row[user_editcount]" /><br /> 
        <
input type="submit" /> 
        </
form
        </
td
        </
tr
        </
table
END
__________________

<mgraphic /> - I don't have a solution but I admire the problem.
mgraphic is offline
Reply With Quote
View Public Profile
 
Old 12-28-2007, 04:13 AM Re: Unexpected End
JeremyMiller's Avatar
Full-Time TeraTasker

Posts: 984
Name: Jeremy Miller
Location: Reno, NV
Thought I'd add that

Quote:
<form action="wiki.php?function=doedit?user=$userid" method="post">
should be
Code:
<form action="wiki.php?function=doedit&user=$userid" method="post">
or you'll have problems.

And I seriously hope that the usernames and passwords are fake... hint, hint.
__________________
Jeremy Miller - TeraTask Technologies, LLC
Content Farmer - Automated Posting for Content & Blog Sites

Last edited by JeremyMiller : 12-28-2007 at 04:14 AM.
JeremyMiller is offline
Reply With Quote
View Public Profile Visit JeremyMiller's homepage!
 
Old 12-28-2007, 07:02 AM Re: Unexpected End
chrishirst's Avatar
Super Moderator

Posts: 13,517
Location: Blackpool. UK
Quote:
Originally Posted by JeremyMiller View Post
And I seriously hope that the usernames and passwords are fake... hint, hint.
Edited, Just in case they weren't
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Indifference will be the downfall of mankind, but who cares?
Code Samples | People Counting System
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Reply     « Reply to Unexpected End
 

Thread Tools

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

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




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.14459 seconds with 12 queries