/    Sign up×
Community /Pin to ProfileBookmark

Textarea causing T_LNUMBER error

[url]http://your-space.awardspace.com/[/url] (not done yet but my problem lies in that website)

I am making a small version of myspace because i want to… ik… im just really bored, BUT when ever i go to add a comment to see if it works, it gets this error and its the first time i’ve ever seen it :/ so i dont know what to fix:

[CODE]
Parse error: parse error, unexpected T_LNUMBER in /home/www/your-space.awardspace.com/tristian/process.php on line 9[/CODE]

Also, how do i make it so a line break in the textarea translates into a <br> when i assign the value to a variable?

::EDIT::

Here is the code:

Acually form:

[CODE] <?php
// If error Stop
if(isset($HTTP_GET_VARS[‘meserror’])){
echo “<font color=”#ff0000″>* You must enter a comment!</font>”;
}
// If logged in show comment box
if($session->logged_in){
echo “<textarea name=”message” cols=”30″ rows=”5″ wrap=”on” style=”overflow:auto;”></textarea><br><br>”
.”<input type=”submit” value=”Submit”><input type=”hidden” value=”1″ name=”subcomment”><input type=”hidden” value=”$session->username” name=”sender”><input type=”reset” value=”Reset”>”;
}else{ // If not logged in show error
echo “<center><b>You must be logged in to do that!</b><br><br>”
.”<a href=”http://your-space.awardspace.com/index.php”>Log In</a> | <a href=”http://your-space.awardspace.com/register.php”>Register</a></center>”;
}
?>[/CODE]

the backbone (process.php):

[CODE]$file = fopen(“$name/process.php”, “a+”);
chmod(“$name/process.php”, 0755);
$info = “<?php if(isset($_POST[‘subcomment’])){
if(!empty($_POST[‘message’])){
$message = $_POST[‘message’];
$sender = $_POST[‘sender’];
$fixdate = time() + (1 * 1 * 60 * 60);
$date = date(‘n/j/y g:i a’, $fixdate);
$file = fopen(“comments.php”, “a+”);
chmod(“comments.php”, 0755);
$info = “<table width=”540″ class=comments1 border=”0″ cellpadding=”2″ cellspacing=”2″><tr><td class=sender>$sender</td><td class=date align=right>$date</td></tr><tr><td colspan=2 class=message>$message</td></tr></table>”;
fwrite($file, $info);
fclose($file);
header(“Location: index.php”);
}else{
recall(1);
}
} ?>”;
fwrite($file, $info);
fclose($file);[/CODE]

to post a comment
PHP

8 Comments(s)

Copy linkTweet thisAlerts:
@pcthugSep 09.2006 — To help us help you please post all relevant code. To convert all newlines to HTML line breaks use the nl2br function.
Copy linkTweet thisAlerts:
@Player_11authorSep 09.2006 — k i fixed the first post
Copy linkTweet thisAlerts:
@pcthugSep 09.2006 — Why are you writing raw php code to process.php?

Are you using the eval function to execute this PHP?

Please explain your logic.
Copy linkTweet thisAlerts:
@Player_11authorSep 09.2006 — is that bad?

so far its worked for everything else and whats eval?


----

my bad, on the first code i gave i forgot to add in the form tag... well that tag is this: <form method="post" action="process.php"> then after that code a simple </form> yea...


----

explain my logic... well im new to php as u can see i bet, but the reason i am doing this is because when a viewer registers, they are sent to another page in the main directory that creates a sub directory named exactly how their username is spell, but lowercase. and one of the files is the index.php file with includes all the other files to make one page. The reason i have multiple files is so the user can edit them to their liking, doing it this way because i dont know how to make it so it goes to a certain point in the file, but i ahvent gotten that far yet. ehhh ill just give you the code:

here is the code that registers them:

[CODE]function procRegister(){
global $session, $form;
/* Convert username to all lowercase (by option) */
if(ALL_LOWERCASE){
$_POST['user'] = strtolower($_POST['user']);
}
/* Registration attempt */
$retval = $session->register($_POST['user'], $_POST['pass'], $_POST['email'], $_POST['subagree']);

/* Registration Successful */
if($retval == 0){
$_SESSION['reguname'] = $_POST['user'];
$_SESSION['regsuccess'] = true;
/* Get user name then put in lowercase */
$uneditedname = $_POST['user'];
$name = strtolower($uneditedname);
/* get default layout code then make the users directory */
$default = file_get_contents("defaultlayout.php");
mkdir("$name/", 0777);
$file = fopen("$name/index.php", "a+");
chmod("$name/index.php", 0755);
$name1 = "<?php $name = "".$uneditedname.""; ?>";
$info = "<html><head><title>Your-Space - ".$_POST['user']."</title><link rel=StyleSheet type=text/css href=http://your-space.awardspace.com/layoutstyle.css></head><body>".$name1."<!-- Start Profile -->".$default."<!-- End Profile --></body></html>";
fwrite($file, $info);
fclose($file);
/* Creates the parts of the profile, including the comment, comments, photo, about me, interests, and basic info */
$file = fopen("$name/comments.php", "a+");
chmod("$name/comments.php", 0755);
fclose($file);
$file = fopen("$name/photo.php", "a+");
chmod("$name/photo.php", 0755);
$info = "<img src="../images/nophoto.gif" style="width:200px;" alt="No Photo Available" title="No Photo Available" />";
fwrite($file, $info);
fclose($file);
$file = fopen("$name/about.php", "a+");
chmod("$name/about.php", 0755);
$info = "Everything about you!";
fwrite($file, $info);
fclose($file);
$file = fopen("$name/interest.php", "a+");
chmod("$name/interest.php", 0755);
$info = "What do you like?";
fwrite($file, $info);
fclose($file);
$file = fopen("$name/basic.php", "a+");
chmod("$name/basic.php", 0755);
$info = "<table width="200" border="0">
<tr>
<td>Name:</td><td><? echo $uneditedname; ?></td>
</tr>
<tr>
<td>Nick Name(s):</td><td>N/A</td>
</tr>
<tr>
<td>Age:</td><td>N/A</td>
</tr>
<tr>
<td>Hometown:</td><td>N/A</td>
</tr>
<tr>
<td>Birthday:</td><td>N/A</td>
</tr>
</table>";
fwrite($file, $info);
fclose($file);
$default = file_get_contents("defaultcomment.php");
$file = fopen("$name/comment.php", "a+");
chmod("$name/comment.php", 0755);
$info = "<?php include('../include/session.php'); ?><?php function recall($error){if($error==1){header("Location: comment.php?meserror=1");}} ?><html><head><title>Your-Space - Comment ".$_POST['user']."</title><link rel=StyleSheet type=text/css href=http://your-space.awardspace.com/layoutstyle.css></head><body>".$name1."<!-- Start Comment -->".$default."<!-- End Comment --></body></html>";
fwrite($file, $info);
fclose($file);
/* The Backbone to the profile */
$file = fopen("$name/process.php", "a+");
chmod("$name/process.php", 0755);
$info = "<?php if(isset($_POST['subcomment'])){
if(!empty($_POST['message'])){
$message = $_POST['message'];
$sender = $_POST['sender'];
$fixdate = time() + (1 * 1 * 60 * 60);
$date = date('n/j/y g:i a', $fixdate);
$file = fopen("comments.php", "a+");
chmod("comments.php", 0755);
$info = "<table width="540" class="comments1" border="0" cellpadding="2" cellspacing="2"><tr><td class="sender">$sender</td><td class="date" align="right">$date</td></tr><tr><td colspan="2" class="message">$message</td></tr></table>";
fwrite($file, $info);
fclose($file);
header("Location: index.php");
}else{
recall(1);
}
} ?>";
fwrite($file, $info);
fclose($file);
header("Location: ".$session->referrer."?agree=1");
}
/* Error found with form */
else if($retval == 1){
$_SESSION['value_array'] = $_POST;
$_SESSION['error_array'] = $form->getErrorArray();
header("Location: ".$session->referrer."?agree=1");
}
/* Registration attempt failed */
else if($retval == 2){
$_SESSION['reguname'] = $_POST['user'];
$_SESSION['regsuccess'] = false;
header("Location: ".$session->referrer."?agree=1");
}
}[/CODE]


but all i really need to know is how to fix the T_LNUMBER error
Copy linkTweet thisAlerts:
@Player_11authorSep 09.2006 — So line nine is this:

[CODE]$info = "<table width="540" class=comments1 border="0" cellpadding="2" cellspacing="2"><tr><td class=sender>$sender</td><td class=date align=right>$date</td></tr><tr><td colspan=2 class=message>$message</td></tr></table>";[/CODE]

right? and i looked up T_LNUMBER, [0] [,] [3] [)] [;], one of those symbols causes the problem apperantly
Copy linkTweet thisAlerts:
@boeing747fpSep 09.2006 — what's "Line 9" of your "process.php" code?

EDIT: oops (i was posting this before you posted line 9 ? )
Copy linkTweet thisAlerts:
@pcthugSep 09.2006 — Usually the error is trigged before the specified line in the error message. Please post the entire contents of [B]process.php[/B], unmodified.
Copy linkTweet thisAlerts:
@boeing747fpSep 09.2006 — yea just counting down from the first snippet you posted from process.php, the line you posted starting with "$info =" is more than 9 lines from the top which isnt even the actual top.
×

Success!

Help @Player_11 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 6.2,
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: @meenaratha,
tipped: article
amount: 1000 SATS,

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

tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,
)...