denno020
Members-
Posts
761 -
Joined
-
Last visited
-
Days Won
3
Everything posted by denno020
-
Here you go You'll learn everything you need to know about image resizing using php.
-
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.
-
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
-
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..
-
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
-
Image upload PHP script sometimes wont work, Need help debugging it.
denno020 replied to angel1987's topic in PHP Coding Help
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- 1 reply
-
- image upload
- wont work
-
(and 1 more)
Tagged with:
-
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).
-
you haven't closed off your if curly brace from the start.. Put that below the exit -> }
- 13 replies
-
- contact form
- thankyou page
-
(and 3 more)
Tagged with:
-
You need a semi-colon after exit();
- 13 replies
-
- contact form
- thankyou page
-
(and 3 more)
Tagged with:
-
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
-
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
- 13 replies
-
- contact form
- thankyou page
-
(and 3 more)
Tagged with:
-
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
- 13 replies
-
- contact form
- thankyou page
-
(and 3 more)
Tagged with:
-
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
- 13 replies
-
- contact form
- thankyou page
-
(and 3 more)
Tagged with:
-
Finish Final Stage of Social Networking Button
denno020 replied to justlukeyou's topic in PHP Coding Help
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 -
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
-
I think you might need to add quotes around subject_id so like this: $query .= "WHERE id=`$subject_id`";
-
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
-
<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