Jump to content

premiso

Members
  • Posts

    6,951
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by premiso

  1. preg_match would be the way to do it: <?php $string = "Bob says to you 'hello'"; preg_match("~([A-Z0-9]+?) .* '([A-Z0-9]+?)'~i", $string, $matches); print_r($matches); ?> See my signature for references for Regular Expression Syntax.
  2. You need it in ASC order? Well you can always store the end results in an array and rsort the array: SELECT * FROM table ORDER BY field DESC LIMIT 10 Should get you what you want, you will just have to manipulate the data when PHP has it.
  3. Yea, it looks like you have to do that all by command line. Weird, never used it before http://winscp.net/eng/index.php Might be more up your ally.
  4. Add this to the top of your page: <?php error_reporting(E_ALL); ini_set("display_errors", 1); If there are any errors (my bet is that "Output already Sent" error) then it will display them. If it is the output already sent, you cannot have any output (not even a whitespace at the top before <?php) to the browser before you call a header, as once output has been sent you are already in the body.
  5. Search for SSHFTP there are plenty of free programs (PuTTY being one) that allow you to connect to SSH like it was your FTP server.
  6. You have a space in between DATE TIME on this line: pd_last_update DATE TIME NOT NULL It should be DATETIME.
  7. Not exactly sure if this is what you are asking but here it is: http://www.clockwatchers.com/mysql_dump.html
  8. strtotime would be the key: <?php $time = strtotime("January 10, 2010"); echo date('m-d-Y', $time); ?>
  9. The best way is to use them when needed, you can over function a program. But really there is no "standard" for writing functions. It is more or less to get rid of redundant code, so if say you need to constantly grab data for different ID's you can make a grabData(ID) function which grabs the data for a specific ID, etc. But if you have specific ideas, why not share what you are thinking and attempt to write one for what you are thinking and ask for that to be critiqued.
  10. It looks alright, except that I am viewing it on my laptop and have to scroll right to see it all. Just incase that is not what you are asking about here is my take: The portfolio and about me are kind of a deterrence, but if it is just a title page, that is fine. The colors seem to work well, the only part I may change is the text under your domain: Home of... I would probably get rid of that altogether. But all in all I think it looks decent.
  11. IonCube is a popular php encryption software, it costs money and requires servers to have their software on them for the code to be able to run: http://www.ioncube.com The other option is to look up and see if there are any other alternatives for encrypting php files. Here is a list of different encryption options: http://www.seocompany.ca/software/free-encryption-software.html Hope that helps.
  12. If you changed urls make sure you do 301 redirects from the old url to the new one. Other then that you can re-submit it, but most web crawlers will re-search your site once a week depending on how popular it is, just make sure you have a site index and that it is on every page so it gets crawled with the new data / changes.
  13. I am not sure if this is a valid header: "Content-Type: {text/html; charset=iso-8859-1};\n" . I think you should remove the { } and see if that works. It may be ok, but I have never seen it done that way before.
  14. When you create the table you can set it to be "NOT NULL" which means the field is required. But if that attribute is not set, yes it is very normal unless you set a DEFAULT value to the column, at which the default value should be in that place. For more information on the Null character see this wiki page
  15. It all depends on your needs. Windows costs a bit more then Linux (depending on the linux distro it may be free). Linux tends to be a bit more secure then windows. So the real question is, what are you needs? Do you need to be free? Or are you willing to spend the money on a Windows Machine. As far as I know Apache runs great on both, so either way it should work well for you.
  16. You can do this a few different ways, one is using explode to parse the data you want and the other is using preg_match_all to find an expression to get the data you want and put it into an array. Look into those and give it a shot.
  17. echo "<a href=\"$url{$post[1]}\" target=\"_blank\">{$post[2]}<font size=\"3\">{$post[3]}</a><br />";
  18. Since ' surrounds values in MySQL you have to escape strings going into MySQL, this will coincidently also prevent from SQL injections: $sitedetails = "INSERT INTO vars (address, sitename, description, ownername, theme) VALUES ('" . mysql_real_escape_string($url) . "', '" . mysql_real_escape_string($sitename) . "', '" . mysql_real_escape_string($description) . "', '" . mysql_real_escape_string($ownername) . "', '" . mysql_real_escape_string($theme) . "') "; mysql_real_escape_string will prevent from SQL injection and errors resulting in ' being input into the database.
  19. I do not see the error in the code you posted, perhaps the error is else where?
  20. Chances are the directory is wrong or empty. What is the full path to the directory from the root directory, try using that. Basically what that means is that it never enters the foreach loop, which could be the above, no folders or wrong directory.
  21. Add this to your script: <?php error_reporting(E_ALL); ini_set("display_errors", 1); foreach (glob("/newsa/testpdf/", GLOB_ONLYDIR) as $dir) { $folder = explode("/", $dir); $folder = $folder[count($folder)-1]; echo $folder . "<br />"; foreach (glob($dir . "/*.pdf") as $file) { $file = basename($file); echo "<a href='$file'>$file</a><br />"; } } ?> See what the error says (if any).
  22. What is the error message being returned?
  23. My mistake, I put the code in wrong: foreach (glob($dir . "/*.pdf") as $file) Should get you correct results.
  24. if (($width_orig < $width) || $height_orig < $height) { return imagecreatefromjpeg($filename); } $ratio_orig = $width_orig/$height_orig; Insert that in there and it should just return the regular image as long as I got my logic correct.
  25. You cannot use a number for a variable name. You can do $a1, but not $1 or $1a.
×
×
  • 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.