/    Sign up×
Community /Pin to ProfileBookmark

Can’t find $end error

Hey,
I am working with a login code. I completed it and it works perfectly with xampp. However when I uploaded to the server I get:
“Parse error: syntax error, unexpected $end in /export/home/uboard/www/new/users/login.php on line 223”

[CODE]

<?php
session_start();
header(“Cache-control: private”);?>
<html>
<head>
<title>University Board – Eastern Illinois University</title>
<link rel=”stylesheet” href=”../UBblue.css” type=”text/css” media=”screen”>
<link rel=”stylesheet” href=”userstyle.css” type=”text/css” media=”screen”>
<link rel=”stylesheet” href=”../bluelava/bluelava.css” type=”text/css” media=”screen”>
<script type=”text/javascript” src=”../bluelava/jquery-1.2.3.min.js”></script>
<script type=”text/javascript” src=”../bluelava/jquery.easing.min.js”></script>
<script type=”text/javascript” src=”../bluelava/jquery.lavalamp.min.js”></script>
<script type=”text/javascript”>
$(function() {
$(“#1, #2, #3”).lavaLamp({
fx: “backout”,
speed: 700,
click: function(event, menuItem) {
return false;
}
});
});
</script>
</head>
<body>
<table style=”width: 972px” cellspacing=”0″ cellpadding=”0″ align=”center”>
<tr id=”page-spacer”>
<td>&nbsp;</td>
</tr>
<tr id=”page-top”>
<td>
<div id=”header-spacer”>
<a class=”head” href=”http://eiu.edu”>EIU Home</a>&nbsp; :: &nbsp;
<a class=”head” href=”http://www.eiu.edu/~uboard/”>University Board</a>&nbsp;
:: &nbsp;
<a class=”head” href=”http://www.eiu.edu/search/”>Search</a>&nbsp;&nbsp;&nbsp;&nbsp;</div>
<div id=”header-spacer”>
</div>

<div id=”header”>
<div>
<div id=”header-date”>

<script language=”Javascript”>
<!–
var now = new Date();
var dayName = new Array (“Sunday”, “Monday”, “Tuesday”, “Wednesday”, “Thursday”, “Friday”, “Saturday”)
var monName = new Array (“January”, “February”, “March”, “April”, “May”, “June”, “July”, “August”, “September”, “October”, “November”, “December”)
document.write(dayName[now.getDay()] + ” the “)
//–>
</script>
<SCRIPT LANGUAGE=”JavaScript”>
<!– Begin
today=new Date();
day=today.getDate();
year=today.getYear();
month=today.getMonth()+1;
if (day==1) end=(“st”);
else if (day==2) end=(“nd”);
else if (day==3) end=(“rd”);
else if (day==21) end=(“st”);
else if (day==22) end=(“nd”);
else if (day==23) end=(“rd”);
else if (day==31) end=(“st”);
else end=(“th”);
if (month==1) name=(“January”);
else if (month==2) name=(“February”);
else if (month==3) name=(“March”);
else if (month==4) name=(“April”);
else if (month==5) name=(“May”);
else if (month==6) name=(“June”);
else if (month==7) name=(“July”);
else if (month==8) name=(“August”);
else if (month==9) name=(“September”);
else if (month==10) name=(“October”);
else if (month==11) name=(“November”);
else name=(“December”);
document.write(day + end + ” of ” + name);
// End –>
</script>

</div>
<h1><a href=”../index.html”><strong>University Board</strong></a></h1>
</div>
<i class=”description”><em>Eastern Illinois University</em></i>

</div>
<div id=”page-spacer”>
</div>
<div id=”header-menu”>
<ul class=”lavaLampWithImage” id=”1″ style=”height: 32px; left: 0px; right: 0px; top: 0px; bottom: -19px; width: 927px;”>
<li class=”current”><a href=”#”>Home</a></li>
<li><a href=”#”>Upcoming Events</a></li>
<li><a href=”#”>Past Events</a></li>
<li><a href=”#”>Campus Connection</a></li>
<li><a href=”#”>Forms&amp;Apps</a></li>
<li><a href=”#”>Committees</a></li>
<li><a href=”#”>Contact Us</a></li>
<li><a href=”#”>Calendar</a></li>
<li><a href=”#”>Join Us!</a></li>
</ul>
</div></td>
</tr>
<tr id=”page-middle”>
<td id=”main” style=”height: 74px”>

<div id=”sidebar” style=”width: 100%; height: 300px”>
<?php

$datafile=”data.txt”; //name of the data file

if($_GET[‘action’] == “login”) {

if(!isset($_POST[‘username’]) || !isset($_POST[‘password’])){ //this checks that all the fields are filled in

error_message(“One or more required fields were left blank!”, $username, $password);
}

$file = file($datafile);
while(list(,$value) = each($file)) {
list($fname,$femail,$furl,$fuser,$fpass,$blank) = explode(‘|’, $value);
if($_POST[‘username’] == $fuser && $_POST[‘password’] == $fpass){

$_SESSION[‘name’] = $fuser;
$_SESSION[‘realname’] = $fname;
$_SESSION[‘url’] = $furl;
$_SESSION[’email’] = $femail; //adds the users data to the php session
$_SESSION[‘pass’] = $fpass;

//insert html for sucessfull log on here
//you can use . $_SESSION[‘name’] . for username
// replace name with realname, url, email to display different name
?>

<div style=”height: 300px; overflow: visible;”>
<div style=”width: 20%; float: right”>
<p align=”right” style=”width: 100%; padding-right: 2px”>
<a class=”user” href=”profile.php”>Profile</a> |
<a class=”user” href=”info.php”>Information</a> |
<a class=”user” href=”logout.php”>Logout</a></p>
</div>
<div style=”width: 60%; float: right”>
<p class=”title” align=”center” style=”width: 100%”>Logged In</p>
</div>
<div style=”width: 100%; float: left; display: block”>
<?php
echo “Welcome ” . $_SESSION[‘realname’] . “. You are now logged into the system.”
?>
</div>
<div style=”width: 100%; float: left; display: block”>
&nbsp;</div>
<div style=”width: 100%; float: left; display: block”>
Access your information <a class=”user” href=”info.php”>here</a>.
</div>
<div style=”width: 100%; float: left; display: block”>
View your profile <a class=”user” href=”profile.php”>here</a>.
</div>
<div style=”width: 100%; float: left; display: block”>
&nbsp;</div>
<div style=”width: 100%; float: left; display: block”>
<?php
if($_SESSION[‘name’]==admin){
echo “ADMIN CONTROL PANEL”;
}
?>
</div>
<div style=”width: 100%; float: left; display: block”>
<?php
if($_SESSION[‘name’]==admin){
echo ‘Enter <a class=”user” href=”admin.php”>Admin Portal</a>.’;
}
?>
</div>

</div>

</div>

</td>
</tr>
<tr id=”page-bottom”>
<td id=”footer” class=”text”>
<p class=”text”>University Board is Eastern Illinois University&#39;s
Programming Board.
<br/>The board is made of up coordinators who strive to bring the best
talent in entertainment to campus.<br />

<script type=”text/javascript” language=”JavaScript”>
<!–
ldate = new Date(document.lastModified)
if(ldate.getTime() == 0)
document.write(“Java Error”)
else
document.write(“©2009 EIU University Board. ” + “This Page Was Last Updated ” + ldate.toGMTString())
// –>
</script>

<br /><a href=”http://www.eiu.edu/~uboard/”>University Board Home</a> ::
MLK Jr., University Union, 600 Lincoln Ave., Charleston, IL 61920 ::
<a href=”mailto:###”>Contact Us </a>
</p>
</td>
</tr>
<tr id=”page-spacer”>
<td>&nbsp;</td>
</tr>

</table>

</body>
</html>

<?php
$logink = true;
}
}

if($logink !== true) {
?>
Login failed, bad username/password
<?

}
} elseif($_GET[‘action’] == ‘change’) {

if(!isset($_POST[‘name’]) || !isset($_POST[’email’]) || !isset($_POST[‘url’])) {

//this checks that all the fields are filled in
?>
all fields were not filled in
<?
}

$file = file($datafile);
while(list(,$value) = each($file)){
list($fname,$femail,$furl,$fuser,$fpass) = explode(‘|’, $value);
if($_SESSION[‘name’] == $fuser){

//opens data file to change it

$oldword = “$fname|$femail|$furl|$fuser|$fpass|”;
$newword = $_POST[‘name’] . ‘|’ . $_POST[’email’] . ‘|’ . $_POST[‘url’] . ‘|’ . $_SESSION[‘name’] . ‘|’ . $_SESSION[‘pass’] . ‘|’;
$fp = fopen($datafile, ‘r’);
$data = fread($fp, filesize($datafile));
fclose($fp);
$newdata = str_replace($oldword, $newword, $data);
$fp = fopen($datafile, ‘w’);
fwrite($fp,$newdata) or die (‘error writing’);
fclose($fp);

$succ = true; //data changed sucessfully
?>
Everything was changed successfully please <a href=”index.php”>login</a>
<?

$_SESSION[‘name’] = FALSE;
$_SESSION[‘pass’] = FALSE;
$_SESSION[‘url’] = FALSE;
$_SESSION[‘realname’] = FALSE;
$_SESSION[’email’] = FALSE;

}
}
if($succ !== true) {
?>
Login failed, bad username/password
<?
}
} else {
exit;
}
?>

</div>

</td>
</tr>
<tr id=”page-bottom”>
<td id=”footer” class=”text”>
<p class=”text”></p>

</table>

</body>
</html>

[/CODE]

Thank you in advanced. Any help is greatly appreciated.

to post a comment
PHP

6 Comments(s)

Copy linkTweet thisAlerts:
@MindzaiMay 23.2009 — Works fine for me when I run it on my server.
Copy linkTweet thisAlerts:
@rpcobauthorMay 23.2009 — try: http://www.eiu.edu/~uboard/new/users

user: snakesco

pass: eiu
Copy linkTweet thisAlerts:
@adam_jimenezMay 23.2009 — hmm, maybe it didn't upload the whole file..? try uploading it again and check your disk quota.
Copy linkTweet thisAlerts:
@rpcobauthorMay 23.2009 — Thanks, but a way i was able to check this is line 299 is the last line in the file and that is where the error occurs.

While testing I believe the error the occur above the line 222.
Copy linkTweet thisAlerts:
@adam_jimenezMay 23.2009 — script works ok for me.

i wonder if u have short_tags enabled!

see line 244,267,280
[code=php]
<?
}

$file = file($datafile);[/code]


try changing <? to <?php
Copy linkTweet thisAlerts:
@rpcobauthorMay 23.2009 — Thank you adam that worked. I didn't even think of that. You are awesome.
×

Success!

Help @rpcob spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...