Jump to content

GingerRobot

Staff Alumni
  • Posts

    4,082
  • Joined

  • Last visited

Everything posted by GingerRobot

  1. Doesn't sound like an impossible task. Before i have a go though, i wonder - is this problem still open? I see you made the thread in April. If it is, could you perhaps show an example of the robot code. Might make it a touch easier to solve
  2. Im going to guess that maybe it should be: $zinja = str_replace( "", "<img src='/bildes/smile.gif'>,", $rrr['zinja'] );
  3. Well as far as i can see, you are repeating the code to get your data from the database 3 times. The first two times you attempt to use the username, and do nothing with the result. The 3rd time you use the id. I would guess that you only need: <?php session_start(); ?> <!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=iso-8859-1" /> <title>Minispace - Viewing Profile: <?php echo $rows['username']; ?></title> <link rel="stylesheet" href="css/stylesheet.css" /> <?php include ('includes/general.php'); ?> </head> <?php include('includes/mysql_connect_users.php'); // Connect to server and select databse. mysql_connect("$location", "$mysqlusername", "$mysqlpassword")or die("cannot connect"); mysql_select_db("$database")or die("cannot select DB"); // get value of id that sent from address bar $id = $_GET['id']; $sql2="SELECT * FROM users WHERE `id`='$id'"; $result=mysql_query($sql2); $rows=mysql_fetch_array($result); ?> <table width="86%" border="1" align="center"> <tr> <td height="26" class="headerback"><?php echo $site_name; ?></td> </tr> <tr> <td class="topnav" height="5"><a href="index.php" class="style2">Home</a> | <a href="members.php">Members</a> | <a href="forum/index.php">Forum</a> | <a href="faq.php">FAQ</a> | <a href="view_user.php">Profile</a> | <?php if (!isset($_SESSION['username']) == false) echo "<a href='logout.php'>Logout</a>"; else{ echo "<a href='login.php'>Login</a> | <a href='register.php'>Register</a>"; }?></td> </tr> <tr> <td class="siteback1"><div align="left" class="username">Viewing Profile: <?php echo $rows['username']; ?></div> <table width="310" border="0"> <tr> <td width="408"><div id='piclayout2'><img src='images/no_pic.gif' width='106' height='90' /></div> <?php if (!isset($_SESSION['username']) == false) echo "<div align='right' style='padding-right:20px'> <p><a href='profile_edit.php' style='color:#000099'>Edit Profile</a></p> <p><a href='account_settings.php' style='color:#000099'>Account Settings</a> </p> <p><a href='manage_images.php' style='color:#000099'>Manage Images</a> </p> <a href='manage_blog.php' style='color:#000099'>Manage Blog</a><br /> </div><div align='left' style='padding-left:45px'><strong>View My:</strong><br /></div> <div align='left' style='padding-left:35px'> <a href='view_user.php?id=".$rows['id']."' style='color:#000099'>Profile</a> | <a href='view_pics.php?user=".$rows['username']."' style='color:#000099'>Pics</a> | <a href='view_blog.php?user=".$rows['username']."' style='color:#000099'>Blog</a><br /> <a href='view_friends.php?user=".$rows['username']."' style='color:#000099'>Friends</a> | <a href='view_comments.php?user=".$rows['username']."' style='color:#000099'>Profile</a></div><br/><br/> <div align='left' style='padding-left:8px'><strong>My Profile Url:</strong> <a href='view_user.php?id=".$rows['id']."' style='color:#000099'>mysite/view_user.php?id=".$rows['id']."</div>"; else{ echo "<br/><div align='right' style='padding-right:80px'> <p>".$rows['age']." Years Old</p> <p>".$rows['gender']."</p> </div><br/><br/> <table width='100' border='1'> <tr> <td align='center'> Contacting, ".$rows['username']." </td> </tr> <tr> <td style='padding-right:15px'> <img src='images/msn-icon.gif'> MSN: ".$rows['msn']."<br/><br/> <img src='images/imaim.png'> AOL IM: ".$rows['aolim']."<br/><br/> <img src='images/icon_yim.gif'> YAHOO IM: ".$rows['yim']."<br/><br/> </td> </tr> </table>"; }?> </td> </tr> </table> <p> </p></td> </tr> </table><br /> <br /><div align="center"><?php echo $copyright; ?></div>
  4. Well it looks to me like you're missing a crucial part of the query. You're selected all of the data from your users table, not just that for one person. $sql="SELECT * FROM users WHERE `id`='$id'"; or maybe: $sql="SELECT * FROM users WHERE `username`='$username'"; From the comments, it looks as if the intention was to get a user's id from the url: // get value of id that sent from address bar But this doesn't appear to be done anywhere. You'll need to take a look at the links to the profile page, and see what the variable in the url string is. If, for example, the links are something like: <a href="viewprofile.php?userid=$id">, then on your profile page you'll need to have: $id = $_GET['userid'];
  5. I see what you mean, but given the context of the table, aren't to and from the most appropriate names for the fields? It seems a whole stack easier to put backticks around the words than change the to msgto and msgfrom to me. Guess thats just personal opinion though.
  6. Just took a quick look at the source on the page you uploaded and found: <span id="s0">This is the latest post</span> <div id="div0" class="off"> Hello world</div> <div class="container"> <span id="s0">Title HERE</span> <div id="div0" class="off"> this is the body of the post. this is the body of the post. this is the body of the post. this is the body of the post. this is the body of the post. this is the body of the post. this is the body of the post. this is the body of the post. this is the body of the post. this is the body of the post. this is the body of the post. this is the body of the post. this is the body of the post. this is the body of the post. this is the body of the post.</div> <div class="container"> <span id="s0">fred</span> <div id="div0" class="off"> bloggs</div> All of the IDs are div0 or s0. Im assuming those numbers where supposed to be incremented. In which case, try: <?php $x = 0; if (mysql_num_rows($result) > 0) { // Itterate through result set // Print news items while($row = mysql_fetch_object($result)) { ?> <div class="container"> <span id="s<?php echo $x; ?>"><?php echo $row->news_title; ?></span> <div id="div<?php echo $x; ?>" class="off"> <?php echo $row->news_body; ?> </div> <?php $x++; } } ?>
  7. Andy, just out of interest - why is using backticks a sloppy way? Personally i find queries so much easier to read if all the names of tables/fields etc are enclosed in backticks and all values enclosed in single quotes.
  8. Well, surely it must be a case that you havn't passed all of the variables for the function when you call it? Can we see line 160 from resize_only.php?
  9. You say it returns no errors, but do you actually check? You should do: mysql_query("DELETE FROM messages WHERE to=2") or die(mysql_error());
  10. You'll need to use cURL for this. Google curl and php.
  11. I just took a quick look, but im guessing it is to do with supergobals. You'll probably find that on your local server, register_globals is on, whilst on your host it is off. You'll need to retrieve all of your get, post, session data from their respective arrays. For example: $pageid = $_GET['pageid'];
  12. Whoops, not quite sure why i put an and in there. Glad to hear it worked.
  13. You need to echo the variables: <option value="<?php echo $today; ?>"> Today </option> <option value="<?php echo $tomorrow; ?>"> Tomorrow </option>
  14. I think all you need to do is switch the single quotes to double quotes on this line: echo 'Click for profile to view this page'; php parses anything thats being echoed that is in double quotes, but not in single quotes.
  15. So it did the week end dates correctly? The technician column was wrong? what was wrong with it exactly? And the hours column was completely missing?
  16. Hmm, i wonder if something like this: <?php include_once "../connection.php"; $select = "SELECT `tech_pay_week_ending_date`, `tech_id` and `tech_pay_week_hours` FROM MTES_tech_pay_weeks WHERE week_ending_date = '$_POST[week_ending_date]'"; $export = mysql_query($select) or die(mysql_error()); //$fields = mysql_num_fields($export); //for ($i = 0; $i < $fields; $i++) { // $header .= mysql_field_name($export, $i) . "\t"; //} $header = "Week Ending Date \t Technician \t Total Hours \t"; // while($row = mysql_fetch_assoc($export)){ $line = ''; $query = mysql_query("SELECT fname, lname FROM users WHERE userid = '$row[tech_id]'") or die(mysql_error()); $fname = mysql_result($query,0,'fname'); $lname = mysql_result($query,0,'lname'); $row['tech_id'] = $fname.' '.$lname; $row['tech_pay_week_ending_date'] = date('F j, Y', strtotime($row[tech_pay_week_ending_date])); foreach($row as $value) { if ((!isset($value)) OR ($value == "")) { $value = "\t"; } else { $value = str_replace('"', '""', $value); $value = '"' . $value . '"' . "\t"; } $line .= $value; } $data .= trim($line)."\n"; } /* while($row = mysql_fetch_row($export)) { $line = ''; foreach($row as $value) { if ((!isset($value)) OR ($value == "")) { $value = "\t"; } else { $value = str_replace('"', '""', $value); $value = '"' . $value . '"' . "\t"; } $line .= $value; } $data .= trim($line)."\n"; } */ $data = str_replace("\r","",$data); if ($data == "") { $data = "\n(0) Records Found!\n"; } header("Content-type: application/x-msdownload"); header("Content-Disposition: attachment; filename=vaspna_time_sheets.xls"); header("Pragma: no-cache"); header("Expires: 0"); print "$header\n$data"; ?> Would work. Ive never exported anything to excel, so ive tried to keep it as similar as possible to the original. But it looks to me like the headers was jsut a tab delimited list, so that should be easy enough. The rest is a bit of a guess, but give it a go.
  17. I suggest you look into the uses of the GD library in php. Hopefully this tutorial might get you started: http://www.phpfreaks.com/tutorials/105/0.php
  18. Yes, register_globals is generally a bad thing - it can cause all sorts of security issues. There's a bit of information about it here: http://uk2.php.net/register_globals and here: http://uk3.php.net/reserved.variables
  19. Yeah, that is normal. There is a setting in php to allow the short open tags (<?) - in php5 this is disabled by default. Looks to me like the rest of the problems are caused by a setting called register_globals. Again, in php5, this is turned off by default. If you add in the following at the top of your file: <?php session_register("GlimpseDir"); //this is the bit to add $action = $_GET['action']; $userfile = $_POST['userfile']; $upload = $_POST['upload']; $mkdirfile = $_POST['mkdirfile']; $mkdir = $_POST['mkdir']; //end of stuff to add ?> What register_globals does, is automatically create variables for all of those in the post/get/session data etc. So, if your url was: http://www.example.com/index.php?foo=bar Then with register_globals on, you could access the value of foo (which in this case is bar) with the variable $foo. With it off, you use $_GET['foo']
  20. It all depends on which files you want to be affected by the .htaccess file. If you want all the files on your host to be affected, it wants to be in the root directory. If the .htaccess file is only for stuff in one particular directory, you want it in that particular sub directory. Idealy, you want it to be the case where you can put it into the sub directory. Since .htaccess files are quite slow, you'll want to avoid slowing your entire site down by putting it into the root directory.
  21. Ok, first step, lets see whats actualyl being passed into the query. Change this: <?php $query = "SELECT * FROM products WHERE $_REQUEST[category] LIKE '%$_REQUEST[search]%' LIMIT $offset, $rowsPerPage"; $result = mysql_query($query) or die('Error, query failed'); ?> to: <?php $query = "SELECT * FROM products WHERE $_REQUEST[category] LIKE '%$_REQUEST[search]%' LIMIT $offset, $rowsPerPage"; $result = mysql_query($query) or die("Query failed: $query<br /><br />mysql_error()"); ?>
  22. Oh sorry, i think i got the wrong end of the stick. You do want all the HTML including videos? Just where the codes span multiple lines, they get broken up and only half of it ends up being put in your shoutbox?
  23. Im a bit confused - do you not want any HTML content in your shoutbox so you dont get videos etc in it? If so, i would suggest you remove all the HTML tags on the input to the shoutbox using strip_tags()
×
×
  • 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.