This code is driving me nuts! I can't seem to debug it, the error I get is (besides bad coding in general 😉 ):
Parse error: parse error in /usr/local/plesk/apache/vhosts/urban-digital.net/httpdocs/songmeanings/live/links.php on line 80
<? require "shared.inc";
if ($action=="") {
/// view links
commonHeader("links", artistfromid($artist). " Links");
db_Connect();
$rsa = mysql_query("SELECT * FROM links WHERE artist like \"$artist\" order by title desc");
$count = mysql_num_rows($rsa);
if (!$count) { echo "<p align=\"center\">No links for <b>" .artistfromid($artist). "</b> have been submitted.</p>\n<p align=\"center\">If you are a <a href=\"signup.php\">registered</a> user, you can <a href=\"javascript:popUp('links.php?action=add&artist=$artist', 400, 225)\">add links</a>.</p>"; commonFooter(); exit; }
echo "<ul>";
while($data = mysql_fetch_array($rsa))
{
echo "<li><a href=\"url.php?url=$data[url]\">$data[title]</a> - $data[description]</li>\n";
}
echo "</ul>";
commonFooter();
} else {
if ($action=="add") {
/// add link ?>
<HEAD><TITLE>SongMeanings | add link</TITLE><LINK href="images/global.css" type="text/css" rel="stylesheet"></HEAD>
<BODY>
<form name="form1" method="post" action="links.php">
<input type="hidden" name="action" value="submit">
<input type="hidden" name="artist" value="<? echo $artist; ?>">
<p><b>Add A Link</b><br><table width="100%" border="0">
<tr>
<td colspan="3"> </td>
</tr>
<tr>
<td width="50%">Title<br>
<input class="formular" type="text" name="title" size="30" maxlength="255">
<br>
</td>
<td colspan="2">URL<br>
<input class="formular" type="text" name="url" size="30" maxlength="255" value="http://">
</td>
</tr>
<tr>
<td colspan="3">Description<br>
<textarea class="formular" name="description" cols="65" rows="5"></textarea>
<p align="center"><input class="button" type="submit" name="Submit" value="Add"></p>
</td>
</tr>
</table>
</form></p>
</BODY>
<?
} else {
if ($action=="submit") {
/// submit link
if ($url && $title && $description) {
// add
session_start();
if ( session_is_registered("user_name") == TRUE) {
/* ------ USER IS LOGGED IN ------------- */
db_connect();
$user = mysql_query("SELECT * FROM links WHERE (url='$url')");
if (mysql_num_rows($user) > 0) {
$message = "The URL you submitted already exists.";
} else {
$query = mysql_query("INSERT INTO links (id, artist, title, url, description, user, date) VALUES ('','$artist','$title','$url','$description','" . useridfromusername($user_name) . "', NOW(''))");
mysql_db_query("songmeanings", $query);
$message = "<p align=\"center\">Thank you for adding your link.</p><p align=\"center\">[<a href=\"javascript:window.close();\">close this window</a>]</p>"; }
} else {
$message = "You must be <a target=\"_blank\" href=\"signup.php\">registered</a> and logged in to add links.";
/* ------ USER IS LOGGED IN ------------- */
} else { $message = "There was an error, please <a href=javascript:history.back()>review your submission</a>."; } ?>
<HEAD>
<TITLE>SongMeanings | add link</TITLE>
<LINK href="images/global.css" type="text/css" rel="stylesheet">
</HEAD>
<BODY>
<table width="100%" border="0" height="100%">
<tr>
<td><? echo $message; ?></td>
</tr>
</table>
</BODY> <?
}}}