Jump to content

searls03

Members
  • Posts

    907
  • Joined

  • Last visited

Everything posted by searls03

  1. woops, I guess it wasnt really a comment since it wasn't in php code. but it is near the bottom of the code. you can see all the slashes if you look a couple lines up from bottom.
  2. ok, so I have this code to start with: <?php session_start(); // Must start session first thing /* Created By Adam Khoury @ www.flashbuilding.com -----------------------June 20, 2008----------------------- */ // Here we run a login check if (!isset($_SESSION['username'])) { echo 'Please <a href="/login.php">log in</a> to access your account'; exit(); } //Connect to the database through our include include_once "connect_to_mysql_1.php"; // Place Session variable 'id' into local variable $username1 = $_SESSION['username']; ?> <?php // Query member data from the database and ready it for display $sql = mysql_query("SELECT hometown, about, month, day, year, id FROM general WHERE user='$username1'"); while($row = mysql_fetch_array($sql)){ $userid = $row["userid"]; $hometown = $row["hometown"]; $about = $row["about"]; $month = $row["month"]; $day = $row["day"]; $year = $row["year"]; $userid1 = $row["id"]; } $sql = mysql_query("SELECT * from sessions WHERE username='$username1'"); while($row = mysql_fetch_array($sql)){ $name1 = $row["name"]; } ?> <?php if($month == "January"){ $month2 =="1";}else if($month =="February"){$month2 =="2";}else if($month =="March"){$month2 =="3";}else if($month =="April"){$month2 =="4";}else if($month =="May"){$month2 =="5";}else if($month =="June"){$month2 =="6";}else if($month =="July"){$month2 =="7";}else if($month =="August"){$month2 =="8";}else if($month =="September"){$month2 =="9";}else if($month =="October"){$month2 =="10";}else if($month =="November"){$month2 =="11";}else if($month =="December"){$month2 =="12";} ?> <?php // Query member data from the database and ready it for display $sql = mysql_query("SELECT * from pics WHERE user='$username1'"); while($row = mysql_fetch_array($sql)){ $link123 = $row["link"]; } ?> <?php if(isset($_SESSION['username'])) { $query = "SELECT sport FROM sports where user ='$username1'"; $result = mysql_query($query) or die('Error : ' . mysql_error()); // create the article list while($row = mysql_fetch_array($result, MYSQL_NUM)) { list($sport) = $row; $cs .= "$sport<br> "; }} ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Untitled Document</title> <script src="SpryAssets/SpryTabbedPanels.js" type="text/javascript"></script> <script language="javascript" type='text/javascript'> function hideDiv() { if (document.getElementById) { // DOM3 = IE5, NS6 document.getElementById('hideShow').style.visibility = 'hidden'; } else { if (document.layers) { // Netscape 4 document.hideShow.visibility = 'hidden'; } else { // IE 4 document.all.hideShow.style.visibility = 'hidden'; } } } function showDiv() { if (document.getElementById) { // DOM3 = IE5, NS6 document.getElementById('hideShow').style.visibility = 'visible'; } else { if (document.layers) { // Netscape 4 document.hideShow.visibility = 'visible'; } else { // IE 4 document.all.hideShow.style.visibility = 'visible'; } } } </script> <script language="javascript" type='text/javascript'> function hideDiv1() { if (document.getElementById) { // DOM3 = IE5, NS6 document.getElementById('apDiv4').style.visibility = 'hidden'; } else { if (document.layers) { // Netscape 4 document.apDiv4.visibility = 'hidden'; } else { // IE 4 document.all.apDiv4.style.visibility = 'hidden'; } } } function showDiv1() { if (document.getElementById) { // DOM3 = IE5, NS6 document.getElementById('apDiv4').style.visibility = 'visible'; } else { if (document.layers) { // Netscape 4 document.apDiv4.visibility = 'visible'; } else { // IE 4 document.all.apDiv4.style.visibility = 'visible'; } } } </script> <style type="text/css"> #apDiv1 { position:absolute; left:0px; top:0px; width:100%; height:50px; z-index:1; background-color: #000; padding: 0px; text-align: left; } #menu { position:absolute; top:15px; width:411px; height:34px; z-index:41; right: 0px; } </style> <link rel="stylesheet" href="css/structure.css" type="text/css" /> <link rel="stylesheet" href="css/form.css" type="text/css" /> <!-- JavaScript --> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/ libs/jquery/1.3.0/jquery.min.js"></script> <script type="text/javascript"> $(function() { $(".submit").click(function() { var name = $("#name").val(); var dataString = 'name='+ name; if(name=='') { $('.success').fadeOut(200).hide(); $('.error').fadeOut(200).show(); } else { $.ajax({ type: "POST", url: "join.php", data: dataString, success: function(){ $('.success').fadeIn(200).show(); $('.error').fadeOut(200).hide(); $(document).ready(function(){ $('#submit').click(function(){ var a = $("#name").val(); if(a != "") { $.post("join.php",{ }, function(response){ $('#posting').prepend($(response).fadeIn('slow')); $("#name").val("what's on your mind?"); }); } }); }); } }); } return false; }); }); </script> <style type="text/css"> .error{ color:#d12f19; font-size:12px; } .success{ color:#006600; font-size:12px; } </style> <link href="Spry-UI-1.7/css/Menu/basic/SpryMenuBasic.css" rel="stylesheet" type="text/css" /> <script src="Spry-UI-1.7/includes/SpryDOMUtils.js" type="text/javascript"></script> <script src="Spry-UI-1.7/includes/SpryDOMEffects.js" type="text/javascript"></script> <script src="Spry-UI-1.7/includes/SpryWidget.js" type="text/javascript"></script> <script src="Spry-UI-1.7/includes/SpryMenu.js" type="text/javascript"></script> <script src="Spry-UI-1.7/includes/plugins/MenuBar2/SpryMenuBarKeyNavigationPlugin.js" type="text/javascript"></script> <script src="Spry-UI-1.7/includes/plugins/MenuBar2/SpryMenuBarIEWorkaroundsPlugin.js" type="text/javascript"></script> <style type="text/css"> /* BeginOAWidget_Instance_2141544: #MenuBar */ /* Settable values for skinning a Basic menu via presets. If presets are not sufficient, most skinning should be done in these rules, with the exception of the images used for down or right pointing arrows, which are in the file SpryMenuBasic.css These assume the following widget classes for menu layout (set in a preset) .MenuBar - Applies to all menubars - default is horizontal bar, all submenus are vertical - 2nd level subs and beyond are pull-right. .MenuBarVertical - vertical main bar; all submenus are pull-right. You can also pass in extra classnames to set your desired top level menu bar layout. Normally, these are set by using a preset. They only apply to horizontal menu bars: MenuBarLeftShrink - The menu bar will be horizontally 'shrinkwrapped' to be just large enough to hold its items, and left aligned MenuBarRightShrink - Just like MenuBarLeftShrink, but right aligned MenuBarFixedLeft - Fixed at a specified width set in the rule '.MenuBarFixedLeft', and left aligned. MenuBarFixedCentered - - Fixed at a specified width set in the rule '.MenuBarFixedCentered', and centered in its parent container. MenuBarFullwidth - Grows to fill its parent container width. In general, all rules specified in this file are prefixed by #MenuBar so they only apply to instances of the widget inserted along with the rules. This permits use of multiple MenuBarBasic widgets on the same page with different layouts. Because of IE6 limitations, there are a few rules where this was not possible. Those rules are so noted in comments. */ #MenuBar { background-color:#000000; font-family: Arial, Helvetica, sans-serif; /* Specify fonts on on MenuBar and subMenu MenuItemContainer, so MenuItemContainer, MenuItem, and MenuItemLabel at a given level all use same definition for ems. Note that this means the size is also inherited to child submenus, so use caution in using relative sizes other than 100% on submenu fonts. */ font-weight: normal; font-size: 16px; font-style: normal; padding:0; border-color: #000000 #000000 #000000 #000000; border-width:0px; border-style: none none none none; } /* Caution: because ID+class selectors do not work properly in IE6, but we want to restrict these rules to just this widget instance, we have used string-concatenated classnames for our selectors for the layout type of the menubar in this section. These have very low specificity, so be careful not to accidentally override them. */ .MenuBar br { /* using just a class so it has same specificity as the ".MenuBarFixedCentered br" rule bleow */ display:none; } .MenuBarLeftShrink { float: left; /* shrink to content, as well as float the MenuBar */ width: auto; } .MenuBarRightShrink { float: right; /* shrink to content, as well as float the MenuBar */ width: auto; } .MenuBarFixedLeft { float: left; width: 80em; } .MenuBarFixedCentered { float: none; width: 80em; margin-left:auto; margin-right:auto; } .MenuBarFixedCentered br { clear:both; display:block; } .MenuBarFixedCentered .SubMenu br { display:none; } .MenuBarFullwidth { float: left; width: 100%; } /* Top level menubar items - these actually apply to all items, and get overridden for 1st or successive level submenus */ #MenuBar .MenuItemContainer { padding: 0px 0px 0px 0px; margin: 0; /* Zero out margin on the item containers. The MenuItem is the active hover area. For most items, we have to do top or bottom padding or borders only on the MenuItem or a child so we keep the entire submenu tiled with items. Setting this to 0 avoids "dead spots" for hovering. */ } #MenuBar .MenuItem { padding: 0px 24px 0px 0px; background-color:#000000; border-width:0px; border-color: #cccccc #ffffff #cccccc #ffffff; border-style: none solid none solid; } #MenuBar .MenuItemFirst { border-style: none none none none; } #MenuBar .MenuItemLast { border-style: none solid none none; } #MenuBar .MenuItem .MenuItemLabel{ text-align:center; line-height:1.4em; color:#ffffff; background-color:#000000; padding: 6px 15px 6px 39px; width: 10em; width:auto; } .SpryIsIE6 #MenuBar .MenuItem .MenuItemLabel{ width:1em; /* Equivalent to min-width in modern browsers */ } /* First level submenu items */ #MenuBar .SubMenu .MenuItem { font-family: Arial, Helvetica, sans-serif; font-weight: normal; font-size: 14px; font-style: normal; background-color:#ffffff; padding:0px 2px 0px 0px; border-width:0px; border-color: #cccccc #cccccc #cccccc #cccccc; /* Border styles are overriden by first and last items */ border-style: solid solid none solid; } #MenuBar .SubMenu .MenuItemFirst { border-style: solid solid none solid; } #MenuBar .SubMenu .MenuItemFirst .MenuItemLabel{ padding-top: 6px; } #MenuBar .SubMenu .MenuItemLast { border-style: solid solid solid solid; } #MenuBar .SubMenu .MenuItemLast .MenuItemLabel{ padding-bottom: 6px; } #MenuBar .SubMenu .MenuItem .MenuItemLabel{ text-align:left; line-height:1em; background-color:#ffffff; color:#333333; padding: 6px 12px 6px 5px; width: 7em; } /* Hover states for containers, items and labels */ #MenuBar .MenuItemHover { background-color: #666666; border-color: #cccccc #cccccc #cccccc #cccccc; } #MenuBar .MenuItemWithSubMenu.MenuItemHover .MenuItemLabel{ background-color: #666666; /* consider exposing this prop separately*/ color: #ffffff; } #MenuBar .MenuItemHover .MenuItemLabel{ background-color: #666666; color: #ffffff; } #MenuBar .SubMenu .MenuItemHover { background-color: #666666; border-color: #666666 #cccccc #cccccc #cccccc; } #MenuBar .SubMenu .MenuItemHover .MenuItemLabel{ background-color: #666666; color: #ffffff; } /* Submenu properties -- First level of submenus */ #MenuBar .SubMenuVisible { background-color: #ffffff; min-width:0%; /* This keeps the menu from being skinnier than the parent MenuItemContainer - nice to have but not available on ie6 */ border-color: #ffffff #ffffff #ffffff #ffffff; border-width:0px; border-style: none none none none; } #MenuBar.MenuBar .SubMenuVisible {/* For Horizontal menubar only */ top: 100%; /* 100% is at the bottom of parent menuItemContainer */ left:0px; /* 'left' may need tuning depending upon borders or padding applied to menubar MenuItemContainer or MenuItem, and your personal taste. 0px will left align the dropdown with the content area of the MenuItemContainer. Assuming you keep the margins 0 on MenuItemContainer and MenuItem on the parent menubar, making this equal the sum of the MenuItemContainer & MenuItem padding-left will align the dropdown with the left of the menu item label.*/ z-index:10; } #MenuBar.MenuBarVertical .SubMenuVisible { top: 0px; left:100%; min-width:0px; /* Do not neeed to match width to parent MenuItemContainer - items will prevent total collapse */ } /* Submenu properties -- Second level submenu and beyond - these are visible descendents of .MenuLevel1 */ #MenuBar .MenuLevel1 .SubMenuVisible { background-color: #ffffff; min-width:0px; /* Do not neeed to match width to parent MenuItemContainer - items will prevent total collapse*/ top: 0px; /* If desired, you can move this down a smidge to separate top item''s submenu from menubar - that is really only needed for submenu on first item of MenuLevel1, or you can make it negative to make submenu more vertically 'centered' on its invoking item */ left:100%; /* If you want to shift the submenu left to partially cover its invoking item, you can add a margin-left with a negative value to this rule. Alternatively, if you use fixed-width items, you can change this left value to use px or ems to get the offset you want. */ } /* IE6 rules - you can delete these if you do not want to support IE6 */ /* A note about multiple classes in IE6. * Some of the rules above use multiple class names on an element for selection, such as "hover" (MenuItemHover) and "has a subMenu" (MenuItemWithSubMenu), * giving the selector '.MenuItemWithSubMenu.MenuItemHover'. * Unfortunately IE6 does not support using mutiple classnames in a selector for an element. For a selector such as '.foo.bar.baz', IE6 ignores * all but the final classname (here, '.baz'), and sets the specificity accordingly, counting just one of those classs as significant. To get around this * problem, we use the plugin in SpryMenuBarIEWorkaroundsPlugin.js to generate compound classnames for IE6, such as 'MenuItemWithSubMenuHover'. * Since there are a lot of these needed, the plugin does not generate the extra classes for modern browsers, and we use the CSS2 style mutltiple class * syntax for that. Since IE6 both applies rules where * it should not, and gets the specificity wrong too, we have to order rules carefully, so the rule misapplied in IE6 can be overridden. * So, we put the multiple class rule first. IE6 will mistakenly apply this rule. We follow this with the single-class rule that it would * mistakenly override, making sure the misinterpreted IE6 specificity is the same as the single-class selector, so the latter wins. * We then create a copy of the multiple class rule, adding a '.SpryIsIE6' class as context, and making sure the specificity for * the selector is high enough to beat the single-class rule in the "both classes match" case. We place the IE6 rule at the end of the * css style block to make it easy to delete if you want to drop IE6 support. * If you decide you do not need IE6 support, you can get rid of these, as well as the inclusion of the SpryMenuBarIEWorkaroundsPlugin.js script. * The 'SpryIsIE6' class is placed on the HTML element by the script in SpryMenuBarIEWorkaroundsPlugin.js if the browser is Internet Explorer 6. This avoids the necessity of IE conditional comments for these rules. */ .SpryIsIE6 #MenuBar .MenuBarView .MenuItemWithSubMenuHover .MenuItemLabel /* IE6 selector */{ background-color: #666666; /* consider exposing this prop separately*/ color: #ffffff; } .SpryIsIE6 #MenuBar .MenuBarView .SubMenu .MenuItemWithSubMenuHover .MenuItemLabel/* IE6 selector */{ background-color: #666666; /* consider exposing this prop separately*/ color: #ffffff; } .SpryIsIE6 #MenuBar .SubMenu .SubMenu /* IE6 selector */{ margin-left: -0px; /* Compensates for at least part of an IE6 "double padding" version of the "double margin" bug */ } /* EndOAWidget_Instance_2141544 */ #apDiv2 { position:absolute; left:5px; top:75px; width:591px; height:284px; z-index:2; } #hideShow { position:absolute; left:84px; top:211px; width:506px; height:47px; z-index:2; } #apDiv3 { position:absolute; left:4px; top:354px; width:306px; height:45px; z-index:3; } #apDiv4 { position:absolute; left:82px; top:275px; width:290px; height:34px; z-index:4; } #apDiv5 { position:absolute; left:17px; top:205px; width:861px; height:172px; z-index:2; } .fullname { position:relative; left:0px; width:100px; height:30px; z-index:4; top:25px; background-color:black; color:white; text-align: center; } #apDiv5 #TabbedPanels1 .TabbedPanelsContentGroup .TabbedPanelsContent.TabbedPanelsContentVisible #form1 table tr td { text-align: right; } </style> <script type="text/xml"> <!-- <oa:widgets> <oa:widget wid="2141544" binding="#MenuBar" /> </oa:widgets> --> </script> <link href="SpryAssets/SpryTabbedPanels.css" rel="stylesheet" type="text/css" /> <style type="text/css"> #apDiv6 { position:absolute; left:4px; top:54px; width:162px; height:147px; z-index:3; } </style> </head> <body onLoad="javascript:TabbedPanels1.showPanel(<?php echo $_COOKIE['index'];?>)"> <?php $birthday1 = "$year-$month2-$day"; ?> <div id="apDiv1"> <div id="menu"> <ul id="MenuBar" class="MenuBarHorizontal"> <li><a href="index.php">Home</a> </li> <li><a href="profile.php">Profile</a></li> <li><a class="MenuBarItemSubmenu" href="#">Account</a> <ul> <li><a href="settings.php">Account Settings</a> </li> <li><a href="privacy.php">Privacy Settings</a></li> <li><a href="logout.php">Logout</a></li> </ul> </li> </ul> <script type="text/javascript"> // BeginOAWidget_Instance_2141544: #MenuBar var MenuBar = new Spry.Widget.MenuBar2("#MenuBar", { widgetID: "MenuBar", widgetClass: "MenuBar MenuBarRightShrink", insertMenuBarBreak: true, mainMenuShowDelay: 100, mainMenuHideDelay: 200, subMenuShowDelay: 200, subMenuHideDelay: 200 }); // EndOAWidget_Instance_2141544 </script> </div> <a href="/main.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image1','','/hover.png',1)"><img src="/main.png" name="Image1" width="600" height="50" border="0" id="Image1" /></a> </div> <?php // Process the form if it is submitted if ($_POST['general']) { $city1 = $_POST['city']; $hometown1 = $_POST['hometown']; $about1 = $_POST['about']; $sql = mysql_query("UPDATE general SET city='$city1', hometown='$hometown1', about='$about1' WHERE id='$userid1'")or die(mysql_error()); $message ='Your Account info has been saved'; echo "<font color = 'red'>"; echo $message; echo "</font>"; } // close if post ?> <div id="apDiv5"> <div id="TabbedPanels1" class="VTabbedPanels"> <ul class="TabbedPanelsTabGroup"> <li class="TabbedPanelsTab" tabindex="0">Basic Info</li> <li class="TabbedPanelsTab" tabindex="0">Profile Picture</li> <li class="TabbedPanelsTab" tabindex="0">Sports</li> <li class="TabbedPanelsTab" tabindex="0">Activities</li> <li class="TabbedPanelsTab" tabindex="0">Contact Info</li> </ul> <div class="TabbedPanelsContentGroup"> <div class="TabbedPanelsContent"><form id="form1" name="form1" method="post" action=""> <label for="city"></label> <table width="496" border="0" cellspacing="2" cellpadding="0"> <tr> <td width="157" scope="col">Current City:</td> <td width="333" scope="col"><div align="left"> <input type="text" name="city" id="city" value="<?php echo $city; ?>" /> </div></td> </tr> <tr> <td>Hometown:</td> <td><div align="left"> <label for="hometown"></label> <input type="text" name="hometown" id="hometown" value="<?php echo $hometown; ?>" /> </div></td> </tr> <tr> <td>Birthday:</td> <td><div align="left"><?php echo $month;?> <?php echo $day; ?>, <?php echo $year; ?></div></td><tr><td></td><td> <div align="left"><?php //calculate years of age (input string: YYYY-MM-DD) function birthday ($birthday){ list($year,$month,$day) = explode("-",$birthday); $year_diff = date("Y") - $year; $month_diff = date("m") - $month; $day_diff = date("d") - $day; if ($day_diff < 0 || $month_diff < 0) $year_diff--; return $year_diff; } echo birthday($birthday1). " years old"; ?></div></td></tr></td> </tr> <tr> <td>About Me: </td> <td><label for="about"></label> <textarea name="about" id="about" cols="45" rows="5"></textarea></td> </tr> <tr> <td> </td> <td><div align="left"><input name="general" id="general" type="submit" value="Save information" class="fullname" /></div></td> </tr> <tr> <td> </td> <td> </td> </tr> </table> </form></div> <div class="TabbedPanelsContent"><form enctype="multipart/form-data" action="profile.php" method="POST"> <input type="hidden" name="MAX_FILE_SIZE" value="900000000000000000000000000000000000000000000000000000000000000000000000000" /> Choose a file to upload: <div id="dynamicInput"> <p>Entry 1</p> <p> <br> <input type="file" name="uploadedfile[]"> </p> </div> <input type="submit" value="Upload File" id="submit" name="submit" /> </form> <?php if($_POST['submit']){ // Where the file is going to be placed $target_path = 'images/'.$username1.'/'; foreach ($_FILES["uploadedfile"]["name"] as $key => $value) { $uploadfile = $target_path . basename($_FILES["uploadedfile"]["name"][$key]); $uploadfile1 = basename($_FILES["uploadedfile"]["name"][$key]); //echo $uploadfile; if (move_uploaded_file($_FILES['uploadedfile']['tmp_name'][$key], $uploadfile)) { $sql = mysql_query("UPDATE pics SET link='$uploadfile', name='$uploadfile1' WHERE user='$username1'")or die(mysql_error()); $sql = mysql_query("UPDATE facebook_posts SET pic='$uploadfile' WHERE f_name='$name1'")or die(mysql_error()); $sql = mysql_query("UPDATE facebook_posts_comments SET pic='$uploadfile' WHERE f_name='$name1'")or die(mysql_error()); echo $value . ' uploaded<br>'; } } } ?> </div> <div class="TabbedPanelsContent"><form autocomplete="off" enctype="multipart/form-data" method="post" name="form"> <div class="info" style="padding-left:20px"> <h2> </h2> <div></div> <div> <p>Sport: <input id="name" name="name" type="text" class="field text medium" value="" maxlength="255" tabindex="1" /> </p> <p></p> </div> <div></div> </div> <div class="buttons"> <input type="submit" value="Submit" style=" background:#0060a1; color:#FFFFFF; font-size:14px; border:1px solid #0060a1; margin-left:12px" class="submit" name="submit" id="submit"/><span class="error" style="display:none"> Please Enter Valid Data</span><?php if($_POST['submit']){ ?><span class="success" style="display:none"> ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// <?php $sql123 = mysql_query("SELECT id, sport, user FROM sports WHERE user='$username1'"); while($row = mysql_fetch_array($sql123)){ $id = $row["id"]; $sport1 .= $row["sport"]; $user = $row["user"];} echo $sport1; ;} ?></span> </div> </form></div> <div class="TabbedPanelsContent">Content 4</div> <div class="TabbedPanelsContent">Content 5 </div> </div> </div> </div> <div id="posting" align="center"> <?php include_once "posting.php"; ?> </div> <div id="apDiv6"><?php echo '<img src="'.$link123.'" width="162""/>'; ?></div> <script type="text/javascript"> var TabbedPanels1 = new Spry.Widget.TabbedPanels("TabbedPanels1"); </script> </body> </html> My goal is to make it so that where the really long comment(well with no words), is at that it runs after the ajax at the begining of the script so that the database input it does shows up in that result. here is the code of join.php <?php session_start(); // Must start session first thing /* Created By Adam Khoury @ www.flashbuilding.com -----------------------June 20, 2008----------------------- */ // Here we run a login check if (!isset($_SESSION['username'])) { echo 'Please <a href="/login.php">log in</a> to access your account'; exit(); } //Connect to the database through our include include_once "connect_to_mysql_1.php"; // Place Session variable 'id' into local variable $username1 = $_SESSION['username']; ?> <?php // Query member data from the database and ready it for display $sql = mysql_query("SELECT hometown, about, month, day, year, id FROM general WHERE user='$username1'"); while($row = mysql_fetch_array($sql)){ $userid = $row["userid"]; $hometown = $row["hometown"]; $about = $row["about"]; $month = $row["month"]; $day = $row["day"]; $year = $row["year"]; $userid1 = $row["id"]; } $sql = mysql_query("SELECT id, sport, user FROM sports WHERE user='$username1'"); while($row = mysql_fetch_array($sql)){ $id = $row["id"]; $sport1 = $row["sport"]; $user = $row["user"]; } if($_POST) { $sport=$_POST['name']; mysql_query("INSERT INTO sports (id, sport, user) VALUES ('$userid1', '$sport', '$username1')"); }else { } ?> <html> <head> </head> <body> <?php echo $sport1; ?> </body> </html> I hope this makes sense. so once again, I need the results that the code by the long comment(sorta) will basically run after the ajax uses join.php to input info into the dbase. or is there a better way to do this? currently the results are loading even before the page loads. so that it returns the results when it is supposed to, it just didn't query the database at the right time.
  3. so does anyone know how to make my error message display in the place I would like it to on the page since the code cant go in the middle of the page?
  4. there is no vale when I echo it. do you think it is supposed to be date_created or what? I think that is now the problem as to why it doesn't work. I will include my new code so someone could also tell me if I wrote the function right(this is after I took echo $timestamp out). I am pretty sure I wrote it correctly. <?php session_start(); include('dbcon.php'); $username1 = $_SESSION['username']; $name1 = $_SESSION['name']; // set time of last activity $userTime = time(); mysql_query("update `sessions` set `activity` = '$userTime' where username='$username1'"); $inactivityTime = time() - 120; // 2 minutes mysql_query("update `sessions` set `loggedin` = '0' where `activity` < '$inactivityTime' "); $username = $rows['f_name']; $sql = mysql_query("SELECT * from pics WHERE user='$username1'"); while($row = mysql_fetch_array($sql)){ $link123 = $row["link"]; } function timeSince($timestamp) { $minute = 60; $hour = $minute * 60; $day = $hour * 24; $secondsSince = time() - $timestamp; if($secondsSince >= $day) { $daysSince = floor($secondsSince/$day); $s = ($daysSince>1) ? 's' : ''; //return date('F d Y', $row['date_created']) return "{$daysSince} day{$s} ago."; } if($secondsSince >= $hour) { $hoursSince = floor($secondsSince/$hour); $s = ($hoursSince>1) ? 's' : ''; return "{$hoursSince} hour{$s} ago."; } if($secondsSince >= $minute) { $minutesSince = floor($secondsSince/$minute); $s = ($minutesSince>1) ? 's' : ''; return "{$minutesSince} minute{$s} ago."; } $s = ($secondsSince>1) ? 's' : ''; return "{$secondsSince} second{$s} ago."; } function checkValues($value) { $value = trim($value); if (get_magic_quotes_gpc()) { $value = stripslashes($value); } $value = strtr($value,array_flip(get_html_translation_table(HTML_ENTITIES))); $value = strip_tags($value); $value = mysql_real_escape_string($value); $value = htmlspecialchars ($value); return $value; } function clickable_link($text = '') { $text = preg_replace('#(script|about|applet|activex|chrome):#is', "\\1:", $text); $ret = ' ' . $text; $ret = preg_replace("#(^|[\n ])([\w]+?://[\w\#$%&~/.\-;:=,?@\[\]+]*)#is", "\\1<a href=\"\\2\" target=\"_blank\">\\2</a>", $ret); $ret = preg_replace("#(^|[\n ])((www|ftp)\.[\w\#$%&~/.\-;:=,?@\[\]+]*)#is", "\\1<a href=\"http://\\2\" target=\"_blank\">\\2</a>", $ret); $ret = preg_replace("#(^|[\n ])([a-z0-9&\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)*[\w]+)#i", "\\1<a href=\"mailto:\\2@\\3\">\\2@\\3</a>", $ret); $ret = substr($ret, 1); return $ret; } $next_records = 10; $show_more_button = 0; if(checkValues($_REQUEST['value'])) { $userip = $_SERVER['REMOTE_ADDR']; echo "INSERT INTO facebook_posts (post,f_name,userip,date_created, pic) VALUES('".checkValues($_REQUEST['value'])."','$name1','".$userip."','".strtotime(date("Y-m-d H:i:s"))."','$link123')"; mysql_query("INSERT INTO facebook_posts (post,f_name,userip,date_created, pic) VALUES('".checkValues($_REQUEST['value'])."','$name1','".$userip."','".strtotime(date("Y-m-d H:i:s"))."', '$link123')"); $result = mysql_query("SELECT *, UNIX_TIMESTAMP() - date_created AS TimeSpent FROM facebook_posts order by p_id desc limit 1"); } elseif($_REQUEST['show_more_post']) // more posting paging { $next_records = $_REQUEST['show_more_post'] + 10; $result = mysql_query("SELECT *, UNIX_TIMESTAMP() - date_created AS TimeSpent FROM facebook_posts order by p_id desc limit ".$_REQUEST['show_more_post'].", 10"); $check_res = mysql_query("SELECT * FROM facebook_posts order by p_id desc limit ".$next_records.", 10"); $show_more_button = 0; // button in the end $check_result = mysql_num_rows(@$check_res); if($check_result > 0) { $show_more_button = 1; } } else { $show_more_button = 1; $result = mysql_query("SELECT *, UNIX_TIMESTAMP() - date_created AS TimeSpent FROM facebook_posts order by p_id desc limit 0,10"); } while ($row = mysql_fetch_array($result)) { $comments = mysql_query("SELECT *, UNIX_TIMESTAMP() - date_created AS CommentTimeSpent FROM facebook_posts_comments where post_id = ".$row['p_id']." order by c_id asc"); ?> <div class="friends_area" id="record-<?php echo $row['p_id']?>"> <img src="<?php echo $row['pic'];//////////////////////////////////////////////////////////////////////////////////////////////////////here are comments, one spot where i having issues ?>" width="40" class="CommentImg" style="float:left;" alt="" /> <label style="float:left" class="name"> <b><?php echo $row['f_name'];?></b> <em><?php echo clickable_link($row['post']);?></em> <br clear="all" /> <span> <?php // echo strtotime($row['date_created'],"Y-m-d H:i:s"); timeSince($timestamp); ?> </span> <a href="javascript: void(0)" id="post_id<?php echo $row['p_id']?>" class="showCommentBox">Comments</a> </label> <?php $userip = $_SERVER['REMOTE_ADDR']; if($row['userip'] == $userip){?> <a href="#" class="delete"> Remove</a> <?php }?> <br clear="all" /> <div id="CommentPosted<?php echo $row['p_id']?>"> <?php $comment_num_row = mysql_num_rows(@$comments); if($comment_num_row > 0) { while ($rows = mysql_fetch_array($comments)) { $days2 = floor($rows['CommentTimeSpent'] / (60 * 60 * 24)); $remainder = $rows['CommentTimeSpent'] % (60 * 60 * 24); $hours = floor($remainder / (60 * 60)); $remainder = $remainder % (60 * 60); $minutes = floor($remainder / 60); $seconds = $remainder % 60; ?> <div class="commentPanel" id="record-<?php echo $rows['c_id'];?>" align="left"> <img src="<?php echo $rows['pic'];//////////////////////////////////////////////////////////////////////////////////////////////////////here are comments, one spot where i having issues ?>" width="40" class="CommentImg" style="float:left;" alt="" /> <label class="postedComments" > <strong><font color="#3B5998"> <?php echo $rows['f_name'];?></font></strong> <?php echo clickable_link($rows['comments']);?> </label> <br clear="all" /> <span style="margin-left:43px; color:#666666; font-size:11px"> <?php if($days2 > 0){ echo date('F d Y', $rows['date_created']);} elseif($days2 == 0 && $hours == 0 && $minutes == 0){ echo "few seconds ago"; }elseif($days2 == 0 && $hours == 0){ echo $minutes.' minutes ago'; }else{ echo $minutes.' minutes ago';} ?> </span> <?php $userip = $_SERVER['REMOTE_ADDR']; if($rows['userip'] == $userip){?> <a href="#" id="CID-<?php echo $rows['c_id'];?>" class="c_delete">Delete</a> <?php }?> </div> <?php }?> <?php }?> </div> <div class="commentBox" align="right" id="commentBox-<?php echo $row['p_id'];?>" <?php echo (($comment_num_row) ? '' :'style="display:none"')?> > <label id="record-<?php echo $row['p_id'];?>" > <textarea class="commentMark" id="commentMark-<?php echo $row['p_id'];?>" name="commentMark" cols="60"></textarea> </label> <br clear="all" /> <a id="SubmitComment" class="small button comment"> Comment</a> </div> </div> <?php } if($show_more_button == 1){?> <div id="bottomMoreButton"> <a id="more_<?php echo @$next_records?>" class="more_records" href="javascript: void(0)">Older Posts</a> </div> <?php }?>
  5. and to all of u that wonder, I am teaching myself php I am not taking a class from anywhere, that is why I ask so many questions. This forum is my main source of help. I will try to post better questions in the future, just sometimes I don't know how to say what I am thinking, I am a much better shower than putting those thoughts into words. I am sorry for vague posts, and I will try to stop. Just please remember, some people, like me, are starting out with php and don't know as much as others. I am sorry for any trouble/grief I have caused you.
  6. Ok, I have figured some stuff about the function out. just one question......what is $timestamp's value? I cant seem to find it. or is it supposed to be from the database row date_created?
  7. how can I make the original code I posted work better instead of the function?
  8. here is what I have, but i get an error saying it can't redeclare the function timespent on line 101 <?php session_start(); include('dbcon.php'); $username1 = $_SESSION['username']; $name1 = $_SESSION['name']; // set time of last activity $userTime = time(); mysql_query("update `sessions` set `activity` = '$userTime' where username='$username1'"); $inactivityTime = time() - 120; // 2 minutes mysql_query("update `sessions` set `loggedin` = '0' where `activity` < '$inactivityTime' "); $username = $rows['f_name']; $sql = mysql_query("SELECT * from pics WHERE user='$username1'"); while($row = mysql_fetch_array($sql)){ $link123 = $row["link"]; } function checkValues($value) { $value = trim($value); if (get_magic_quotes_gpc()) { $value = stripslashes($value); } $value = strtr($value,array_flip(get_html_translation_table(HTML_ENTITIES))); $value = strip_tags($value); $value = mysql_real_escape_string($value); $value = htmlspecialchars ($value); return $value; } function clickable_link($text = '') { $text = preg_replace('#(script|about|applet|activex|chrome):#is', "\\1:", $text); $ret = ' ' . $text; $ret = preg_replace("#(^|[\n ])([\w]+?://[\w\#$%&~/.\-;:=,?@\[\]+]*)#is", "\\1<a href=\"\\2\" target=\"_blank\">\\2</a>", $ret); $ret = preg_replace("#(^|[\n ])((www|ftp)\.[\w\#$%&~/.\-;:=,?@\[\]+]*)#is", "\\1<a href=\"http://\\2\" target=\"_blank\">\\2</a>", $ret); $ret = preg_replace("#(^|[\n ])([a-z0-9&\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)*[\w]+)#i", "\\1<a href=\"mailto:\\2@\\3\">\\2@\\3</a>", $ret); $ret = substr($ret, 1); return $ret; } $next_records = 10; $show_more_button = 0; if(checkValues($_REQUEST['value'])) { $userip = $_SERVER['REMOTE_ADDR']; echo "INSERT INTO facebook_posts (post,f_name,userip,date_created, pic) VALUES('".checkValues($_REQUEST['value'])."','$name1','".$userip."','".strtotime(date("Y-m-d H:i:s"))."','$link123')"; mysql_query("INSERT INTO facebook_posts (post,f_name,userip,date_created, pic) VALUES('".checkValues($_REQUEST['value'])."','$name1','".$userip."','".strtotime(date("Y-m-d H:i:s"))."', '$link123')"); $result = mysql_query("SELECT *, UNIX_TIMESTAMP() - date_created AS TimeSpent FROM facebook_posts order by p_id desc limit 1"); } elseif($_REQUEST['show_more_post']) // more posting paging { $next_records = $_REQUEST['show_more_post'] + 10; $result = mysql_query("SELECT *, UNIX_TIMESTAMP() - date_created AS TimeSpent FROM facebook_posts order by p_id desc limit ".$_REQUEST['show_more_post'].", 10"); $check_res = mysql_query("SELECT * FROM facebook_posts order by p_id desc limit ".$next_records.", 10"); $show_more_button = 0; // button in the end $check_result = mysql_num_rows(@$check_res); if($check_result > 0) { $show_more_button = 1; } } else { $show_more_button = 1; $result = mysql_query("SELECT *, UNIX_TIMESTAMP() - date_created AS TimeSpent FROM facebook_posts order by p_id desc limit 0,10"); } while ($row = mysql_fetch_array($result)) { $comments = mysql_query("SELECT *, UNIX_TIMESTAMP() - date_created AS CommentTimeSpent FROM facebook_posts_comments where post_id = ".$row['p_id']." order by c_id asc"); ?> <div class="friends_area" id="record-<?php echo $row['p_id']?>"> <img src="<?php echo $row['pic'];//////////////////////////////////////////////////////////////////////////////////////////////////////here are comments, one spot where i having issues ?>" width="40" class="CommentImg" style="float:left;" alt="" /> <label style="float:left" class="name"> <b><?php echo $row['f_name'];?></b> <em><?php echo clickable_link($row['post']);?></em> <br clear="all" /> <span> <?php // echo strtotime($row['date_created'],"Y-m-d H:i:s"); function timeSince($timestamp) { $minute = 60; $hour = $minute * 60; $day = $hour * 24; $secondsSince = time() - $timestamp; if($secondsSince >= $day) { $daysSince = floor($secondsSince/$day); $s = ($daysSince>1) ? 's' : ''; //return date('F d Y', $row['date_created']) return "{$daysSince} day{$s} ago."; } if($secondsSince >= $hour) { $hoursSince = floor($secondsSince/$hour); $s = ($hoursSince>1) ? 's' : ''; return "{$hoursSince} hour{$s} ago."; } if($secondsSince >= $minute) { $minutesSince = floor($secondsSince/$minute); $s = ($minutesSince>1) ? 's' : ''; return "{$minutesSince} minute{$s} ago."; } $s = ($secondsSince>1) ? 's' : ''; return "{$secondsSince} second{$s} ago."; } ?> </span> <a href="javascript: void(0)" id="post_id<?php echo $row['p_id']?>" class="showCommentBox">Comments</a> </label> <?php $userip = $_SERVER['REMOTE_ADDR']; if($row['userip'] == $userip){?> <a href="#" class="delete"> Remove</a> <?php }?> <br clear="all" /> <div id="CommentPosted<?php echo $row['p_id']?>"> <?php $comment_num_row = mysql_num_rows(@$comments); if($comment_num_row > 0) { while ($rows = mysql_fetch_array($comments)) { $days2 = floor($rows['CommentTimeSpent'] / (60 * 60 * 24)); $remainder = $rows['CommentTimeSpent'] % (60 * 60 * 24); $hours = floor($remainder / (60 * 60)); $remainder = $remainder % (60 * 60); $minutes = floor($remainder / 60); $seconds = $remainder % 60; ?> <div class="commentPanel" id="record-<?php echo $rows['c_id'];?>" align="left"> <img src="<?php echo $rows['pic'];//////////////////////////////////////////////////////////////////////////////////////////////////////here are comments, one spot where i having issues ?>" width="40" class="CommentImg" style="float:left;" alt="" /> <label class="postedComments" > <strong><font color="#3B5998"> <?php echo $rows['f_name'];?></font></strong> <?php echo clickable_link($rows['comments']);?> </label> <br clear="all" /> <span style="margin-left:43px; color:#666666; font-size:11px"> <?php if($days2 > 0){ echo date('F d Y', $rows['date_created']);} elseif($days2 == 0 && $hours == 0 && $minutes == 0){ echo "few seconds ago"; }elseif($days2 == 0 && $hours == 0){ echo $minutes.' minutes ago'; }else{ echo $minutes.' minutes ago';} ?> </span> <?php $userip = $_SERVER['REMOTE_ADDR']; if($rows['userip'] == $userip){?> <a href="#" id="CID-<?php echo $rows['c_id'];?>" class="c_delete">Delete</a> <?php }?> </div> <?php }?> <?php }?> </div> <div class="commentBox" align="right" id="commentBox-<?php echo $row['p_id'];?>" <?php echo (($comment_num_row) ? '' :'style="display:none"')?> > <label id="record-<?php echo $row['p_id'];?>" > <textarea class="commentMark" id="commentMark-<?php echo $row['p_id'];?>" name="commentMark" cols="60"></textarea> </label> <br clear="all" /> <a id="SubmitComment" class="small button comment"> Comment</a> </div> </div> <?php } if($show_more_button == 1){?> <div id="bottomMoreButton"> <a id="more_<?php echo @$next_records?>" class="more_records" href="javascript: void(0)">Older Posts</a> </div> <?php }?>
  9. yes i did thank you. how do I make it then so that my message will display where I want it at? eg. where I put it at in the script
  10. I keep getting this error: Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/searls03/public_html/index.php:117) in /home/searls03/public_html/index.php on line 119. please help me find out what I am doing wrong. I know something is being sent, but idk where. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Untitled Document</title> <style type="text/css"> #apDiv1 { position:absolute; left:0px; top:0px; width:100%; height:50px; z-index:1; background-color: #000; padding: 0px; text-align: left; } #menu { position:absolute; top:6px; width:411px; height:34px; z-index:41; right: 148px; } .jkljl { color: #FFF; } .adfasd { color: #FFF; } #apDiv1 #menu table #logform tr .style7 div { color: #FFF; } </style> <style type="text/css"> #apDiv2 { position:absolute; left:5px; top:75px; width:591px; height:284px; z-index:2; } #apDiv3 { position:absolute; left:111px; top:198px; width:466px; height:369px; z-index:2; } #apDiv3 div #form1 p { text-align: right; } .fullname { position:relative; left:0px; width:100px; height:30px; z-index:4; top:25px; background-color:black; color:white; text-align: center; } .fullname1 { position:relative; left:0px; width:100px; height:20px; z-index:4; top:px; background-color:white; color:Black; text-align: center; } </style> <script type="text/javascript"> function MM_swapImgRestore() { //v3.0 var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc; } function MM_preloadImages() { //v3.0 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++) if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}} } function MM_findObj(n, d) { //v4.01 var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); if(!x && d.getElementById) x=d.getElementById(n); return x; } function MM_swapImage() { //v3.0 var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3) if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];} } </script> </head> <body onload="MM_preloadImages('/hover.png')"><div id="apDiv1"> <div id="menu"><table align="center" cellpadding="5"> <form action="index.php" method="post" enctype="multipart/form-data" name="logform" id="logform" onsubmit="return validate_form ( );"> <tr> <td class="style7"><div align="right"><span class="jkljl">Username</span>:</div></td> <td><input name="username" type="text" id="username" size="15" maxlength="64" /></td> <td><div align="right" class="adfasd">Password:</div></td> <td><input name="password2" type="password" id="password2" size="15" maxlength="24" /> </td> <td><input name="login" type="submit" value="Login" class="fullname1" id="login" /></td> </tr> </form> </table> <?php if ($_POST['login']) {include_once "connect_to_mysql_1.php"; session_start(); //Connect to the database through our include $username = stripslashes($_POST['username']); $username = strip_tags($username); $username = mysql_real_escape_string($username); $password = ereg_replace("[^A-Za-z0-9]", "", $_POST['password2']); $password = md5($password); $sql = mysql_query("select * FROM sessions WHERE username='$username' AND password='$password'"); $login_check = mysql_num_rows($sql); if($login_check > 0){ while($row = mysql_fetch_array($sql)){ $id = $row["id"]; session_register('id'); $_SESSION['id'] = $id; $username = $row["username"]; session_register('username'); $_SESSION['username'] = $username; $name = $row["name"]; session_register('name'); $_SESSION['name'] = $name; $userlevel = $row["userlevel"]; session_register('userlevel'); $_SESSION['userlevel'] = 9; if ($_POST['username']) { $sql = mysql_query("UPDATE sessions SET loggedin='1' where username='$username'")or die(mysql_error()); } // Print success message here if all went well then exit the script $errorMsg = ''; $pass = ''; $remember = ''; if (isset($_POST['Submit'])) { $pass = $_POST['password']; if (isset($_POST['remember'])) { $remember = $_POST['remember']; } $pass = stripslashes($pass); $pass = strip_tags($pass); if($remember == "yes"){ $encryptedID = base64_encode("g4enm2c0c4y3dn3727553$id"); setcookie("idCookie", $encryptedID, time()+60*60*24*100, "/"); // Cookie set to expire in about 30 days setcookie("passCookie", $password, time()+60*60*24*100, "/"); // Cookie set to expire in about 30 days } // All good they are logged in, send them to homepage then exit script header("location: main.php"); exit(); }} // close while } else { // Print login failure message to the user and link them back to your login page print '<br /><br /><font color="#FF0000">Sorry, incorrect username or password, please try again! </font><br />'; }} ?> </div> <a href="main.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image1','','/hover.png',1)"><img src="/main.png" name="Image1" width="600" height="50" border="0" id="Image1" /></a> </div> <div id="apDiv3"><label for="day"></label> <label for="day"></label> <div align="left"> <div align="right"> <p>Sign up for a new account!</p> </div> <form id="form1" name="form1" method="post" action="loginred.php"> <p> <label for="first ">First Name</label> <input type="text" name="first" id="first" /> </p> <p> <label for="last">Last Name</label> <input type="text" name="last" id="last" /> </p> <p> <label for="email">Your email</label> <input type="text" name="email" id="email" /> </p> <p> <label for="email2">Re-enter Email</label> <input type="text" name="email2" id="email2" /> </p> <p> <label for="password">Password</label> <input type="password" name="password" id="password" /><br /><br /><label for="username">Username </label><input name="username" id="username" type="text" /> </p> <p>Gender <select name="gender"> <option value="Male">Male</option> <option value="Female">Female</option> </select> <br /> <select name="month" id="month"> <option value="January" selected="selected">January</option> <option value="February">February</option> <option value="March">March</option> <option value="April">April</option> <option value="May">May</option> <option value="June">June</option> <option value="July">July</option> <option value="August">August</option> <option value="September">September</option> <option value="October">October</option> <option value="November">November</option> <option value="December">December</option> </select> <select name="day" id="day"> <option value="1" selected="selected">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> <option value="11">11</option> <option value="12">12</option> <option value="13">13</option> <option value="14">14</option> <option value="15">15</option> <option value="16">16</option> <option value="17">17</option> <option value="18">18</option> <option value="19">19</option> <option value="20">20</option> <option value="21">21</option> <option value="22">22</option> <option value="23">23</option> <option value="24">24</option> <option value="25">25</option> <option value="26">26</option> <option value="27">27</option> <option value="28">28</option> <option value="29">29</option> <option value="30">30</option> <option value="31">31</option> </select> <?php echo '<select name="year" id="year">'; for( $i = 1900; $i <= date('Y', strtotime( '- 0 year')); $i++ ) { echo '<option>'; echo $i; echo '</option>';} echo '</select>'; ?></p> <p> <input type="submit" name="register" id="register" class="fullname" value="Sign up" /> </p> </form> <p> </p> <p> <label for="year"></label> </p> </div></div> <img src="lettering.png" width="150" height="525" /> </body> </html>
  11. I need it to copy to the specific users folder on my server. in the database, it has a link that is echoed to show image. but I need it so that the default pic will go into the folder that was created for them. this is the way I choose to do it.....could the be a better way, possibly, but this seems the most logical way to me.
  12. how can I insert a profile pic into my ftp server when a user signs up. if they are male, there is male, same for female. I have a folder create with their username which is where all pics are stored for the particular user. I need to know how I can make it so that the default pic will upload when they sign up. does it need to be somewhere else on the server? or how can I do this. the names are maleavatar.png and femaleavatar.png. please help.
  13. here is entire code, it may clear stuff up: <?php session_start(); include('dbcon.php'); $username1 = $_SESSION['username']; $name1 = $_SESSION['name']; // set time of last activity $userTime = time(); mysql_query("update `sessions` set `activity` = '$userTime' where username='$username1'"); $inactivityTime = time() - 120; // 2 minutes mysql_query("update `sessions` set `loggedin` = '0' where `activity` < '$inactivityTime' "); $username = $rows['f_name']; $sql = mysql_query("SELECT * from pics WHERE user='$username1'"); while($row = mysql_fetch_array($sql)){ $link123 = $row["link"]; } function checkValues($value) { $value = trim($value); if (get_magic_quotes_gpc()) { $value = stripslashes($value); } $value = strtr($value,array_flip(get_html_translation_table(HTML_ENTITIES))); $value = strip_tags($value); $value = mysql_real_escape_string($value); $value = htmlspecialchars ($value); return $value; } function clickable_link($text = '') { $text = preg_replace('#(script|about|applet|activex|chrome):#is', "\\1:", $text); $ret = ' ' . $text; $ret = preg_replace("#(^|[\n ])([\w]+?://[\w\#$%&~/.\-;:=,?@\[\]+]*)#is", "\\1<a href=\"\\2\" target=\"_blank\">\\2</a>", $ret); $ret = preg_replace("#(^|[\n ])((www|ftp)\.[\w\#$%&~/.\-;:=,?@\[\]+]*)#is", "\\1<a href=\"http://\\2\" target=\"_blank\">\\2</a>", $ret); $ret = preg_replace("#(^|[\n ])([a-z0-9&\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)*[\w]+)#i", "\\1<a href=\"mailto:\\2@\\3\">\\2@\\3</a>", $ret); $ret = substr($ret, 1); return $ret; } $next_records = 10; $show_more_button = 0; if(checkValues($_REQUEST['value'])) { $userip = $_SERVER['REMOTE_ADDR']; echo "INSERT INTO facebook_posts (post,f_name,userip,date_created, pic) VALUES('".checkValues($_REQUEST['value'])."','$name1','".$userip."','".strtotime(date("Y-m-d H:i:s"))."','$link123')"; mysql_query("INSERT INTO facebook_posts (post,f_name,userip,date_created, pic) VALUES('".checkValues($_REQUEST['value'])."','$name1','".$userip."','".strtotime(date("Y-m-d H:i:s"))."', '$link123')"); $result = mysql_query("SELECT *, UNIX_TIMESTAMP() - date_created AS TimeSpent FROM facebook_posts order by p_id desc limit 1"); } elseif($_REQUEST['show_more_post']) // more posting paging { $next_records = $_REQUEST['show_more_post'] + 10; $result = mysql_query("SELECT *, UNIX_TIMESTAMP() - date_created AS TimeSpent FROM facebook_posts order by p_id desc limit ".$_REQUEST['show_more_post'].", 10"); $check_res = mysql_query("SELECT * FROM facebook_posts order by p_id desc limit ".$next_records.", 10"); $show_more_button = 0; // button in the end $check_result = mysql_num_rows(@$check_res); if($check_result > 0) { $show_more_button = 1; } } else { $show_more_button = 1; $result = mysql_query("SELECT *, UNIX_TIMESTAMP() - date_created AS TimeSpent FROM facebook_posts order by p_id desc limit 0,10"); } while ($row = mysql_fetch_array($result)) { $comments = mysql_query("SELECT *, UNIX_TIMESTAMP() - date_created AS CommentTimeSpent FROM facebook_posts_comments where post_id = ".$row['p_id']." order by c_id asc"); ?> <div class="friends_area" id="record-<?php echo $row['p_id']?>"> <img src="<?php echo $row['pic'];//////////////////////////////////////////////////////////////////////////////////////////////////////here are comments, one spot where i having issues ?>" width="40" class="CommentImg" style="float:left;" alt="" /> <label style="float:left" class="name"> <b><?php echo $row['f_name'];?></b> <em><?php echo clickable_link($row['post']);?></em> <br clear="all" /> <span> <?php // echo strtotime($row['date_created'],"Y-m-d H:i:s"); $days = floor($row['TimeSpent'] / (60 * 60 * 24)); $remainder = $row['TimeSpent'] % (60 * 60 * 24); $hours = floor($remainder / (60 * 60)); $remainder = $remainder % (60 * 60); $minutes = floor($remainder / 60); $seconds = $remainder % 60; if($days > 0){ echo date('F d Y', $row['date_created']); }else if($days == 0 && $hours == 0 && $minutes == 0){ echo "few seconds ago"; }elseif($days == 0 && $hours == 0){ echo $minutes.' minutes ago'; }else { echo $minutes.' minutes ago';} ?> </span> <a href="javascript: void(0)" id="post_id<?php echo $row['p_id']?>" class="showCommentBox">Comments</a> </label> <?php $userip = $_SERVER['REMOTE_ADDR']; if($row['userip'] == $userip){?> <a href="#" class="delete"> Remove</a> <?php }?> <br clear="all" /> <div id="CommentPosted<?php echo $row['p_id']?>"> <?php $comment_num_row = mysql_num_rows(@$comments); if($comment_num_row > 0) { while ($rows = mysql_fetch_array($comments)) { $days2 = floor($rows['CommentTimeSpent'] / (60 * 60 * 24)); $remainder = $rows['CommentTimeSpent'] % (60 * 60 * 24); $hours = floor($remainder / (60 * 60)); $remainder = $remainder % (60 * 60); $minutes = floor($remainder / 60); $seconds = $remainder % 60; ?> <div class="commentPanel" id="record-<?php echo $rows['c_id'];?>" align="left"> <img src="<?php echo $rows['pic'];//////////////////////////////////////////////////////////////////////////////////////////////////////here are comments, one spot where i having issues ?>" width="40" class="CommentImg" style="float:left;" alt="" /> <label class="postedComments" > <strong><font color="#3B5998"> <?php echo $rows['f_name'];?></font></strong> <?php echo clickable_link($rows['comments']);?> </label> <br clear="all" /> <span style="margin-left:43px; color:#666666; font-size:11px"> <?php if($days2 > 0){ echo date('F d Y', $rows['date_created']);} elseif($days2 == 0 && $hours == 0 && $minutes == 0){ echo "few seconds ago"; }elseif($days2 == 0 && $hours == 0){ echo $minutes.' minutes ago'; }else{ echo $minutes.' minutes ago';} ?> </span> <?php $userip = $_SERVER['REMOTE_ADDR']; if($rows['userip'] == $userip){?> <a href="#" id="CID-<?php echo $rows['c_id'];?>" class="c_delete">Delete</a> <?php }?> </div> <?php }?> <?php }?> </div> <div class="commentBox" align="right" id="commentBox-<?php echo $row['p_id'];?>" <?php echo (($comment_num_row) ? '' :'style="display:none"')?> > <label id="record-<?php echo $row['p_id'];?>" > <textarea class="commentMark" id="commentMark-<?php echo $row['p_id'];?>" name="commentMark" cols="60"></textarea> </label> <br clear="all" /> <a id="SubmitComment" class="small button comment"> Comment</a> </div> </div> <?php } if($show_more_button == 1){?> <div id="bottomMoreButton"> <a id="more_<?php echo @$next_records?>" class="more_records" href="javascript: void(0)">Older Posts</a> </div> <?php }?> and I think they are basically the number of seconds from like 1900 or something like that. some year anyway.
  14. oh btw, 2hours was just an example....idk how long it is......all I know is that the next day it says 1 minute ago..........
  15. here is a code I have to echo how long ago a post was made.......it works, sorta, but it starts counting up minutes and when it reaches like 2 hours, it says 1minute ago. do you see wht is wrong with this logic? $days = floor($row['TimeSpent'] / (60 * 60 * 24)); $remainder = $row['TimeSpent'] % (60 * 60 * 24); $hours = floor($remainder / (60 * 60)); $remainder = $remainder % (60 * 60); $minutes = floor($remainder / 60); $seconds = $remainder % 60; if($days > 0){ echo date('F d Y', $row['date_created']); }else if($days == 0 && $hours == 0 && $minutes == 0){ echo "few seconds ago"; }elseif($days == 0 && $hours == 0){ echo $minutes.' minutes ago'; }else { echo $minutes.' minutes ago';}
  16. ok so I am having trouble showing the proper profile pic next to the proper name. it is showing the currently logged in users pic next to every name. I need to know how to make it so the the proper pic shows next to the proper name. I inserted comments, hopefully you can find them, there are a bunch of ////////////////////////////where my comments start. haha. I hope someone understands what I am saying, cause this is difficult to explain. <?php session_start(); include('dbcon.php'); $username1 = $_SESSION['username']; $name1 = $_SESSION['name']; // set time of last activity $userTime = time(); mysql_query("update `sessions` set `activity` = '$userTime' where username='$username1'"); $inactivityTime = time() - 120; // 2 minutes mysql_query("update `sessions` set `loggedin` = '0' where `activity` < '$inactivityTime' "); $username = $rows['f_name']; $sql = mysql_query("SELECT * from pics WHERE personname='$username'");/////////////////////////////this is where pic is being pulled from while($row = mysql_fetch_array($sql)){ $link123 = $row["link"]; } function checkValues($value) { $value = trim($value); if (get_magic_quotes_gpc()) { $value = stripslashes($value); } $value = strtr($value,array_flip(get_html_translation_table(HTML_ENTITIES))); $value = strip_tags($value); $value = mysql_real_escape_string($value); $value = htmlspecialchars ($value); return $value; } function clickable_link($text = '') { $text = preg_replace('#(script|about|applet|activex|chrome):#is', "\\1:", $text); $ret = ' ' . $text; $ret = preg_replace("#(^|[\n ])([\w]+?://[\w\#$%&~/.\-;:=,?@\[\]+]*)#is", "\\1<a href=\"\\2\" target=\"_blank\">\\2</a>", $ret); $ret = preg_replace("#(^|[\n ])((www|ftp)\.[\w\#$%&~/.\-;:=,?@\[\]+]*)#is", "\\1<a href=\"http://\\2\" target=\"_blank\">\\2</a>", $ret); $ret = preg_replace("#(^|[\n ])([a-z0-9&\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)*[\w]+)#i", "\\1<a href=\"mailto:\\2@\\3\">\\2@\\3</a>", $ret); $ret = substr($ret, 1); return $ret; } $next_records = 10; $show_more_button = 0; if(checkValues($_REQUEST['value'])) { $userip = $_SERVER['REMOTE_ADDR']; echo "INSERT INTO facebook_posts (post,f_name,userip,date_created) VALUES('".checkValues($_REQUEST['value'])."','$name1','".$userip."','".strtotime(date("Y-m-d H:i:s"))."')"; mysql_query("INSERT INTO facebook_posts (post,f_name,userip,date_created) VALUES('".checkValues($_REQUEST['value'])."','$name1','".$userip."','".strtotime(date("Y-m-d H:i:s"))."')"); $result = mysql_query("SELECT *, UNIX_TIMESTAMP() - date_created AS TimeSpent FROM facebook_posts order by p_id desc limit 1"); } elseif($_REQUEST['show_more_post']) // more posting paging { $next_records = $_REQUEST['show_more_post'] + 10; $result = mysql_query("SELECT *, UNIX_TIMESTAMP() - date_created AS TimeSpent FROM facebook_posts order by p_id desc limit ".$_REQUEST['show_more_post'].", 10"); $check_res = mysql_query("SELECT * FROM facebook_posts order by p_id desc limit ".$next_records.", 10"); $show_more_button = 0; // button in the end $check_result = mysql_num_rows(@$check_res); if($check_result > 0) { $show_more_button = 1; } } else { $show_more_button = 1; $result = mysql_query("SELECT *, UNIX_TIMESTAMP() - date_created AS TimeSpent FROM facebook_posts order by p_id desc limit 0,10"); } while ($row = mysql_fetch_array($result)) { $comments = mysql_query("SELECT *, UNIX_TIMESTAMP() - date_created AS CommentTimeSpent FROM facebook_posts_comments where post_id = ".$row['p_id']." order by c_id asc"); ?> <div class="friends_area" id="record-<?php echo $row['p_id']?>"> <img src="<?php echo $link123;/////////////////////////////////////////////////////////////////////////////////////////////////////this is the original post, one spot where I am having issues ?>" style="float:left;" width="40" alt="" /> <label style="float:left" class="name"> <b><?php echo $row['f_name'];?></b> <em><?php echo clickable_link($row['post']);?></em> <br clear="all" /> <span> <?php // echo strtotime($row['date_created'],"Y-m-d H:i:s"); $days = floor($row['TimeSpent'] / (60 * 60 * 24)); $remainder = $row['TimeSpent'] % (60 * 60 * 24); $hours = floor($remainder / (60 * 60)); $remainder = $remainder % (60 * 60); $minutes = floor($remainder / 60); $seconds = $remainder % 60; if($days > 0){ echo date('F d Y', $row['date_created']); }else if($days == 0 && $hours == 0 && $minutes == 0){ echo "few seconds ago"; }elseif($days == 0 && $hours == 0){ echo $minutes.' minutes ago'; }else { echo $minutes.' minutes ago';} ?> </span> <a href="javascript: void(0)" id="post_id<?php echo $row['p_id']?>" class="showCommentBox">Comments</a> </label> <?php $userip = $_SERVER['REMOTE_ADDR']; if($row['userip'] == $userip){?> <a href="#" class="delete"> Remove</a> <?php }?> <br clear="all" /> <div id="CommentPosted<?php echo $row['p_id']?>"> <?php $comment_num_row = mysql_num_rows(@$comments); if($comment_num_row > 0) { while ($rows = mysql_fetch_array($comments)) { $days2 = floor($rows['CommentTimeSpent'] / (60 * 60 * 24)); $remainder = $rows['CommentTimeSpent'] % (60 * 60 * 24); $hours = floor($remainder / (60 * 60)); $remainder = $remainder % (60 * 60); $minutes = floor($remainder / 60); $seconds = $remainder % 60; ?> <div class="commentPanel" id="record-<?php echo $rows['c_id'];?>" align="left"> <img src="<?php echo $link123;//////////////////////////////////////////////////////////////////////////////////////////////////////here are comments, one spot where i having issues ?>" width="40" class="CommentImg" style="float:left;" alt="" /> <label class="postedComments" > <strong><font color="#3B5998"> <?php echo $rows['f_name'];?></font></strong> <?php echo clickable_link($rows['comments']);?> </label> <br clear="all" /> <span style="margin-left:43px; color:#666666; font-size:11px"> <?php if($days2 > 0){ echo date('F d Y', $rows['date_created']);} elseif($days2 == 0 && $hours == 0 && $minutes == 0){ echo "few seconds ago"; }elseif($days2 == 0 && $hours == 0){ echo $minutes.' minutes ago'; }else{ echo $minutes.' minutes ago';} ?> </span> <?php $userip = $_SERVER['REMOTE_ADDR']; if($rows['userip'] == $userip){?> <a href="#" id="CID-<?php echo $rows['c_id'];?>" class="c_delete">Delete</a> <?php }?> </div> <?php }?> <?php }?> </div> <div class="commentBox" align="right" id="commentBox-<?php echo $row['p_id'];?>" <?php echo (($comment_num_row) ? '' :'style="display:none"')?> > <label id="record-<?php echo $row['p_id'];?>" > <textarea class="commentMark" id="commentMark-<?php echo $row['p_id'];?>" name="commentMark" cols="60"></textarea> </label> <br clear="all" /> <a id="SubmitComment" class="small button comment"> Comment</a> </div> </div> <?php } if($show_more_button == 1){?> <div id="bottomMoreButton"> <a id="more_<?php echo @$next_records?>" class="more_records" href="javascript: void(0)">Older Posts</a> </div> <?php }?>
  17. I have this and it still does not update database, it uploads though........ <?php if($_POST['submit']){ // Where the file is going to be placed $target_path = "images/".$_SESSION['username']."/"; foreach ($_FILES["uploadedfile"]["name"] as $key => $value) { $uploadfile = $target_path . basename($_FILES[uploadedfile][name][$key]); //echo $uploadfile; if (move_uploaded_file($_FILES['uploadedfile']['tmp_name'][$key], $uploadfile)) { $sql = mysql_query("UPDATE pics SET link='$target_path', name='$uploadedfile' WHERE id='$userid1'")or die(mysql_error()); echo $value . ' uploaded<br>'; } } } ?>
  18. So how exactly is the SQL statement written then????
  19. And what do I usr for the file name piece?
  20. I want to insert that piece of code into the first piece. I do not know where to put it or how to make it so that it is the file name on the end of $target_path. I need to know where to place the second code inside of the first. haha
  21. I have this code: <?php if($_POST['submit']){ // Where the file is going to be placed $target_path = "images/".$_SESSION['username']."/"; foreach ($_FILES["uploadedfile"]["name"] as $key => $value) { $uploadfile = $target_path . basename($_FILES[uploadedfile][name][$key]); //echo $uploadfile; if (move_uploaded_file($_FILES['uploadedfile']['tmp_name'][$key], $uploadfile)) { echo $value . ' uploaded<br>'; } } } ?> and I want to insert: $sql = mysql_query("UPDATE pics SET link='$target_path' WHERE id='$userid1'")or die(mysql_error()); so that when it uploads the file, it will also put info, such as a link to the file in the dbase. how can I make $target_path = "images/".$_SESSION['username']."/ (the name of the file)"; I am stumped as to where to put the code or how to do this. please help.
  22. what I want to have happen is when the message is sent to the database, it updates activity, so that the session logout time is updated basically. I cant seem to figure out how to make it work. I had tried placing it by where it would send to dbase, but that didn't work. do you guys have any ideas?
  23. one, those logs are not accessible from my webhost. 2, tables are being emptied, not dropped, 3, I highly doubt that it is injection cause I have a couple of sites and it happens at exact same time on all of the sites. 4, the webhost said it was a mysql server issue.
×
×
  • 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.