Jump to content

rhodesa

Staff Alumni
  • Posts

    5,253
  • Joined

  • Last visited

Everything posted by rhodesa

  1. whenever you are debugging mysql_query() you should do it in the form of: $results = mysql_query($query, $link) or die(mysql_erryr($link)); it will provide useful info on what you are doing wrong. on that note, UPDATEs are not the same as INSERTs: http://dev.mysql.com/doc/refman/5.1/en/update.html $query = "UPDATE castack SET "; $query .= "`name` = '$name', `username` = '$username1', `imagelocation` = '$imagelocation' WHERE id=$id";
  2. if you want a double column like that, there really is no "better" solution
  3. first...please don't double post as far as i know, you can only modify the color
  4. Double post...topic is over here: http://www.phpfreaks.com/forums/index.php/topic,267846.0.html
  5. do you already have a user login system in place? cus while you could track this with cookies, it would be best if the user was logged in
  6. it's because you are floating your DIVs...the first two divs "Audit & Assurane Services" and "Tax" are on the first line, then the next div wont fit, so it's moved to a new line...below the first two divs
  7. if the site is a dynamic cms, where all URLs are are mod_rewrite to an index.php file, you can probably add something there. but if they are static pages, you will want to use .htaccess to setup a custom 404 page that is a php script...and in that script you can send an email to an admin Custom 404: http://www.pageresource.com/zine/custom404.htm But have the page it points to be a PHP script...in that script you can use mail() to send you the values of $_SERVER['REQUEST_URI'] and $_SERVER['HTTP_REFERER']
  8. there are a hundred different things that can cause that...can you past a direct link to the page? or at least the HTML code from it?
  9. if you update this line: $result = @mysql_query ($query) or die ("MySQL Error: ".mysql_error()); it will give you info on what is wrong...to fix the problem, i think this is what you need: $query = "SELECT * FROM hunt_info WHERE huntStatus = '$key' AND username = '$username' ORDER BY date_of_hunt DESC";
  10. the lock is released as soon as the script ends...even if the user cancels the download ...one other note...you will end up with a folder FULL of lock files (one for every IP that has ever downloaded). you may want to write a script that goes through and cleans up those files (although, they are empty...so they won't take up much space at all)
  11. Download it from here: http://sourceforge.net/projects/nusoap/ There are sample files in it
  12. so sessions are used for tracking information while a user is visiting your site...great for logins, etc. but what if you want a URL someone can use to uniquely identify a user's profile? enter GET...it would look like so: <?php if(!$_GET['user']){ die("User not found"); mysql_connect("***","***","***") or die ("Couldn't connect"); mysql_select_db("***") or die ("Couldn't find db"); $user = mysql_real_escape_string($_GET['user']); mysql_query("SELECT image FROM profile WHERE username='$user'"); ?> and the url for this profile would be something like: http://www.yourserver.com/profile.php?user=someusername
  13. well...if you are using placeholders like described above, you can just use str_replace() to find/replace the values. personally, i would use Smarty though...which is a PHP Templating engine...but it might be a little bit more then you want to get into. for str_replace()...you first need to collect all your data and have that ready...then load up the template (either from a form or from something in your db)...then it's just str_replace() on the template code for each of the placeholders
  14. use NULL: mysql_query("INSERT INTO $table VALUES (NULL, '$name', '$age', '$email')");
  15. yup, you can read it from the session...but a user will only be able to see their own profile that way. for the ability to see other people's profiles, you will need to use GET so, the template is as dynamic as you want it to be. if you have info for a background color for that user stored in the database, you can select it from the db then do: <div style="background:<?php echo $color;?>;"> and so on....
  16. ok...why does rel matter here...why can't you just use something like <p rel='address1'>%ADDRESS%</p> and then find/replace on the string "%ADDRESS%"?
  17. Is the HTML file they are uploading the template and you will insert data into it? Or is the person uploading an HTML file with data in it that you will extract and put into a template that is already on your server?
  18. you need some way of knowing which user's page to display...i would say the most common way is with a GET variable...so the URL would look like: http://www.yourserver.com/profile.php?user=someusername then, in the profile.php script, you can access someusername via $_GET['user']. from this point, you can branch out in several directions depending on where in the info is for that user (database most likely)
  19. $_COOKIE get's set when the script initiates...so after using setcookie(), $_COOKIE doesn't update (until the page reloads). after you set the cookie, just set a variable like $safe and then use: if(isset($_COOKIE['username']) || $safe)
  20. without knowing what the user is uploading it's pretty hard to write. can you give an example of what would be uploaded and what you would want parsed out of it?
  21. write a wrapper script for downloading files...let's call it download.php...and have all downloaded files go through there (this is a pretty common thing, let me know if that part is confusing) then, in your download script, before you give them the file, open a read handle on their IP address in some temp folder: $lck = fopen($_SERVER['REMOTE_ADDR'],'r+'); then, open an exclusive lock on that file: flock($lck, LOCK_EX); next, serve up the file finally, close the file handle to free up the lock fclose($lck); with the exclusive lock, any subsequent requests from the same IP (aka trying to lock the same file) will wait for the first request to finish. obviously, the person could still spoof their IP though
  22. you will learn soon that parsing HTML is not an easy task. if everything was perfectly coded, you could use XML libraries to do exactly what you want...but as soon as someone forgets to close a tag or has something out of order at all...the entire block of HTML is unreadable. for that reason, most people end up parsing it with commands like preg_match(). this allows you to set a matching pattern to look for. finding a single item like a <a> tag is pretty straight forward...but it gets complicated when you have nested elements
  23. the code should be like this: <?php function getEmails() { global $host,$username,$password,$db_name,$tbl_name; $tbl_name="emails"; // Table name ob_start(); // Connect to server and select databse. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $emails = array(); $sql="SELECT * FROM $tbl_name"; $result=mysql_query($sql); while($row = mysql_fetch_array($result)){ $emails[] = $row[0]; } mysql_close(); return $emails; } ?> <?php include_once('functions.php'); foreach(getEmails() as $email){ echo $email; echo "<br />"; } ?> what is the name of the column in the emails table that you are trying to extract from...i assumed it was called 'email'
  24. you can't force it to have leading zeros in the DB...cus it's an integer and integers don't have leading zeros. but you can add the leading zeros when you display the number: <?php $id = 5; print str_pad($id,5,'0',STR_PAD_LEFT); //or printf('%05d',$id); ?>
×
×
  • 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.