Ok this should be simple for an expert. I was chnging the urls for the links on a page and now i get error Parse error: syntax error, unexpected '<' in /home/sites/orten.me/public_html/sh/createlink.php on line 26 PHP: This is the page in question <?php /* ####################################### ######################################## */ include("config.php"); if (strstr($_SERVER['HTTP_REFERER'], $root)); else { header ("Location: $rooturl"); } $ip = $_SERVER['REMOTE_ADDR']; $url = mysql_real_escape_string($_POST['url']); if(preg_match('|^http(s)?://[a-z0-9-]+(\.[a-z0-9-]+)*(:[0-9]+)?(/.*)?$|i', $url)) { if (empty($_POST['tag'])) { $query = mysql_query("INSERT INTO $table (ip,url) VALUES ('$ip','$url')") or die('MySQL error: '.mysql_error()); $qs = mysql_insert_id(); } else { if (ereg('^[a-zA-Z0-9]+[a-zA-Z0-9]+$', $_POST['tag'])) { $tag = mysql_real_escape_string($_POST['tag']); $query = mysql_query("select * from $table where `tag` = '$tag';") or die('MySQL error: '.mysql_error()); if (mysql_num_rows($query) != 0) die("<p align=\"center\"><font color=\"#FF0000\"><strong>ERROR:</strong></font> The tag you entered has already been taken.<br /> Please <a href =\"javascript:history.back()\">go back</a> and enter a different tag.<br /><br />Powered by <a href=\"http://sh.orten.me\">Sh.orten.Me</a> from <a href=\"http://www.eezyHost.co.uk">eezyHost</a></p>'); else { $query = mysql_query("insert $table (ip,url,tag) VALUES ('$ip','$url','$tag')") or die('MySQL error: '.mysql_error()); $qs = $tag; } } else die('<p align="center"><font color="#FF0000"><strong>ERROR:</strong></font> Your tag contains invalid characters. Only alphanumeric tags with no spaces are allowed.<br /> Please <a href ="javascript:history.back()">go back</a> and enter a different tag.<br /><br />Powered by <a href="http://sh.orten.me">Sh.orten.Me</a> from <a href="http://www.eezyhost.co.uk">eezyHost</a></p>'); } $link = $destination . $qs; require 'success.php'; } else echo '<p align="center"><font color="#FF0000"><strong>ERROR:</strong></font> The URL you entered seems to be invalid.<br /> Please <a href ="javascript:history.back()">go back</a> and enter a different tag.<br /><br />Powered by <a href="http://sh.orten.me">Sh.orten.Me</a> from <a href="http://www.eezyhost.co.uk">eezyHost</a></p>'; ?> PHP: Buggered if I can work it out. Anyone please?
lol you make it if() else{ this is the error i think this is the right code <?php /* ####################################### ######################################## */ include("config.php"); if (strstr($_SERVER['HTTP_REFERER'], $root)); else { header ("Location: $rooturl"); } $ip = $_SERVER['REMOTE_ADDR']; $url = mysql_real_escape_string($_POST['url']); if(preg_match('|^http(s)?://[a-z0-9-]+(\.[a-z0-9-]+)*(:[0-9]+)?(/.*)?$|i', $url)) { if (empty($_POST['tag'])) { $query = mysql_query("INSERT INTO $table (ip,url) VALUES ('$ip','$url')") or die('MySQL error: '.mysql_error()); $qs = mysql_insert_id(); } else { if (ereg('^[a-zA-Z0-9]+[a-zA-Z0-9]+$', $_POST['tag'])) { $tag = mysql_real_escape_string($_POST['tag']); $query = mysql_query("select * from $table where `tag` = '$tag';") or die('MySQL error: '.mysql_error()); if (mysql_num_rows($query) != 0){ die("<p align=\"center\"><font color=\"#FF0000\"><strong>ERROR:</strong></font> The tag you entered has already been taken.<br /> Please <a href =\"javascript:history.back()\">go back</a> and enter a different tag.<br /><br />Powered by <a href=\"http://sh.orten.me\">Sh.orten.Me</a> from <a href=\"http://www.eezyHost.co.uk">eezyHost</a></p>'); }else { $query = mysql_query("insert $table (ip,url,tag) VALUES ('$ip','$url','$tag')") or die('MySQL error: '.mysql_error()); $qs = $tag; } } else die('<p align="center"><font color="#FF0000"><strong>ERROR:</strong></font> Your tag contains invalid characters. Only alphanumeric tags with no spaces are allowed.<br /> Please <a href ="javascript:history.back()">go back</a> and enter a different tag.<br /><br />Powered by <a href="http://sh.orten.me">Sh.orten.Me</a> from <a href="http://www.eezyhost.co.uk">eezyHost</a></p>'); } $link = $destination . $qs; require 'success.php'; } else echo '<p align="center"><font color="#FF0000"><strong>ERROR:</strong></font> The URL you entered seems to be invalid.<br /> Please <a href ="javascript:history.back()">go back</a> and enter a different tag.<br /><br />Powered by <a href="http://sh.orten.me">Sh.orten.Me</a> from <a href="http://www.eezyhost.co.uk">eezyHost</a></p>'; ?> PHP:
Try this: <?php /* ####################################### ######################################## */ ob_start(); include("config.php"); if (strstr($_SERVER['HTTP_REFERER'], $root)) { } else { header ("Location: $rooturl"); } $ip = $_SERVER['REMOTE_ADDR']; $url = mysql_real_escape_string($_POST['url']); if(preg_match('|^http(s)?://[a-z0-9-]+(\.[a-z0-9-]+)*(:[0-9]+)?(/.*)?$|i', $url)) { if (empty($_POST['tag'])) { $query = mysql_query("INSERT INTO $table (ip,url) VALUES ('$ip','$url')") or die('MySQL error: '.mysql_error()); $qs = mysql_insert_id(); } else { if (ereg('^[a-zA-Z0-9]+[a-zA-Z0-9]+$', $_POST['tag'])) { $tag = mysql_real_escape_string($_POST['tag']); $query = mysql_query("select * from $table where `tag` = '$tag';") or die('MySQL error: '.mysql_error()); if (mysql_num_rows($query) != 0) die("<p align=\"center\"><font color=\"#FF0000\"><strong>ERROR:</strong></font> The tag you entered has already been taken.<br /> Please <a href =\"javascript:history.back()\">go back</a> and enter a different tag.<br /><br />Powered by <a href=\"http://sh.orten.me\">Sh.orten.Me</a> from <a href=\"http://www.eezyHost.co.uk\">eezyHost</a></p>"); else { $query = mysql_query("insert $table (ip,url,tag) VALUES ('$ip','$url','$tag')") or die('MySQL error: '.mysql_error()); $qs = $tag; } } else die('<p align="center"><font color="#FF0000"><strong>ERROR:</strong></font> Your tag contains invalid characters. Only alphanumeric tags with no spaces are allowed.<br /> Please <a href ="javascript:history.back()">go back</a> and enter a different tag.<br /><br />Powered by <a href="http://sh.orten.me">Sh.orten.Me</a> from <a href="http://www.eezyhost.co.uk">eezyHost</a></p>'); } $link = $destination . $qs; require 'success.php'; } else echo '<p align="center"><font color="#FF0000"><strong>ERROR:</strong></font> The URL you entered seems to be invalid.<br /> Please <a href ="javascript:history.back()">go back</a> and enter a different tag.<br /><br />Powered by <a href="http://sh.orten.me">Sh.orten.Me</a> from <a href="http://www.eezyhost.co.uk">eezyHost</a></p>'; ob_flush(); ?> PHP:
That returns The fault must be near to the url eezyhost.co.uk as its there abouts that i made changes. The url and texts.
Use your original code (from your first post) and.... Parse error: syntax error, unexpected '<' in /home/sites/orten.me/public_html/sh/createlink.php on line 26 PHP: On line 26: die("<p align=\"center\"><font color=\"#FF0000\"><strong>ERROR:</strong></font> The tag you entered has already been taken.<br /> Please <a href =\"javascript:history.back()\">go back</a> and enter a different tag.<br /><br />Powered by <a href=\"http://sh.orten.me\">Sh.orten.Me</a> from <a href=\"http://www.eezyHost.co.uk">eezyHost</a></p>'); That error is caused by you closing the die() with different quotes, and not escaping the the double quote after co.uk. It should be: die("<p align=\"center\"><font color=\"#FF0000\"><strong>ERROR:</strong></font> The tag you entered has already been taken.<br /> Please <a href =\"javascript:history.back()\">go back</a> and enter a different tag.<br /><br />Powered by <a href=\"http://sh.orten.me\">Sh.orten.Me</a> from <a href=\"http://www.eezyHost.co.uk\">eezyHost</a></p>"); PHP: