Jump to content

rdkd1970

Members
  • Posts

    163
  • Joined

  • Last visited

Everything posted by rdkd1970

  1. I have just changed the login and index on my site but have not updated to the new mysqli. Not able to get my pages to work anymore here is the message I get for this page Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /home/ebermy5/public_html/homefront.php on line 108 This is the code I am not sure why now it does not work. HELP PLEASE $sql_bless = mysql_query("SELECT * FROM chats ORDER BY bless_date DESC $limit"); $blessDisplayList = ""; // Initialize the variable here while($row = mysql_fetch_array($sql_bless)){ $chatid = $row["id"]; $uid = $row["mem_id"]; $bless_chat = $row["bless_chat"] The while loop is on line 108
  2. I dont think it succeeds to upload so I am not sure if the file is in the correct order or what. I did not make the header on line 9 usable it is for the same albums.php but that is at the bottom also.
  3. I am having a time trying to figure out how to correct this. I am testing the emailing to one person then replying but the replies go to the person replying and not the original person. In the db it shows as going from_id to to_id but it is the same number ie 2 in both. But the original ones start out with the correct from_id = 1 and to_id = 2 Here is the script for the inbox [sCRIPT] function toggleChecks(field) { if (document.myform.toggleAll.checked == true){ for (i = 0; i < field.length; i++) { field.checked = true; } } else { for (i = 0; i < field.length; i++) { field.checked = false; } } } $(document).ready(function() { $(".toggle").click(function () { if ($(this).next().is(":hidden")) { $(".hiddenDiv").hide(); $(this).next().slideDown("fast"); } else { $(this).next().hide(); } }); }); function markAsRead(msgID) { $.post("scripts_for_profile/markAsRead.php",{ messageid:msgID, ownerid:<?php echo $_SESSION['SESS_ID']; ?> } ,function(data) { $('#subj_line_'+msgID).addClass('msgRead'); // alert(data); // This line was just for testing returned data from the PHP file, it is not required for marking messages as read }); } function toggleReplyBox(subject,sendername,senderid,recName,recID) { $("#sendernameShow").text(sendername); $("#subjectShow").text(subject); $("#recipientShow").text(recName); document.replyForm.pmSubject.value = subject; document.replyForm.pm_sender_name.value = sendername; //document.replyForm.pmWipit.value = replyWipit; document.replyForm.pm_sender_id.value = senderid; document.replyForm.pm_rec_name.value = recName; document.replyForm.pm_rec_id.value = recID; document.replyForm.replyBtn.value = "Send reply to "+recName; if ($('#replyBox').is(":hidden")) { $('#replyBox').fadeIn(1000); } else { $('#replyBox').hide(); } } function processReply () { var pmSubject = $("#pmSubject"); var pmTextArea = $("#pmTextArea"); var sendername = $("#pm_sender_name"); var senderid = $("#pm_sender_id"); var recName = $("#pm_rec_name"); var recID = $("#pm_rec_id"); //var pm_wipit = $("#pmWipit"); var url = "scripts_for_profile/private_msg_parse.php"; if (pmTextArea.val() == "") { $("#PMStatus").text("Please type in your message.").show().fadeOut(6000); } else { $("#pmFormProcessGif").show(); $.post(url,{ subject: pmSubject.val(), message: pmTextArea.val(), senderName: sendername.val(), senderID: senderid.val(), rcpntName: recName.val(), rcpntID: recID.val() } , function(data) { document.replyForm.pmTextArea.value = ""; $("#pmFormProcessGif").hide(); $('#replyBox').slideUp("fast"); $("#PMFinal").html(" "+data).show().fadeOut(8000); }); } } [/sCRIPT] PHP for the inbox if (isset($_POST['deleteBtn'])) { foreach ($_POST as $key => $value) { $value = urlencode(stripslashes($value)); if ($key != "deleteBtn") { $sql = mysql_query("UPDATE private_messages SET recipientDelete='1', opened='1' WHERE id='$value' AND to_id='".$_SESSION['SESS_ID']."' LIMIT 1"); // Check to see if sender also removed from sent box, then it is safe to remove completely from system } } header("location: pm_inbox.php"); } Code for the outbox if (isset($_POST['deleteBtn'])) { foreach ($_POST as $key => $value) { $value = urlencode(stripslashes($value)); if ($key != "deleteBtn") { $sql = mysql_query("UPDATE private_messages SET senderDelete='1' WHERE id='$value' AND from_id='".$_SESSION['SESS_ID']."' LIMIT 1"); // Check to see if sender also removed from sent box, then it is safe to remove completely from system } } header("location: pm_sentbox.php"); } Script for sentbox [sCRIPT] function toggleChecks(field) { if (document.myform.toggleAll.checked == true){ for (i = 0; i < field.length; i++) { field.checked = true; } } else { for (i = 0; i < field.length; i++) { field.checked = false; } } } $(document).ready(function() { $(".toggle").click(function () { if ($(this).next().is(":hidden")) { $(".hiddenDiv").hide(); $(this).next().slideDown("fast"); } else { $(this).next().hide(); } }); }); </script> <style type="text/css"> .hiddenDiv{display:none} #pmFormProcessGif{display:none} .msgDefault {font-weight:bold;} .msgRead {font-weight:100;color:#666;} [/sCRIPT] :-\
  4. I am working on making an album however I am not sure where I am going wrong with my codes. I have an upload and thumbs folder in the albums folder but I keep getting this message.... Warning: mkdir() [function.mkdir]: File exists in /home/ebermy5/public_html/albums/album_func.php on line 44 Warning: mkdir() [function.mkdir]: File exists in /home/ebermy5/public_html/albums/album_func.php on line 45 Warning: Cannot modify header information - headers already sent by (output started at /home/ebermy5/public_html/albums/create_album.php:9) in /home/ebermy5/public_html/albums/create_album.php on line 29 Codes: for line 44 and 45 function create_album($album_name, $album_description){ $album_name = mysql_real_escape_string(htmlentities($album_name)); $album_description = mysql_real_escape_string(htmlentities($album_description)); mysql_query("INSERT INTO `albums` VALUES ('', '".$_SESSION['SESS_ID']."', UNIX_TIMESTAMP(), `$album_name`,`$album_description`)"); mkdir('uploads/'.mysql_insert_id(), 0744); mkdir('uploads/thumbs/'.mysql_insert_id(), 0744); } Code: for line 29 if(isset($_POST['album_name'], $_POST['album_description'])){ $album_name = $_POST['album_name']; $album_description = $_POST['album_description']; $errors = ""; if(empty($album_name) || empty($album_description)){ $errors = 'Album name and description required'; }else{ if(strlen($album_name) > 55 || strlen($album_description) > 255){ $errors = 'One or more fields contains too many characters'; } } if(!empty($errors)){ foreach($errors as $error){ echo $errors, '<br />'; } } else { create_album ($album_name, $album_description); header('Location: albums.php'); exit(); } }
  5. okay in the javascript it says undefined variable my_uname array subject which is this what is happening is it looks like this in the db to_id from_id 8 4 4 4 So now it is going back to the person replying. <div class="hiddenDiv"> <br /> <?php echo stripslashes(wordwrap(nl2br($row['message']), 54, "\n", true)); ?> <br /><br /><a href="javascript:toggleReplyBox('<?php echo stripslashes($row['subject']); ?>','<?php echo $my_uname; ?>','<?php echo $Sid; ?>','<?php echo $Sname; ?>','<?php echo $fr_id; ?>')">REPLY</a><br /> </div>
  6. it does not go to far it gives the message from this line "missing data" if (isset($_POST['message'])) { // Escape and prepare our variables for insertion into the database $to = ($_POST['rcpntID']); $from = ($_POST['senderID']); print_r($_POST['senderID']); //$toName = ($_POST['rcpntName']); //$fromName = ($_POST['senderName']); $sub = htmlspecialchars($_POST['subject']); $msg = htmlspecialchars($_POST['message']); $sub = mysql_real_escape_string($sub); $msg = mysql_real_escape_string($msg); // Handle all pm form specific error checking here if (empty($to) || empty($from) || empty($sub) || empty($msg)) { echo '<img src="../image_header/round_error.png" alt="Error" width="31" height="30" /> Missing Data to continue'; exit();
  7. this is the javascript that handles the replies that is where the PHP_SELF plays as the reply is javascript. it is supposed to work with the form above. function toggleReplyBox(subject,sendername,senderid,recName,recID) { $("#sendernameShow").text(sendername); $("#subjectShow").text(subject); $("#recipientShow").text(recName); document.replyForm.pmSubject.value = subject; document.replyForm.pm_sender_name.value = sendername; //document.replyForm.pmWipit.value = replyWipit; document.replyForm.pm_sender_id.value = senderid; document.replyForm.pm_rec_name.value = recName; document.replyForm.pm_rec_id.value = recID; document.replyForm.replyBtn.value = "Send reply to "+recName; if ($('#replyBox').is(":hidden")) { $('#replyBox').fadeIn(1000); } else { $('#replyBox').hide(); } } function processReply () { var pmSubject = $("#pmSubject"); var pmTextArea = $("#pmTextArea"); var sendername = $("#pm_sender_name"); var senderid = $("#pm_sender_id"); var recName = $("#pm_rec_name"); var recID = $("#pm_rec_id"); //var pm_wipit = $("#pmWipit"); var url = "scripts_for_profile/private_msg_parse.php"; if (pmTextArea.val() == "") { $("#PMStatus").text("Please type in your message.").show().fadeOut(6000); } else { $("#pmFormProcessGif").show(); $.post(url,{ subject: pmSubject.val(), message: pmTextArea.val(), senderName: sendername.val(), senderID: senderid.val(), rcpntName: recName.val(), rcpntID: recID.val() } , function(data) { document.replyForm.pmTextArea.value = ""; $("#pmFormProcessGif").hide(); $('#replyBox').slideUp("fast"); $("#PMFinal").html(" "+data).show().fadeOut(8000); }); } }
  8. This is the parse form that checks for id etc. I just added this <?php echo $fr_id; ?> the line that was saying undefined Sname and this below form let me know it is missing data. // Process the message once it has been sent if (isset($_POST['message'])) { // Escape and prepare our variables for insertion into the database $to = ($_POST['rcpntID']); $from = ($_POST['senderID']); $sub = htmlspecialchars($_POST['subject']); // Convert html tags and such to html entities which are safer to store and display $msg = htmlspecialchars($_POST['message']); // Convert html tags and such to html entities which are safer to store and display $sub = mysql_real_escape_string($sub); // Just in case anything malicious is not converted, we escape those characters here $msg = mysql_real_escape_string($msg); // Just in case anything malicious is not converted, we escape those characters here // Handle all pm form specific error checking here if (empty($to) || empty($from) || empty($sub) || empty($msg)) { echo '<img src="../image_header/round_error.png" alt="Error" width="31" height="30" /> Missing Data to continue'; exit(); } else { // Delete the message residing at the tail end of their list so they cannot archive more than 100 PMs ------------------ $sqldeleteTail = mysql_query("SELECT * FROM private_messages WHERE to_id='$to' ORDER BY time_sent DESC LIMIT 0,100"); $dci = 1; while($row = mysql_fetch_array($sqldeleteTail)){ $pm_id = $row["id"]; if ($dci > 99) { $deleteTail = mysql_query("DELETE FROM private_msg WHERE id='$pm_id'"); } $dci++; } // End delete any comments past 100 off of the tail end ------------- // INSERT the data into your table now $sql = "INSERT INTO private_messages (to_id, from_id, time_sent, subject, message) VALUES ('$to', '$from', now(), '$sub', '$msg')"; if (!mysql_query($sql)) { echo '<img src="../image_header/round_error.png" alt="Error" width="31" height="30" /> Could not send message! An insertion query error has occured.'; exit();
  9. this is the reply form. <!-- Start Hidden Container the holds the Reply Form --> <div id="replyBox" style="display:none; width:680px; height:264px; background-color: #005900; background-repeat:repeat; border: #333 1px solid; top:51px; position:fixed; margin:auto; z-index:50; padding:20px; color:#FFF;"> <div align="right"><a href="javascript:toggleReplyBox('close')"><font color="#00CCFF"><strong>CLOSE</strong></font></a></div> <h2>Replying to <span style="color:#ABE3FE;" id="recipientShow"></span></h2> Subject: <strong><span style="color:#ABE3FE;" id="subjectShow"></span></strong> <br> <form action="javascript:processReply();" name="replyForm" id="replyForm" method="post"> <textarea id="pmTextArea" rows="8" style="width:98%;"></textarea><br /> <input type="hidden" id="pmSubject" /> <input type="hidden" id="pm_rec_id" /> <input type="hidden" id="pm_rec_name" /> <input type="hidden" id="pm_sender_id" /> <input type="hidden" id="pm_sender_name" /> <input type="hidden" id="" /> <br /> <input name="replyBtn" type="button" onclick="javascript:processReply()" /> <span id="pmFormProcessGif"><img src="images/loading.gif" width="28" height="10" alt="Loading" /></span> <div id="PMStatus" style="color:#F00; font-size:14px; font-weight:700;"> </div> </form> </div> <!-- End Hidden Container the holds the Reply Form --> <!-- Start PM Reply Final Message box showing user message status when needed --> <div id="PMFinal" style="display:none; width:652px; background-color:#005900; border:#666 1px solid; top:51px; position:fixed; margin:auto; z-index:50; padding:40px; color:#FFF; font-size:16px;"></div> <!-- End PM Reply Final Message box showing user message status when needed -->
  10. This system seems to be working except the reply section I am using two users from one to another. It goes okay until I want to reply. The reply will go into the original senders inbox but it is not picking up the id of the replier so it is saying the variable is undefined. In the db it shows the person receiving the email back but not that it came from the person they sent it to. So db shows $to_id $from_id 4 8 8 0 This is the line that is coming up as undefined in the inbox from the reply but not from when it is originally sent. <td width="20%" valign="top"><a href="profiles.php?id=<?php echo $Sid; ?>"><?php echo $Sname; ?></a></td> //working in conjunction with this line $fr_id = $row['from_id']; // SQL - Collect username for sender inside loop $ret = mysql_query("SELECT id, username FROM myMembers WHERE id='$fr_id' LIMIT 1"); while($raw = mysql_fetch_array($ret)){ $Sid = $raw['id']; $Sname = $raw['username']; } this is the script to say they got new mail if (isset($_SESSION['SESS_ID'])) { // Check if this user has any new PMs and construct which envelope to show $sql_pm_check = mysql_query("SELECT id FROM private_messages WHERE to_id='".$_SESSION['SESS_ID']."' AND opened='0' LIMIT 1"); $num_new_pm = mysql_num_rows($sql_pm_check); This is the inbox script <?php include "db connection"; // Mailbox Parsing for deleting inbox messages if (isset($_POST['deleteBtn'])) { foreach ($_POST as $key => $value) { $value = urlencode(stripslashes($value)); if ($key != "deleteBtn") { $sql = mysql_query("UPDATE private_messages SET recipientDelete='1', opened='1' WHERE id='$value' AND to_id='".$_SESSION['SESS_ID']."' LIMIT 1"); // Check to see if sender also removed from sent box, then it is safe to remove completely from system } } header("location: pm_inbox.php"); } ?> <script src="js/jquery-1.4.2.js" type="text/javascript"></script> <script language="javascript" type="text/javascript"> function toggleChecks(field) { if (document.myform.toggleAll.checked == true){ for (i = 0; i < field.length; i++) { field[i].checked = true; } } else { for (i = 0; i < field.length; i++) { field[i].checked = false; } } } $(document).ready(function() { $(".toggle").click(function () { if ($(this).next().is(":hidden")) { $(".hiddenDiv").hide(); $(this).next().slideDown("fast"); } else { $(this).next().hide(); } }); }); function markAsRead(msgID) { $.post("scripts_for_profile/markAsRead.php",{ messageid:msgID, ownerid:<?php echo $_SESSION['SESS_ID']; ?> } ,function(data) { $('#subj_line_'+msgID).addClass('msgRead'); // alert(data); // This line was just for testing returned data from the PHP file, it is not required for marking messages as read }); } function toggleReplyBox(subject,sendername,senderid,recName,recID) { $("#sendernameShow").text(sendername); $("#subjectShow").text(subject); $("#recipientShow").text(recName); document.replyForm.pmSubject.value = subject; document.replyForm.pm_sender_name.value = sendername; //document.replyForm.pmWipit.value = replyWipit; document.replyForm.pm_sender_id.value = senderid; document.replyForm.pm_rec_name.value = recName; document.replyForm.pm_rec_id.value = recID; document.replyForm.replyBtn.value = "Send reply to "+recName; if ($('#replyBox').is(":hidden")) { $('#replyBox').fadeIn(1000); } else { $('#replyBox').hide(); } } function processReply () { var pmSubject = $("#pmSubject"); var pmTextArea = $("#pmTextArea"); var sendername = $("#pm_sender_name"); var senderid = $("#pm_sender_id"); var recName = $("#pm_rec_name"); var recID = $("#pm_rec_id"); //var pm_wipit = $("#pmWipit"); var url = "scripts_for_profile/private_msg_parse.php"; if (pmTextArea.val() == "") { $("#PMStatus").text("Please type in your message.").show().fadeOut(6000); } else { $("#pmFormProcessGif").show(); $.post(url,{ subject: pmSubject.val(), message: pmTextArea.val(), senderName: sendername.val(), senderID: senderid.val(), rcpntName: recName.val(), rcpntID: recID.val() } , function(data) { document.replyForm.pmTextArea.value = ""; $("#pmFormProcessGif").hide(); $('#replyBox').slideUp("fast"); $("#PMFinal").html(" "+data).show().fadeOut(8000); }); } } </script> <style type="text/css"> .hiddenDiv{display:none} #pmFormProcessGif{display:none} .msgDefault {font-weight:bold;} .msgRead {font-weight:100;color:#666;} </style> </head> <body> <?php include_once "headers_template.php"; ?> <p> </p> <table width="920" style="background-color:#F2F2F2;" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td width="732" valign="top"> <h2 style="margin-left:24px;">Your Private Messages</h2> <!-- START THE PM FORM AND DISPLAY LIST --> <form name="myform" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" enctype="multipart/form-data"> <table width="94%" border="0" align="center" cellpadding="4"> <tr> <td width="3%" align="right" valign="bottom"><img src="image_header/crookedArrow.png" width="16" height="17" alt="Develop PHP Private Messages" /></td> <td width="97%" valign="top"><input type="submit" name="deleteBtn" id="deleteBtn" value="Delete" /> <span id="jsbox" style="display:none"></span> </td> </tr> </table> <table width="96%" border="0" align="center" cellpadding="4" style=" background-image:url(style/headerStrip.jpg); background-repeat:repeat-x; border: #999 1px solid;"> <tr> <td width="4%" valign="top"> <input name="toggleAll" id="toggleAll" type="checkbox" onclick="toggleChecks(document.myform.cb)" /> </td> <td width="20%" valign="top">From</td> <td width="58%" valign="top"><span class="style2">Subject</span></td> <td width="18%" valign="top">Date</td> </tr> </table> <?php ///////////End take away/////////////////////// // SQL to gather their entire PM list //$my_id = ""; $sql = mysql_query("SELECT * FROM private_messages WHERE to_id='".$_SESSION['SESS_ID']."' AND recipientDelete='0' ORDER BY id DESC LIMIT 100"); while($row = mysql_fetch_array($sql)){ $date = strftime("%b %d, %Y",strtotime($row['time_sent'])); if($row['opened'] == "0"){ $textWeight = 'msgDefault'; } else { $textWeight = 'msgRead'; } $fr_id = $row['from_id']; // SQL - Collect username for sender inside loop $ret = mysql_query("SELECT id, username FROM myMembers WHERE id='$fr_id' LIMIT 1"); while($raw = mysql_fetch_array($ret)){ $Sid = $raw['id']; $Sname = $raw['username']; } ?> <table width="96%" border="0" align="center" cellpadding="4"> <tr> <td width="4%" valign="top"> <input type="checkbox" name="cb<?php echo $row['id']; ?>" id="cb" value="<?php echo $row['id']; ?>" /> </td> <td width="20%" valign="top"><a href="profiles.php?id=<?php echo $Sid; ?>"><?php echo $Sname; ?></a></td> <td width="58%" valign="top"> <span class="toggle" style="padding:3px;"> <a class="<?php echo $textWeight; ?>" id="subj_line_<?php echo $row['id']; ?>" style="cursor:pointer;" onclick="markAsRead(<?php echo $row['id']; ?>)"><?php echo stripslashes($row['subject']); ?></a> </span> <div class="hiddenDiv"> <br /> <?php echo stripslashes(wordwrap(nl2br($row['message']), 54, "\n", true)); ?> <br /><br /><a href="javascript:toggleReplyBox('<?php echo stripslashes($row['subject']); ?>','<?php echo $my_uname; ?>','<?php echo $my_id; ?>','<?php echo $Sname; ?>','<?php echo $fr_id; ?>')">REPLY</a><br /> </div> </td> <td width="18%" valign="top"><span style="font-size:10px;"><?php echo $date; ?></span></td> </tr> </table> <hr style="margin-left:20px; margin-right:20px;" /> <?php }// Close Main while loop ?> </form> <!-- END THE PM FORM AND DISPLAY LIST --> <!-- Start Hidden Container the holds the Reply Form --> <div id="replyBox" style="display:none; width:680px; height:264px; background-color: #005900; background-repeat:repeat; border: #333 1px solid; top:51px; position:fixed; margin:auto; z-index:50; padding:20px; color:#FFF;"> <div align="right"><a href="javascript:toggleReplyBox('close')"><font color="#00CCFF"><strong>CLOSE</strong></font></a></div> <h2>Replying to <span style="color:#ABE3FE;" id="recipientShow"></span></h2> Subject: <strong><span style="color:#ABE3FE;" id="subjectShow"></span></strong> <br> <form action="javascript:processReply();" name="replyForm" id="replyForm" method="post"> <textarea id="pmTextArea" rows="8" style="width:98%;"></textarea><br /> <input type="hidden" id="pmSubject" /> <input type="hidden" id="pm_rec_id" /> <input type="hidden" id="pm_rec_name" /> <input type="hidden" id="pm_sender_id" /> <input type="hidden" id="pm_sender_name" /> <input type="hidden" id="" /> <br /> <input name="replyBtn" type="button" onclick="javascript:processReply()" /> <span id="pmFormProcessGif"><img src="images/loading.gif" width="28" height="10" alt="Loading" /></span> <div id="PMStatus" style="color:#F00; font-size:14px; font-weight:700;"> </div> </form> </div> <!-- End Hidden Container the holds the Reply Form --> <!-- Start PM Reply Final Message box showing user message status when needed --> <div id="PMFinal" style="display:none; width:652px; background-color:#005900; border:#666 1px solid; top:51px; position:fixed; margin:auto; z-index:50; padding:40px; color:#FFF; font-size:16px;"></div> <!-- End PM Reply Final Message box showing user message status when needed --> </td> this is the sentbox <?php // Mailbox Parsing for deleting inbox messages if (isset($_POST['deleteBtn'])) { foreach ($_POST as $key => $value) { $value = urlencode(stripslashes($value)); if ($key != "deleteBtn") { $sql = mysql_query("UPDATE private_messages SET senderDelete='1' WHERE id='$value' AND from_id='".$_SESSION['SESS_ID']."' LIMIT 1"); // Check to see if sender also removed from sent box, then it is safe to remove completely from system } } header("location: pm_sentbox.php"); } ?> <script src="js/jquery-1.4.2.js" type="text/javascript"></script> <script language="javascript" type="text/javascript"> function toggleChecks(field) { if (document.myform.toggleAll.checked == true){ for (i = 0; i < field.length; i++) { field[i].checked = true; } } else { for (i = 0; i < field.length; i++) { field[i].checked = false; } } } $(document).ready(function() { $(".toggle").click(function () { if ($(this).next().is(":hidden")) { $(".hiddenDiv").hide(); $(this).next().slideDown("fast"); } else { $(this).next().hide(); } }); }); </script> <style type="text/css"> .hiddenDiv{display:none} #pmFormProcessGif{display:none} .msgDefault {font-weight:bold;} .msgRead {font-weight:100;color:#666;} </style> </head> <body> <?php include_once "headers_template.php"; ?> <p> </p> <table width="920" style="background-color:#F2F2F2;" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td width="732" valign="top"> <h2 style="margin-left:24px;">Messages You Sent</h2> <!-- START THE PM FORM AND DISPLAY LIST --> <form name="myform" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" enctype="multipart/form-data"> <table width="94%" border="0" align="center" cellpadding="4"> <tr> <td width="3%" align="right" valign="bottom"><img src="image_header/crookedArrow.png" width="16" height="17" alt="Develop PHP Private Messages" /></td> <td width="97%" valign="top"><input type="submit" name="deleteBtn" id="deleteBtn" value="Delete" /> <span id="jsbox" style="display:none"></span> </td> </tr> </table> <table width="96%" border="0" align="center" cellpadding="4" style=" background-image:url(style/headerStrip.jpg); background-repeat:repeat-x; border: #999 1px solid;"> <tr> <td width="4%" valign="top"> <input name="toggleAll" id="toggleAll" type="checkbox" onclick="toggleChecks(document.myform.cb)" /> </td> <td width="20%" valign="top">To</td> <td width="58%" valign="top"><span class="style2">Subject</span></td> <td width="18%" valign="top">Date</td> </tr> </table> <?php ///////////End take away/////////////////////// // SQL to gather their entire PM list $sql = mysql_query("SELECT * FROM private_messages WHERE from_id='".$_SESSION['SESS_ID']."' AND senderDelete='0' ORDER BY id DESC LIMIT 100"); while($row = mysql_fetch_array($sql)){ $date = strftime("%b %d, %Y",strtotime($row['time_sent'])); $to_id = $row['to_id']; // SQL - Collect username for Recipient $ret = mysql_query("SELECT id, username FROM myMembers WHERE id='$to_id' LIMIT 1"); while($raw = mysql_fetch_array($ret)){ $Rid = $raw['id']; $Rname = $raw['username']; } ?> <table width="96%" border="0" align="center" cellpadding="4"> <tr> <td width="4%" valign="top"> <input type="checkbox" name="cb<?php echo $row['id']; ?>" id="cb" value="<?php echo $row['id']; ?>" /> </td> <td width="20%" valign="top"><a href="profiles.php?id=<?php echo $Rid; ?>"><?php echo $Rname; ?></a></td> <td width="58%" valign="top"> <span class="toggle" style="padding:3px;"> <a class="msgDefault" id="subj_line_<?php echo $row['id']; ?>" style="cursor:pointer;"><?php echo stripslashes($row['subject']); ?></a> </span> <div class="hiddenDiv"> <br /> <?php echo stripslashes(wordwrap(nl2br($row['message']), 54, "\n", true)); ?> <br /> </div> </td> <td width="18%" valign="top"><span style="font-size:10px;"><?php echo $date; ?></span></td> </tr> </table> <hr style="margin-left:20px; margin-right:20px;" /> <?php }// Close Main while loop ?> </form>
  11. I am trying to find the code if I get an error message but the page can still work with the error message what code would I need to block that error message from showing. I have already used the page so I know it works okay but the message is not a good look and I know it will cause panic. It is the parse_var that is showing up. but it is only to show all the items that will upload if($_POST['parse_var'] == "pic"){
  12. I got it. I had not set $_SESSION['username'] on the form that sends out the information which was on another file as this file was the parse file. Thanks for all your help. I appreciate it.
  13. Okay finally I got it I went to the page that you have to submit the form to post to the forum and what was of course missing with the section for username which is why username was not there. It is like the smallest things make it all come together. Thanks everyone for looking out I did learn more things about PHP which is good when you have situations so you can help the next one out.
  14. This is my header location how can I put it so it goes to this section to be viewed by anyone. It is showing up because the username is not recognized. ????? header("location: view_thread.php?id=$this_id");
  15. I added to the top of the page !isset($_SESSION['username']) . This i added to the top of the pages in the forum that need to be part of the session start. so I see it is both pages however the first page is where a user must post their info this page without the var_dump is showing the username where it should but with this new info I put in there it is givng the error message. if (!isset($_SESSION['SESS_ID']) || (trim($_SESSION['SESS_ID']) == '') || !isset($_SESSION['username'])) { header("location: access-denied.php"); exit(); } this is the message I got on the new page. array(3) { ["SESS_ID"]=> string(1) "2" ["SESS_FIRST_NAME"]=> string(7) "Ronette" ["SESS_LAST_NAME"]=> string(6) "Lounds" } Warning: Cannot modify header information - headers already sent by
  16. I put the var_dump $_SESSION on pages only shows up on the script I have submitted. I do have the main files under the html file but this one is a forum and I wanted people to view it that are not members like a forum is set up so it is under its own file forum when it goes to the server. I am not sure why it is losing the username session.????
  17. I am unsure what you are talking about do you mean check $_SESSION['username'] on all files from the beginning of registration and see where it is not responding.
  18. I am now getting this message and it is not even showing the $_SESSION username.????? array(3) { ["SESS_ID"]=> string(1) "2" ["SESS_FIRST_NAME"]=> string(7) "Michael" ["SESS_LAST_NAME"]=> string(6) "Cooke" } Notice: Undefined index: username
  19. Here is my code I called my server company and had them add session_save_path I am not sure if that is the problem but it must be something easy. this is the parse.php file which willl run when the member has filled out the section in the forum they wish to post. php error_reporting(E_ALL); ini_set("display_errors", 1); session_start(); var_dump($_SESSION); // Connect to the database include_once "../Connection/mysql.php"; if (!isset($_SESSION['SESS_ID']) || (trim($_SESSION['SESS_ID']) == '') || !isset($_SESSION['username'])) { '<a href="index.php">Register Account</a> | <a href="login-form.php">Log In</a>'; } if (isset($_GET['id'])) { $id = $_GET['id']; // filter everything but numbers } else if (isset($_SESSION['SESS_ID'])) { $id = $_SESSION['SESS_ID']; } else { '<a href="login-form.php">Log In</a>'; } $sql = mysql_query("SELECT * FROM myMembers WHERE id='".$_SESSION['SESS_ID']."'"); $numRows = mysql_num_rows($sql); if ($numRows < 1) { echo "ERROR: You do not exist in the system"; exit(); } // Be sure all form variables are present to proceed if (!isset($_POST['post_type']) || !isset($_POST['post_body']) || !isset($_POST['fsID']) || !isset($_POST['fsTitle']) || !isset($_POST['uid']) || !isset($_POST['upass'])) { echo "Important variables from the form are missing."; exit(); } // Filter all of the common variables $post_type = $_POST['post_type']; $post_body = $_POST['post_body']; $post_body = nl2br(htmlspecialchars($post_body)); $post_body = mysql_real_escape_string($post_body); $forum_section_id = preg_replace('#[^0-9]#i', '', $_POST['fsID']); $forum_section_title = preg_replace('#[^A-Za-z 0-9]#i', '', $_POST['fsTitle']); $member_id = preg_replace('#[^0-9]#i', '', $_POST['uid']); $username = preg_replace('#[^0-9]#i', '', $_SESSION['username']); $member_password = mysql_real_escape_string($_POST['upass']); // Check the database to be sure that this forum section exists $sql = mysql_query("SELECT * FROM forum_sections WHERE id='$forum_section_id' AND title='$forum_section_title'"); $numRows = mysql_num_rows($sql); if ($numRows < 1) { echo "ERROR: That forum section does not exist."; exit(); } // Prevent this member from posting more than 30 times in one day $sql = mysql_query("SELECT id FROM forum_posts WHERE post_author_id='$member_id' AND DATE(date_time) = DATE(NOW()) LIMIT 32"); $numRows = mysql_num_rows($sql); if ($numRows > 30) { echo "ERROR: You can post only 30 times per day. Your maximum has been reached."; exit(); } // Add this post to the database now. The query depends on the "post_type" value // Only if the post_type is "a" ////////////////////// if ($post_type == "a") { $post_title = preg_replace('#[^A-za-z0-9 ?!.,]#i', '', $_POST['post_title']); if ($post_title == "") { echo "The Topic Title is missing."; exit(); } if (strlen($post_title) < 10) { echo "Your Topic Title is less than 10 characters."; exit(); } $sql = mysql_query("INSERT INTO forum_posts (username, post_author_id, date_time, type, section_title, section_id, thread_title, post_body) VALUES('".$username."','".$member_id."',now(),'a','".$forum_section_title."','".$forum_section_id."','".$post_title."','".$post_body."')") or die (mysql_error()); $this_id = mysql_insert_id(); //$sql = mysql_query("UPDATE forum_posts SET otid='$this_id' WHERE id='$this_id'"); header("location: view_thread.php?id=$this_id"); exit(); }
  20. I found out the string is empty but I am not sure how to fix it as the username is in the table with a value. I have two tables one is the main one members and the other I am trying to add to. I did a var_dump for the $_SESSION and all but of course the username was present. The username shows empty string.
  21. I just re-entered the isset to this and it exited the page in testing. if (!isset($_SESSION['SESS_ID']) || (trim($_SESSION['SESS_ID']) == '') || !isset($_SESSION['username'])) { '<a href="http://index.php">Register Account</a> | <a href="login-form.php">Log In</a>'; exit(); }
  22. All that is set according to what you mentioned that is how I know that it is not getting the variable at first I was not sure why but it pointed to that line in the script. The error reporting
  23. Yes I have tried the print_r and it produced nothing I had the !isset($_SESSION[username]) the isset($_SESSION[username]) nothing is grabbing that username. the table is blank all the other fields are being posted but that one.
  24. More clearly I am trying to use that line which is not grabbing the username I actually have it now as $_SESSION[username]
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.