Jump to content

ldougherty

Members
  • Posts

    319
  • Joined

  • Last visited

    Never

Everything posted by ldougherty

  1. Maybe they haven't fully crawled your site. I use it on my vbulletin based site and it works to return everything I search for.
  2. Is there a reason to use file_get_contents then explode to make the array rather than just using file() from the get go?
  3. Well you could check sessions on your index page for that directory and if the session doesn't exist then prompt for a password. This of course would require you to write a full backend that would store user login information and what not. I believe the much easier idea would be to have php create/write to the .htaccess and .htpasswd files. Just use PHP functions to create the file(s) if they do not exist and if they do exist use the exec function to execute shell commands via script.
  4. Don't both, just use Google Search Bar. They crawl your entire site so you can have a search bar on your site that searches all aspects of your site itself. http://www.google.com/sitesearch/
  5. Your logic is wrong.. If all 3 answers are correct then $correct should be 3 $s1 = $correct / 3; > $s1 = 3 / 3 , so 1 $s2 = $correct * 100; > $s2 = 3 * 100, so 300 $s3 = round($correct,0); > $s3 = round(3,0); so by your logic $s3 would be 3 This is the string you should use instead. <?php include("db.php"); $a1 = $_POST[1]; $a2 = $_POST[2]; $a3 = $_POST[3]; $correct = 0; # Initialize the Variable if ($a1 == 'b'){ $correct = $correct + 1; } if ($a2 == 'b'){ $correct = $correct + 1; } if ($a3 == 'a'){ $correct = $correct + 1; } $score = round((($correct / 3) * 100),0); echo "Your score was $score"; ?>
  6. Yea, that is a better idea. I knew it could be done but couldn't put the logic together quickly
  7. Since file_get_contents stores the file content as a string you can only set it to start at a certain character. Now if you know exactly how many characters it is you want to remove from the beginning and its the same each time then you could specify this. The better option would likely be to store the file into an array using the file() function. http://us3.php.net/manual/en/function.file.php Once you have the array created you can simply remove the first 5 items in the array. http://www.w3schools.com/PHP/func_array_splice.asp Hope that helps..
  8. So, my overall questions are; 1. Why are my images not being displayed in index.php but are in mysite.com/inc/left.php? The images likely do not display because the way you are referencing the images. Think of it this way, if the image is is actually in mysite.com/inc/img/myimage.jpg and you are calling the include from mysite.com then when the include is parsed it looks for images in mysite.com/img/myimage.jpg which doesn't exist. 2. Does having images in my css as img/header.png and not mysite.com/inc/img/header.png matter? Yes, you should use full paths to your images if you intend on referencing them from other directories. 3. How do I link to the includes from the higher directories like mysite.com/example/index.php? You can either use the full path or relative path, ie ../inc would bring you down a level and into the inc folder.
  9. I'm sure you could do it using the date() and mktime() functions but the easiest solution would be to create an array. $month = array('Jan','Feb','etc'); Then reference the month using the number from your database ie $month[1] would be Feb
  10. If you just do a search for "download english dictionary" you will find a wealth of resources to download text documents with lists of words and meanings. You could ofcourse run a script to remove the meanings and just use the list of words.
  11. Use PHP to do what exactly? If you are trying to change document configuration why not just use the javascript in your PHP?
  12. Something had to be changed for it to suddenly stop working.. Did you take notice of the modified dates of the files to see if they were newer than expected? On my server I have the same issue with a script that will white screen and not show any PHP errors, my problem was that I had added a field to my mySQL query which didn't actually exist in the database therefore the results were not loading.
  13. http://www.w3schools.com/jS/js_operators.asp total = body+mind+soul; http://www.w3schools.com/JS/js_if_else.asp if (total<>12) { document.write("<b>Total Must Equal 12</b>"); }
  14. This article should provide assistance. http://www.dezinerfolio.com/2008/01/09/back-to-previous-page-php
  15. What exactly is it you are looking for a suggestion of? You said it yourself instead of using FORM METHOD=GET use FORM METHOD=POST When you retrieve the variables use $_POST rather than $_GET
  16. http://www.tutorialspoint.com/ajax/ajax_browser_support.htm All the available browsers can not support AJAX. Here is the list of major browsers which support AJAX. * Mozilla Firefox 1.0 and above * Netscape version 7.1 and above * Apple Safari 1.2 and above. * Microsoft Internet Exporer 5 and above * Konqueror * Opera 7.6 and above So now when you write your application then you would have to take care of the browsers who do not support AJAX. NOTE: When we are saying that browser does not support AJAX it simply means that browser does not support creation of Javascript object XMLHttpRequest object.
  17. Your problem is with your logic, you are declaring the variables which are not an array multiple times in a while loop. You have two options. 1) You can output the variables in the while loop; for example while ($row = @mysql_fetch_array($result,MYSQL_ASSOC)) { //HEADLINES $date=$row{'date'}; $pic="http://files.mblsim.com/reports/news/html/images/".$row{'pic'}.""; $title=$row{'title'}; $name=$row{'name'}; $team=$row{'team'}; $text=$row{'text'}; echo "date is $date<br>"; echo "pic is $pic<br>"; } This will print the date and pic for each item throughout the while loop. 2) You could store the items in an array and reference them later outside of the while loop //HEADLINES $date[]=$row{'date'}; $pic[]="http://files.mblsim.com/reports/news/html/images/".$row{'pic'}.""; $title[]=$row{'title'}; $name[]=$row{'name'}; $team[]=$row{'team'}; $text[]=$row{'text'}; then later in your code you could reference date[0], date[1], etc etc.
  18. I just ran your almost exact code on my database via phpmyadmin and it worked properly UPDATE counter SET datestamp = date_add(datestamp, INTERVAL 1 YEAR) WHERE id = '5'; counter is the table datestamp is the name of the column which is type date id is the unique identifier When I ran this it updated my field from 2008-04-19 to 2009-04-19
  19. You can use wget to grab the image from the remote server by specifying the URL then you use functions from the GD library to build your thumbnails from the original http://www.php.net/manual/en/ref.image.php
  20. My suggestion is to look at existing scripts that shows users online for phpbb and manipulate the code to meet your needs. http://www.doobdee.net/index.php?act=phpbb&resource=5
  21. You should have 3 sections with section a being the left corner of the image, second b being the middle of the image and section c being the right corner of the image. This way you can set the middle div to 100% therefore using all the available space on the page.
  22. Sorting it ASC is what makes your second query necessary. If you wanted to select the last 3 results you could do DESC LIMIT 3 If you wante to do DESC LIMIT 3 you could then reverse the results array with array_reverse http://us2.php.net/manual/en/function.array-reverse.php
  23. Anytime you press refresh any variables sent will be resent to the browser therefore causing it to resubmit and duplicate your post. This is just standard browser behavior, I suggest adding text to your page that says do not refresh the page after a submission.
  24. What does the entire line of script look like? Ie where you are running the query that is. I'm thinking the issue may be with the leading ' as the query should be something along the lines of mysql_query("insert bla bla");
  25. I created a gallery myself and the structure I used was to have an albums directory where you have a directory for each album created. The only downfall is that no two albums can have the same name, so you would have the same thing to consider where no two users could have the same user name. How you store them ultimately is up to you in what you feel would meet your needs the best. The one other thing to keep in mind is that with Linux you do have a max links value for the OS meaning you can only have so many files in one directory. The number is something ridiculous though so likely not a problem you'd run into.
×
×
  • 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.