Jump to content

Auto Fresh My Pages


Scotty13
 Share

Recommended Posts

This is what I have. The orig script was auto_refresh_blab, I've changed it to auto_refresh_anno (for announce). I can't find whats wrong. I think I tried everything.ERROR: Parse error: syntax error, unexpected ';', expecting T_PAAMAYIM_NEKUDOTAYIM in /home/myglobal/public_html/root/auto_refresh_anno.php on line 70 (I marked line 70) <?php// Start_session, check if user is logged in or not, and connect to the database all in one included fileinclude_once("scripts/checkuserlog.php");// Include the class files for auto making links out of full URLs and for Time Ago date formattinginclude_once("wi_class_files/autoMakeLinks.php");include_once ("wi_class_files/agoTimeFormat.php");// Create the two objects before we can use them below in this script$activeLinkObject = new autoActiveLink;$myObject = new convertToAgo; // Include this script for random tktedmembers display on home pageinclude_once "scripts/homePage_randomMembers.php"; // ------- INITIALIZE SOME VARIABLES ---------// they must be initialized in some server environments or else errors will get thrown$id = "";$username = "";$firstname = "";$lastname = "";$user_pic = "";   $announcerDisplayList = "";$interactionBox = "";$cacheBuster = rand(999999999,9999999999999); // Put on an image URL will help always show new when changed// ------- END INITIALIZE SOME VARIABLES --------- // ------- ANNO DISPLAY LIST ---------$sql_annos = mysql_query("SELECT * FROM announcing ORDER BY anno_date DESC LIMIT 10");$announcerDisplayList = ""; // Initialize the variable herewhile($row = mysql_fetch_array($sql_annos)){ $annoid = $row["id"];$uid = $row["tkt_id"];$the_anno = $row["the_anno"];//$the_anno = substr($the_anno, 0, 48);$the_anno = wordwrap($the_anno, 30, "\n", true);//$the_anno = wordwrap($the_anno, 14, "<br />\n");$notokinarray = array("fag", "gay", "######", "######", "stupid", "idiot", "asshole", "######", "######");$okinarray = array("sorcerer", "grey", "shug", "farg", "smart", "awesome guy", "butthole", "cake", "dude");$the_anno = str_replace($notokinarray, $okinarray, $the_anno);$the_anno = ($activeLinkObject -> makeActiveLink($the_anno));$anno_date = $row["anno_date"];$convertedTime = ($myObject -> convert_datetime($anno_date));$whenAnno = ($myObject -> makeAgo($convertedTime));$anno_type = $row["anno_type"];$anno_device = $row["device"]; // Inner sql query$sql_tkt_data = mysql_query("SELECT id, username, firstname, lastname FROM myMembers WHERE id='$uid' LIMIT 1"); while($row = mysql_fetch_array($sql_tkt_data)){ $uid = $row["id"];$username = $row["username"];$firstname = $row["firstname"];$lastname = $row["lastname"];if ($firstname != "") {$username = "$firstname $lastname"; } // (I added usernames late in my system, this line is not needed for you)     /////// Mechanism to Display Pic. See if they have uploaded a pic or not //////////////////////////$ucheck_pic = "tktedmembers/$uid/image01.jpg";$udefault_pic = "tktedmembers/0/image01.jpg";if (file_exists($ucheck_pic)) {$announcer_pic = '<div style="overflow:hidden; width:40px; height:40px;"><img src="' . $ucheck_pic . '" width="40px" border="0" /></div>';// forces picture to be 100px wide and no more} else {Line 70: $announcer_pic = '<img src="' . $udefault_pic . '" width="50px" height="50px" border="0" />'; // forces picture to be 100px wide and no more}     $announcerDisplayList .= '<table width="100%" align="center" cellpadding="4" style="background-color:#CCCCCC; border:#999 1px solid;"><tr><td width="7%" bgcolor="#FFFFFF" valign="top"><a href="res.php?id=' . $uid . '">' . $announcer_pic . '</a></td><td width="93%" bgcolor="#F9F9F9" style="line-height:1.5em;" valign="top"><span class="liteGreyColor textsize9"> ' . $whenAnno . ' <a href="res.php?id=' . $uid . '"><strong>' . $username . '</strong></a> <br />via <em>' . $anno_device . '</em></span><br /><span class="textsize10"> ' . $the_anno . '</span></td></tr></table>';}}// ------- END ANNO DISPLAY LIST ---------// ------- ESTABLISH THE PAGE ID ACCORDING TO CONDITIONS ---------if (isset($_GET['id'])) {$id = preg_replace('#[^0-9]#i', '', $_GET['id']); // filter everything but numbers} else if (isset($_SESSION['id'])) {$id = $ckinOptions_id;}// ------- END ESTABLISH THE PAGE ID ACCORDING TO CONDITIONS ---------// ------- FILTER THE ID AND QUERY THE DATABASE --------$id = preg_replace('#[^0-9]#i', '', $id); // filter everything but numbers on the ID just in case$sql = mysql_query("SELECT * FROM myMembers WHERE id='$id' LIMIT 1"); // query the tktedmembers// ------- END FILTER THE ID AND QUERY THE DATABASE -------- // ------- WHILE LOOP FOR GETTING THE MEMBER DATA ---------while($row = mysql_fetch_array($sql)){ $username = $row["username"];$firstname = $row["firstname"];$lastname = $row["lastname"];    $made_res_date = $row["made_res_date"];$made_res_date = strftime("%b %d, %Y", strtotime($made_res_date));$last_ckin_date = $row["last_ckin_date"];$last_ckin_date = strftime("%b %d, %Y", strtotime($last_ckin_date)); /////// Mechanism to Display Real Name Next to Username - real name(username) //////////////////////////if ($firstname != "" && $lastname != "") {$mainNameLine = "$firstname $lastname";$username = $firstname;} else {$mainNameLine = $username;}}   // ------- POST NEW ANNO TO DATABASE ---------$anno_outout_msg = "";if (isset($_POST['anno_field']) && $_POST['anno_field'] != "" && $_POST['anno_field'] != " "){ $annoWipit = $_POST['annoWipit'];$sessWipit = $_SESSION['wipit'];if (!isset($_SESSION['wipit'])) { } else if ($annoWipit == $sessWipit) {// Delete any annos over 50 for this tktedmembers$sqlDeleteAnnos = mysql_query("SELECT * FROM announcing WHERE tkt_id='$id' ORDER BY anno_date DESC LIMIT 50");$bi = 1;while ($row = mysql_fetch_array($sqlDeleteAnnos)) {$anno_id = $row["id"];if ($bi > 20) {$deleteAnnos = mysql_query("DELETE FROM announcing WHERE id='$anno_id'");}$bi++;}// End Delete any annos over 20 for this tktedmembers$anno_field = $_POST['anno_field'];$anno_field = stripslashes($anno_field);$anno_field = strip_tags($anno_field);$anno_field = mysql_real_escape_string($anno_field);$anno_field = str_replace("'", "'", $anno_field);$sql = mysql_query("INSERT INTO announcing (tkt_id, the_anno, anno_date, anno_type, device) VALUES('$id','$anno_field', now(),'a','$device')") or die (mysql_error());$anno_outout_msg = "";}}// ------- END POST NEW ANNO TO DATABASE ---------   // ------- ESTABLISH THE RES INTERACTION TOKEN ---------$thisRandNum = rand(9999999999999,999999999999999999);$_SESSION['wipit'] = $thisRandNum; // Will always overwrite itself each time this script runs// ------- END ESTABLISH THE RES INTERACTION TOKEN ---------// ------- EVALUATE WHAT CONTENT TO PLACE IN THE MEMBER INTERACTION BOX -------------------// initialize some output variables$the_anno_form = "";$close= "";if (isset($_SESSION['id']) && $ckinOptions_id == $id) { // If SESSION id is set, AND it does equal the reservation owner's ID/* BOX PA FALAR NO ANNO*///////////////////////////////////////////////////////////////////$the_anno_form = $anno_outout_msg . '<div style="background-color:#BDF; border:#999 1px solid; padding:8px;"><form action="res.php" method="post" enctype="multipart/form-data" name="anno_from"> <script language="javascript" type="text/javascript"> var maxAmount = 250;function textCounter(textField, showCountField) {if (textField.value.length > maxAmount) {textField.value = textField.value.substring(0, maxAmount);} else { showCountField.value = maxAmount - textField.value.length;}}</script><form><textarea name="anno_field" rows="6" style="width:99%; "onKeyDown="textCounter(this.form.anno_field,this.form.countDisplay);" onKeyUp="textCounter(this.form.anno_field,this.form.countDisplay);"></textarea><br><input name="annoWipit" type="hidden" value="' . $thisRandNum . '" /><input name="submit" type="submit" value="Comentar" /><input readonly type="text" name="countDisplay" size="3" maxlength="3" value="250"> Remaining <strong>' . $username . '</strong> <form action="res.php" method="post" enctype="multipart/form-data" name="anno_from"></form></div>';// END BOX PA FALAR NO ANNO////////////////////////////////////////////////////////////////// } else { // If no SESSION id is set, which means we have a person who is not check in$interactionBox = '<div style="border:#CCC 1px solid; padding:5px; background-color:#E4E4E4; color:#999; font-size:11px;"><a href="makeareservation.php">Reservations</a> ou <a href="ckin.php">Check In</a> Thank You ' . $username . '</div>';$the_anno_form = '<div style="background-color:#BDF; border:#999 1px solid; padding:8px;"><textarea name="anno_field" rows="3" style="width:99%;"></textarea><a href="makeareservation.php">Make A Reservations</a> ou <a href="ckin.php">Check In</a> Thank You.</div>';}// ------- END EVALUATE WHAT CONTENT TO PLACE IN THE MEMBER INTERACTION BOX -------------------?>  Thanks in advance, S

Link to comment
Share on other sites

the entity is represented that way in full. ' the point though that he was trying to make is that you need to be using a quote, not an apostrophe

Edited by thescientist
Link to comment
Share on other sites

@thescietist... 1st - Thank you. 2nd - changed ', either read ''' or '';' Now I get an error on line 70: Error: Parse error: syntax error, unexpected T_STRING in /home/*******/public_html/root/auto_refresh_anno.php on line 70This is line 70 and 71 below $user_pic = ''' <div style="overflow:hidden; width:40px; height:40px;"><img src="''' . $ucheck_pic . ''' " width="40px" border="0" /></div>'';'

Link to comment
Share on other sites

I'm trying to tell you that you don't use HTML entities in PHP code. "'" doesn't mean anything to PHP. That's what the error is. You need to use actual single quotes instead of HTML codes.

$user_pic = '<div style="overflow:hidden; width:40px; height:40px;"><img src="' . $ucheck_pic . '" width="40px" border="0" /></div>';

Link to comment
Share on other sites

it is not nescery though to use echo to output. you are probably missing something from that tutorial. There are two way you can do

<?phpif($check=='something'){?><h1>Something</h1><b>more text</b><?php}else{?><h1>Did not match anything</h1><?php}?>

<?php if($check=='something'){echo "<h1>Something</h1><b>more text</b>";}else{echo "<h1>Did not match anything</h1>";}?>

both do the same first one is without using echo second one is using echo.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...