Jump to content

premiso

Members
  • Posts

    6,951
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by premiso

  1. It sounds like you are adding too many slashes when inserting the data into your database. You should not see the \r\n characters period...
  2. IP is not a good thing to ban. If a person is on a network, it will ban anyone on that network. That and proxies would get around the ban. Basically IPs are not unique to an individual.
  3. The looks right to me, although the link may have to be in the header, not sure. I would print out the source of the created HTML page and see if anything looks funky there.
  4. Well try some variations, read the glob manual. I have no clue where your script is located etc. <?php $fileListDir = "/advertise_files/1_*"; $fileList = glob($fileListDir); echo "File list inside of " . $fileListDir . "<br />"; foreach ($fileList as $fileName) { echo $fileName . "<br />"; } ?> That may work, or you may have to use other php items to get what you want like this: <?php $fileListDir = $_SERVER['DOCUMENT_ROOT'] . "/advertise_files/1_*"; $fileList = glob($fileListDir); echo "File list inside of " . $fileListDir . "<br />"; foreach ($fileList as $fileName) { echo $fileName . "<br />"; } ?> Or you may want to use relative paths. Come on and actually try some stuff for your self, who knows you may learn something by being adventurous.
  5. Use trim. $selleruser2=trim($_POST["selleruser"]);
  6. Really it is straight forward. See foreach it will iterate through the array and assign those values to $value. Basically it does a loop, but there is no guess, like with the while loop of how many array entries their are. If the value of this index of the array is 1 then you set the $otherval equal to 0. After all the elements have been looped through you check if $otherVal is not equal to 0, if it is not, that means that no element in the array equaled 1, so you set anotherVal equal to one... Should be exactly what you described in your post description. If that is now what you want, please explain exactly what is you want to do. I would also suggest reading up on array's.
  7. ummm are you serious? <?php $fileListDir = "advertise_files/1_*"; $fileList = glob($fileListDir); echo "File list inside of " . $fileListDir . "<br />"; foreach ($fileList as $fileName) { echo $fileName . "<br />"; } ?> That will display those files exactly how you requested it in the first post. glob read up on glob to modify it to your needs.
  8. <?php $testArray = array(1, 2, 3, 0); $otherVal = 1; foreach ($testArray as $key =>$value) { if ($value == 1) { $otherVal = 0; } } if ($otherVal != 0) { $anotherVal = 1; } ?> foreach will make it easier for ya.
  9. Session ends when the browser is closed. You can have a timeout set if you are using a db, if no activity in 20 minutes, set the user as logged out.
  10. foreach (glob("1_*") as $file) { echo $file . " has a 1_ in it.<br />"; }
  11. Why not just use array_search to locate if a value is one?
  12. Your question is really vague. How would someone access another site other than domain2.com? Do you have a known security hole in your code?
  13. Well I vote you give up on installing this yourself and just use WAMP for your installation then just copy the data files from mysql to the new mysql. But that is my vote. BTW, I <3 my G drive
  14. Well, you could do this: <?php function getImageName($name) { $name = pathinfo($name, PATHINFO_FILENAME); foreach (glob(strtolower($name)) as $name) { return $name; } return "Unable to find"; } ?> <TR> <TD WIDTH="180" STYLE="background-color:#B6DAF2;"><B>Image 1</B></TD> <TD> <% if($i_row['image1'] && ! substr_count($i_row['image1'],'unavailable.')) { %><IMG BORDER="0" SRC="<%= '../files/' .getImageName($i_row['image1']); %>" ALT=" " WIDTH="300"><% } %></TD> </TR> <TR> <TD WIDTH="180" STYLE="background-color:#B6DAF2;"><B>Image 2</B></TD> <TD><% if($i_row['image2'] && ! substr_count($i_row['image2'],'unavailable.')) { %><IMG BORDER="0" SRC="<%= '../files/' . getImageName($i_row['image2']); %>" ALT=" " WIDTH="300"><% } %></TD> </TR> <TR> See if that will work for you.
  15. Always have guidlines and rules for naming structure. Keep it consistent it makes it a ton easier in the long haul. If they are not doing that tell them they need to. My preference is name.cls.php if you have a classes folder. If not then I do cls.name.php but either way make that rule and have everyone obey it.
  16. <?php $files = glob('*.JPG'); foreach($files as $file){ rename($file,strtolower($file)); } ?> This would be a 1 time deal. It will make all images the lowercase .jpg. You will need to modify where the file is being uploaded and make sure it saves the file as all lowercase also. Basically save that in a .php in your images directory and run it. It should rename all images to be .jpg and consistent. Or, as flyhoney explained, if the file names are the same case, you can just pull out the filename, then remove that extension from it and use that. Although consistency between the DB and the server file system would be the ideal/best way, imo.
  17. <?php die("TESTING"); ini_set("display_errors", 1); error_reporting(E_ALL); require_once("db.php"); $name = $_SESSION['myusername']; ?> The DIE("TESTING"); will kill the script, remove that line and try it. Are you getting TESTING on that page.
  18. I make them enter their current password, incase they did a cookie hack to get in the site.
  19. <?php require_once("db.php"); $name = $_SESSION['myusername']; ?> <html> <body> <?php $shout = $_POST['shout']; $slength = strlen($shout); $maxlength = 150; Your error reporting is turned off, but the issues was you cannot call session_start after output has been sent to the browser. If it is still blank try this: <?php ini_set("display_errors", 1); error_reporting(E_ALL); require_once("db.php"); $name = $_SESSION['myusername']; ?> <html> <body> <?php $shout = $_POST['shout']; $slength = strlen($shout); $maxlength = 150; And see what the error is.
  20. rename Just loop through your database and invoke that rename from .JPG to .jpg so use the file_exists on the cap JPG if that exists rename it, else keep looping.
  21. You can use PHP to rename them on the server to be lowercase and have this done for you, shouldn't take too long to do it.
  22. Change this !count($result[$c]) To be count($result[$c]) < 1 EDIT: And if that does not work, try running the same query, with joins etc, via phpMyAdmin and see what it pulls up. There is the off chance that the query is limiting itself.
  23. You are not closing your PHP in the right spot. mysql_close($db); ?> Should fix it. I would, however, remove that mysql_close as it is not necessary. PHP Closes that connection automatically once the script is done.
  24. $Query1a = "SELECT * FROM STEPS WHERE STEPNO = ".$steps."; "; $result = mysql_query($Query1a); if (mysql_num_rows($result) < 1) { echo "{$steps} does not exist."; } mysql_num_rows
  25. Honestly, you cannot really expect people to write code for you. Especially here people like to see others actually try. There is an AJAX/JScript forum that can be searched, you can look up jQuery, which a framework that makes AJAX really nice. If you are on a time constraint, pay someone who knows how to do it. Simple as that. If you want to learn, well there are tons of examples online already made, it is a matter of finding them. Sorry if that is harsh, but that is life. If you cannot do it yourself, you either learn it or pay someone. Look into jQuery there are probably plenty of examples already made for you and it is a very nice framework. And to be honest, it is like that old story, "You give a mouse a cookie." If we write this popup code for you, next you are going to want us to show you how to get that value in php, then show you how to use that value and put it in a DB. If we did this for everyone on this site, for free none the less, no one would learn anything and we would be working for free instead of just helping. Hope you can understand that. So you know, we are always willing to help someone who is willing to try to do their own work and has code to show for it.
×
×
  • 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.