Jump to content

denno020

Members
  • Posts

    761
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by denno020

  1. Is the error still in the exact same place? Also, do a var_dump of $_SERVER to ensure that the array key is actually there
  2. Here you go You'll learn everything you need to know about image resizing using php.
  3. No worries mate, glad to have helped. I think that maybe the space is added in place of the 'new line character' that you won't see in a text editor, but php will pick it up.. That's my theory anyways . Oh and there's not need to delete your post, not that you can, but it's worth staying there so other people can follow your thought process and it can help them, should they need it.
  4. Put the trim inside the preg_match as such: if((preg_match("/^a[0-9]{6}$/i", trim($column[0]))) && (preg_match("/^([0-9]|[a-z])([0-9]|[a-z]|[_-])*@([0-9]|[a-z])*\.([0-9]|[a-z]){2,4}$/i", trim($column[3]))))
  5. Personally, I would always use curlry braces for if, foreach, switch etc statements.. So in your case: foreach ($bots as $bot){ if (strpos($_SERVER['HTTP_USER_AGENT'], $bot) !== false){ $isBot = true; } } This way there is no guessing as to what code belongs in which block etc.. Give that a try and see if the error message moves to another line lower down. Denno
  6. Well from that I see that $column[3] has a space at the end.. This will mess up your matching. Perhaps if you run trim() on $column[3] before you run the preg match, this might help.. That way any leading or trailing spaces will be removed.
  7. Where has $column come from? What I would do it just do a var_dump or echo of $column to make sure you are actually checking the right portion of the line of text. Also, it may just be the way you've typed it here, but if there is a space before the first (or any) line of your aaa.txt contents, then that probably won't help things..
  8. What line of code corresponds to line 22? And is there a reason you're not using curly braces?
  9. Inside your foreach statement you want an if statement as such: if(!preg_match("your pattern here", $row)){ //the preg match wasn't satisfied, so there is an error } The exclamation point at the beggining means not, so therefore, if the preg match fails, then the code inside the if will run, which is where you should report back at error to the user. The tricky thing will be to work out what the regular expression is that you need. If you can come up with something, I'll be happy to guide you from there, but I'm not going to let you off the hook and write it all for you . Denno
  10. To debug, you need to make either echo, print_r or var_dump your best friend. Basically, you put them just inside if statements, and if they display on the web page, then you know that the code inside that if was processed, in which case you move on to the next if statement etc. So for starters, I would put a var_dump() just inside your if statement checking the conditions of the uploaded file: if ((($_FILES["txtphoto"]["type"] == "image/gif") || ($_FILES["txtphoto"]["type"] == "image/jpeg") || ($_FILES["txtphoto"]["type"] == "image/png")) && ($_FILES["txtphoto"]["size"] < 1048576) && in_array($extension, $allowedExts)){ var_dump("MARKER"); ...... } If you see 'MARKER' appear on the page, then this if condition is satisfied, and you move on to the next if (the error checking one) That's all that is involved in debugging, just printing words to the screen so you know which parts of the script was processed and which parts weren't. Hope that gets the ball rolling! Denno
  11. Ajax is quite simple. It stands for Asychronus Javascript and XML. If you want to go the exceptionally easy route, you can use jQuery. Otherwise you could look up tutorials on YouTube on how to do pure javascript AJAX (which isn't harder than jQuery, it's just got longer variable names, so it looks harder).
  12. you haven't closed off your if curly brace from the start.. Put that below the exit -> }
  13. You could give each a link to the current page with a get variable set, then using php to process the get variable, display whichever line you want. <a href="this.php?link=1">Link 1</a> <?php if(isset($_GET['link']) && $_GET['link'] == '1'){ echo "Show if and when Link 1 is Clicked....."; } ?> You could expand on that for the rest. Obviously this will require a page refresh. If you want to do with without a page refresh, then you'll need to look at using AJAX, which means you'll have to use javascript as well.. Denno
  14. You need to do header('Location: thankyou.html'); Could you highlight which line the error is appearing on? Easier that than me having to count down to line 84
  15. I've always cheated and just used phpmyadmin, then when you've created the table through that interface, you can export the sql and see what it should be in code, should you need to keep it in a deployment script or something..
  16. Yep, right at the end of the php file. It will redirect the users browser. Also add an exit(); right after the header. Just to make sure the php script isn't processed any further. I know there isn't any more code after it, but I tend to put them together anyways. Denno
  17. Well the first thing I noticed if that the action of your form is a HTML page.. I don't know how your php is supposed to run? And also I can't see where you've highlighted the line of HTML that you think is the problem. What you should do is make "send_form_email.php" the action of the form, then at the end of the script, use header('Location thankyou.html'); to forward the user on to the thankyou page. Hope that makes sense. Denno
  18. I can't see an opening <form> tag? That omission of that will be halting anything coming through $_POST with your current code. As for what the code is doing: isset($_POST['followbutton']) - checks to see if the variable is set (which at the moment it probably isn't getting set without the opening form tag $_POST['followbutton'] == 'true' - makes sure the value of followbutton is true, but will only check this condition if the first condition is satisfied. Hope that helps, Denno
  19. I've added it to line 4 below. 1 for ($i=0; $i<($maxday+$startday); $i++) { 2 if(($i % 7) == 0 ) echo "<tr>"; 3 if($i < $startday) echo "<td></td>"; 4 else if(($i-$startday+1) == $today && $thismonth['month'] == $month && $thismonth['year'] == $year) echo "<td align='center' class='today' valign='middle' height='20px'>". ($i - $startday + 1) . "</td>"; 5 else echo "<td align='center' valign='middle' height='20px'>". ($i - $startday + 1) . "</td>"; 6 if(($i % 7) == 6 ) echo "</tr>"; 7 } The place where you added the first 3 lines should be fine. Just so long as your CSS is linked correctly, that will work. If you want to try it without having to rely on the CSS, using this line instead: else if(($i-$startday+1) == $today && $thismonth['month'] == $month && $thismonth['year'] == $year) echo "<td align='center' style="background-color: red;" valign='middle' height='20px'>". ($i - $startday + 1) . "</td>"; It was working fine for me, so hopefully that works for your now also. Denno
  20. I think you might need to add quotes around subject_id so like this: $query .= "WHERE id=`$subject_id`";
  21. You can do this with javascript. window.pageYOffset is how far the window will need to scroll before your div is going to show. function testScroll(ev){ if(window.pageYOffset>270){ document.getElementById("top").className = "show"; //Apply a css class which gives it the property display: inline; (this is the default display) }else if(window.pageYOffset<270){ document.getElementById("top").className = "hide"; //Apply a css class which gives it the property display: none; }; } //Run the above function whenever the window scrolls window.onscroll=testScroll(); Hopefully that'll get your started. Denno
  22. <ul id="nav" style="float:left; clear:both;" name="br"> <li><a href="#"><b>City List</b></a> <ul> <li><a href="main.php?value=398A">BEEJING</a></li> <li value="125B" ><a href="#">NEWYORK </a></li> <li value="734C" ><a href="#">ADELLAIDE </a></li> <li value="859D"><a href="#">MELBOURNE </a></li> </ul> </li> Then you retrieve the value in main.php using the $_GET variable array as such: $value = $_GET['value']; Denno
×
×
  • 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.