Jump to content

searls03

Members
  • Posts

    907
  • Joined

  • Last visited

Everything posted by searls03

  1. ok so I have this code <?php session_start(); $_SESSION['username'] = "johndoe" // Must be already set ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/loose.dtd" > <html> <head> <title>Sample Chat Application</title> <style> body { background-color: #eeeeee; padding:0; margin:0 auto; font-family:"Lucida Grande",Verdana,Arial,"Bitstream Vera Sans",sans-serif; font-size:11px; } </style> <link type="text/css" rel="stylesheet" media="all" href="css/chat.css" /> <link type="text/css" rel="stylesheet" media="all" href="css/screen.css" /> <!--[if lte IE 7]> <link type="text/css" rel="stylesheet" media="all" href="css/screen_ie.css" /> <![endif]--> </head> <body> <div id="main_container"> <a href="javascript:void(0)" onClick="javascript:chatWith('janedoe')">Chat With Jane Doe</a> <a href="javascript:void(0)" onClick="javascript:chatWith('babydoe')">Chat With Baby Doe</a> <!-- YOUR BODY HERE --> </div> <script type="text/javascript" src="js/jquery.js"></script> <script type="text/javascript" src="js/chat.js"></script> </body> </html> how can I make it so that it only shows a link to chat with whoever is online? and how do I make it so that the link will go to users in a database.........username........and name(in database) does this make a little bit of sense or any at all?
  2. the best way to describe what I want is facebook's wall. I want a post to be shown right after it is posted........like facebooks wall.......you post a status and then the page doesnt refresh and the post appears. how can I do this? this may or may not be php......idk much about scripting languages.
  3. any search terms for youtube......i tried there and I couldn't quite find what I needed
  4. I don't know whether this is php or what.......but this is like the most widely read section......so hopefully someone can point this or move it to the right section if it is not PHP.....but how would I make a facebook like chatbox............any google searches? websites? or even any sample code would be appreciated. thanks.
  5. what are the different ways to store login data on the site(sessions, cookies, etc.)? which is the best? what would I use to make it so that if the page is left and then revisited the login data is still there or like if you click on login, it will redirect you to the main member page? does this make sense?
  6. oh yeah, nothing needs to add up or anything either.
  7. ok, lets see, I am trying the code a bit, but it keeps saying unreadable. so basically I want to have lets say A1 say name and all the rest of the A's be all the names pulled from the database. lets say B's are email addresses, C's are phone numbers. Could you help me with the code as to what is what seeing as there was no documentation with it? here is what I have tried, but keep getting errors <?php session_start(); // Must start session first thing /* Created By Adam Khoury @ [url='http://www.flashbuilding.com/']www.flashbuilding.com[/url] -----------------------June 20, 2008----------------------- */ // Here we run a login check ini_set("session.gc_maxlifetime", "900000000000000000000000"); if (!isset($_SESSION['id'])) { 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.php"; // Place Session variable 'id' into local variable $userid = $_SESSION['id']; // Process the form if it is submitted $sql = mysql_query("SELECT * FROM members WHERE userid='$userid'"); while($row = mysql_fetch_array($sql)){ $name = $row["name"]; $phone = $row["phone"]; $username = $row["username"]; $address = $row["address"]; $city = $row["city"]; $state = $row["state"]; $zip = $row["zip"]; $cell = $row["cell"]; $email = $row["email"]; $accounttype = $row["accounttype"]; $rank = $row["rank"]; $badges = $row["badges"]; } include "ExcelXMLParser.php"; $ExcelXMLParser = new ExcelXMLParser(); $result = $ExcelXMLParser->openWorkbook("sample.xml",array()); $StartWork = array("D3"=>"$name","D9"=>"$name","D10"=>"$name","D11"=>"$name","D12"=>"$name","D13"=>"$name","D14"=>"$name"); $TimeOutLunch = array("E8"=>"12:00 PM","E9"=>"11:59 AM","E10"=>"12:01 PM","E11"=>"11:00 AM","E12"=>"01:00 PM","E13"=>"01:30 PM","E14"=>"02:00 PM"); $TimeInLunch = array("F8"=>"12:30 PM","F9"=>"01:00 PM","F10"=>"01:01 PM","F11"=>"02:00 PM","F12"=>"02:15 PM","F13"=>"01:54 PM","F14"=>"02:40 PM"); $EndWork = array("G8"=>"06:00 PM","G9"=>"07:32 PM","G10"=>"05:30 PM","G11"=>"06:54 PM","G12"=>"04:30 PM","G13"=>"06:12 PM","G14"=>"06:01 PM"); if(!ExcelXMLError::isError($result)){ /* get the document properties for this excel files */ $Author = $ExcelXMLParser->Workbook->Document->getProperty("Author"); $LastAuthor = $ExcelXMLParser->Workbook->Document->getProperty("LastAuthor"); $Created = $ExcelXMLParser->Workbook->Document->getProperty("Created"); $Company = $ExcelXMLParser->Workbook->Document->getProperty("Company"); $Version = $ExcelXMLParser->Workbook->Document->getProperty("Version"); $ExcelXMLParser->Workbook->setActiveSheet(0); $ExcelXMLParser->Workbook->setFirstVisibleSheet(0); /* set a particular cell value */ $Ws =& $ExcelXMLParser->Workbook->getWorksheetByName("1-26-2003"); $Cl =& $Ws->Table->getCellByAddress("D3"); $Cl->setValue("Andrew Aculana"); /* lets traverse our workbook, starting from the first worksheet */ $Worksheet =& $ExcelXMLParser->Workbook->getFirstWorksheet(); while($Worksheet){ $Row =& $Worksheet->Table->getFirstRow(); while($Row){ $Cell =& $Row->getFirstCell(); while($Cell){ $CellAddress = $Cell->getCellAddress(); if(in_array($CellAddress,array_keys($StartWork))){ $Cell->setValue($StartWork[$CellAddress]); } if(in_array($CellAddress,array_keys($TimeOutLunch))){ $Cell->setValue($TimeOutLunch[$CellAddress]); } if(in_array($CellAddress,array_keys($TimeInLunch))){ $Cell->setValue($TimeInLunch[$CellAddress]); } if(in_array($CellAddress,array_keys($EndWork))){ $Cell->setValue($EndWork[$CellAddress]); } $Cell =& $Row->getNextCell(); } $Row =& $Worksheet->Table->getNextRow(); } $Worksheet =& $ExcelXMLParser->Workbook->getNextWorksheet(); } $result = $ExcelXMLParser->SaveWorkbook("sample.xls",true); if(ExcelXMLError::isError($result)){ $result->raiseError(); } }else{ $result->raiseError(); die('x'); } ?>
  8. is this correct way to delete from server? <?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['id'])) { 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.php"; // Place Session variable 'id' into local variable $userid = $_SESSION['id']; // Query member data from the database and ready it for display $sql = mysql_query("SELECT * FROM members WHERE userid='$userid' LIMIT 1"); while($row = mysql_fetch_array($sql)){ $name = $row["name"]; $phone = $row["phone"]; $username = $row["username"]; $address = $row["address"]; $city = $row["city"]; $state = $row["state"]; $zip = $row["zip"]; $cell = $row["cell"]; $email = $row["email"]; $accounttype = $row["accounttype"]; $rank = $row["rank"]; $badges = $row["badges"]; $userid = $row["userid"]; } ?> <?php include_once "connect_to_mysql.php"; // if no id is specified, list the available articles $query = "SELECT image, event, name, id, site, pic_id FROM pictures where id='".$_GET['id']."'"; $result = mysql_query($query) or die('Error : ' . mysql_error()); // create the article list while($row = mysql_fetch_array($result, MYSQL_NUM)) { list($image, $event, $name, $id, $site, $pic_id) = $row; $content .= "<input name=\"check[]\" type=\"checkbox\" value=$pic_id /><img src='/$image' width='190' height='150'/></a><br /> ";} ?> <?php include_once "connect_to_mysql.php"; // if no id is specified, list the available articles $query = "SELECT image, event, name, id, site, pic_id FROM pictures GROUP BY event"; $result = mysql_query($query) or die('Error : ' . mysql_error()); // create the article list while($row = mysql_fetch_array($result, MYSQL_NUM)) { list($image, $event, $name, $id, $site, $picid) = $row; $content1 .= "<option value=\"$id\">$event </option></li>"; } ?> <?php if (isset($_POST['delete_images'])) { if(is_array($_POST['check'])) { $ids = implode(',', $_POST['check']); $q = "DELETE FROM pictures WHERE pic_id IN($ids)";$sql = mysql_query($q) or die("Problem with the query: $q<br>" . mysql_error()) ; } if(is_file("$image")) { unlink("$image"); } } ?> <!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> </head> <body> <form action="picsman.php" method="get"> <select name="id"> <?php echo $content1; ?> </select> <input type="submit" name="select" id="select" value="Select Event" /> </form> <form action="picsman.php" method="post"> <?php echo $content; ?> <?php if (isset($_GET['id'])) { ?> <input type="submit" name="delete_images" value="delete images" /></form> <?php } ?> </body> </html>
  9. it wouldn't work, anything else?
  10. Anybody help me at all?????? :confused: :confused:
  11. oh, sorry, I thought you had just forgot to put it in.
  12. so now I changed it to this...... <?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['id'])) { 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.php"; // Place Session variable 'id' into local variable $userid = $_SESSION['id']; // Query member data from the database and ready it for display $sql = mysql_query("SELECT * FROM members WHERE userid='$userid' LIMIT 1"); while($row = mysql_fetch_array($sql)){ $name = $row["name"]; $phone = $row["phone"]; $username = $row["username"]; $address = $row["address"]; $city = $row["city"]; $state = $row["state"]; $zip = $row["zip"]; $cell = $row["cell"]; $email = $row["email"]; $accounttype = $row["accounttype"]; $rank = $row["rank"]; $badges = $row["badges"]; $userid = $row["userid"]; } ?> <?php include_once "connect_to_mysql.php"; // if no id is specified, list the available articles $query = "SELECT image, event, name, id, site, pic_id FROM pictures where id='".$_GET['id']."'"; $result = mysql_query($query) or die('Error : ' . mysql_error()); // create the article list while($row = mysql_fetch_array($result, MYSQL_NUM)) { list($image, $event, $name, $id, $site, $pic_id) = $row; $content .= "<input name=\"check[]\" type=\"checkbox\" value=$pic_id /><img src='/$image' width='190' height='150'/></a><br /> ";} ?> <?php include_once "connect_to_mysql.php"; // if no id is specified, list the available articles $query = "SELECT image, event, name, id, site, pic_id FROM pictures GROUP BY event"; $result = mysql_query($query) or die('Error : ' . mysql_error()); // create the article list while($row = mysql_fetch_array($result, MYSQL_NUM)) { list($image, $event, $name, $id, $site, $picid) = $row; $content1 .= "<option value=\"$id\">$event </option></li>"; } ?> <?php if (isset($_POST['delete_images'])) { if(is_array($_POST['check'])) { $ids = implode(',', $_POST['check']); echo '<pre>'; print_r($_POST['check']); echo '</pre>'; $q = "DELETE FROM pictures WHERE pic_id = IN($ids)";$sql = mysql_query($q) or die("Problem with the query: $q<br>" . mysql_error()) ; } } ?> <!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> </head> <body> <form action="picsman.php" method="get"> <select name="id"> <?php echo $content1; ?> </select> <input type="submit" name="select" id="select" value="Select Event" /> </form> <form action="picsman.php" method="post"> <?php echo $content; ?> <input type="submit" name="delete_images" value="delete images" /></form> </body> </html> but now I get: Array ( [0] => 11 [1] => 12 ) Problem with the query: DELETE FROM pictures WHERE pic_id = IN(11,12) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IN(11,12)' at line 1
  13. it has something to do with this......I changed checkbox to text and it is empty......how could I fix this?\ $content .= "<input name=\"check[]\" type=\"text\" value='".$row['pic_id']."' /><img src='/$image' width='190' height='150'/></a><br /> ";}
  14. so how do I get this to work?
  15. like this? Array ( [0] => ) DELETE FROM pictures WHERE pic_id = IN() (that what it gave me.
  16. what does this do then? $ids = implode(',', $_POST['check']);
  17. so how do i make ids present? that was a piece wildteen gave me.
  18. what would this do???????
  19. here is what I have now: <?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['id'])) { 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.php"; // Place Session variable 'id' into local variable $userid = $_SESSION['id']; // Query member data from the database and ready it for display $sql = mysql_query("SELECT * FROM members WHERE userid='$userid' LIMIT 1"); while($row = mysql_fetch_array($sql)){ $name = $row["name"]; $phone = $row["phone"]; $username = $row["username"]; $address = $row["address"]; $city = $row["city"]; $state = $row["state"]; $zip = $row["zip"]; $cell = $row["cell"]; $email = $row["email"]; $accounttype = $row["accounttype"]; $rank = $row["rank"]; $badges = $row["badges"]; $userid = $row["userid"]; } ?> <?php include_once "connect_to_mysql.php"; // if no id is specified, list the available articles $query = "SELECT image, event, name, id, site, pic_id FROM pictures where id='".$_GET['id']."'"; $result = mysql_query($query) or die('Error : ' . mysql_error()); // create the article list while($row = mysql_fetch_array($result, MYSQL_NUM)) { list($image, $event, $name, $id, $site, $pic_id) = $row; $content .= "<input name=\"check[]\" type=\"checkbox\" value='".$row['pic_id']."' /><img src='/$image' width='190' height='150'/></a><br /> ";} ?> <?php include_once "connect_to_mysql.php"; // if no id is specified, list the available articles $query = "SELECT image, event, name, id, site, pic_id FROM pictures GROUP BY event"; $result = mysql_query($query) or die('Error : ' . mysql_error()); // create the article list while($row = mysql_fetch_array($result, MYSQL_NUM)) { list($image, $event, $name, $id, $site, $picid) = $row; $content1 .= "<option value=\"$id\">$event </option></li>"; } ?> <?php if (isset($_POST['delete_images'])) { if(is_array($_POST['check'])) { $ids = implode(',', $_POST['check']); $q = "DELETE FROM pictures WHERE pic_id IN($ids)";$sql = mysql_query($q) or die("Problem with the query: $q<br>" . mysql_error());} } ?> <!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> </head> <body> <form action="picsman.php" method="get"> <select name="id"> <?php echo $content1; ?> </select> <input type="submit" name="select" id="select" value="Select Event" /> </form> <form action="picsman.php" method="post"> <?php echo $content; ?> <input type="submit" name="delete_images" value="delete images" /></form> </body> </html> but now I get this error...... Problem with the query: DELETE FROM pictures WHERE pic_id IN() You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1
  20. thats what I was given by somebody, I hadn't thought it was.
  21. ok, so here is some new code with added pieces: <?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['id'])) { 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.php"; // Place Session variable 'id' into local variable $userid = $_SESSION['id']; // Query member data from the database and ready it for display $sql = mysql_query("SELECT * FROM members WHERE userid='$userid' LIMIT 1"); while($row = mysql_fetch_array($sql)){ $name = $row["name"]; $phone = $row["phone"]; $username = $row["username"]; $address = $row["address"]; $city = $row["city"]; $state = $row["state"]; $zip = $row["zip"]; $cell = $row["cell"]; $email = $row["email"]; $accounttype = $row["accounttype"]; $rank = $row["rank"]; $badges = $row["badges"]; $userid = $row["userid"]; } ?> <?php include_once "connect_to_mysql.php"; // if no id is specified, list the available articles $query = "SELECT image, event, name, id, site, pic_id FROM pictures where id='".$_GET['id']."'"; $result = mysql_query($query) or die('Error : ' . mysql_error()); // create the article list while($row = mysql_fetch_array($result, MYSQL_NUM)) { list($image, $event, $name, $id, $site, $pic_id) = $row; $content .= "<input name=\"check[]\" type=\"checkbox\" value='".$row['pic_id']."' /><img src='/$image' width='190' height='150'/></a><br /> ";} ?> <?php include_once "connect_to_mysql.php"; // if no id is specified, list the available articles $query = "SELECT image, event, name, id, site, pic_id FROM pictures GROUP BY event"; $result = mysql_query($query) or die('Error : ' . mysql_error()); // create the article list while($row = mysql_fetch_array($result, MYSQL_NUM)) { list($image, $event, $name, $id, $site, $picid) = $row; $content1 .= "<option value=\"$id\">$event </option></li>"; } ?> <?php if (isset($_POST['delete_images'])) { if(is_array($_POST['check'])) { $ids = implode(',', $_POST['check']); $q = "DELETE * FROM pictures WHERE pic_id = IN($ids)"; $sql = mysql_query($q) or die("Problem with the query: $q<br>" . mysql_error());} } ?> <!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> </head> <body> <form action="picsman.php" method="get"> <select name="id"> <?php echo $content1; ?> </select> <input type="submit" name="select" id="select" value="Select Event" /> </form> <form action="picsman.php" method="post"> <?php echo $content; ?> <input type="submit" name="delete_images" value="delete images" /></form> </body> </html> but even with that code or the unmodified code that I was given, I get...... Problem with the query: DELETE * FROM pictures WHERE pic_id = IN() You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '* FROM pictures WHERE pic_id = IN()' at line 1
  22. Wold that delete all the pictures that I select????? Also how do I delete from server???
  23. so here is entire code: <?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['id'])) { 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.php"; // Place Session variable 'id' into local variable $userid = $_SESSION['id']; // Query member data from the database and ready it for display $sql = mysql_query("SELECT * FROM members WHERE userid='$userid' LIMIT 1"); while($row = mysql_fetch_array($sql)){ $name = $row["name"]; $phone = $row["phone"]; $username = $row["username"]; $address = $row["address"]; $city = $row["city"]; $state = $row["state"]; $zip = $row["zip"]; $cell = $row["cell"]; $email = $row["email"]; $accounttype = $row["accounttype"]; $rank = $row["rank"]; $badges = $row["badges"]; $userid = $row["userid"]; } ?> <?php include_once "connect_to_mysql.php"; // if no id is specified, list the available articles $query = "SELECT image, event, name, id, site FROM pictures where id='".$_GET['id']."'"; $result = mysql_query($query) or die('Error : ' . mysql_error()); // create the article list while($row = mysql_fetch_array($result, MYSQL_NUM)) { list($image, $event, $name, $id, $site) = $row; $content .= "<input name=\"check[]\" type=\"checkbox\" value='".$row['id']."' /><img src='/$image' width='190' height='150'/></a><br /> ";} ?> <?php include_once "connect_to_mysql.php"; // if no id is specified, list the available articles $query = "SELECT image, event, name, id, site FROM pictures GROUP BY event"; $result = mysql_query($query) or die('Error : ' . mysql_error()); // create the article list while($row = mysql_fetch_array($result, MYSQL_NUM)) { list($image, $event, $name, $id, $site) = $row; $content1 .= "<option value=\"$id\">$event </option></li>"; } ?> <?php if ($_POST[submit]){ foreach ($_POST[check] as $key => $value) { $checkup = $_POST['check'][$key]; $q = "DELETE * FROM pictures WHERE id ='".$row['id']."'"; $sql = mysql_query($q) or die("Problem with the query: $q<br>" . mysql_error());} } ?> <!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> </head> <body> <form action="picsman.php" method="get"> <select name="id"> <?php echo $content1; ?> </select> <input type="submit" name="select" id="select" value="Select Event" /> </form> <form action="picsman.php" method="post"> <?php echo $content; ?> <input type="submit" value="delete images" /> </form> </body> </html> It is not deleting anything so could you please help me?
×
×
  • 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.