bwochinski
Members-
Posts
116 -
Joined
-
Last visited
Everything posted by bwochinski
-
[SOLVED] Delete successfull uploads if not all upload
bwochinski replied to emediastudios's topic in PHP Coding Help
I'd say if you can you should check if all the uploads were successful before you move anything into your "/news/" folder. Then if all are successful, move them, if not, they will be automatically discarded. -
Yeah I see now you've got a couple other bits of PHP in there... You should just be able to add more <?php .... ?> blocks around any other area where you use php.
-
Yeah teng's right, so never mind my earlier attempt at an explanation. Can't really say why what I recommended worked.
-
I tried to clarify my previous post after cooldude posted... You just need to add: At the top where you set up the rest of your variables before you start the for loop. You're getting an error because if all the uploads in your script are successfull, $count is never incremented, so when you test for " if ($count > 0) ", it doesn't like the comparison of " if ( NULL > 0 ) ".
-
You need to end your PHP block... You can then open another PHP block at the end of the page before the "echo" at the bottom...
-
Do you want these things to change based on the day of the week, or change the color for dates already past, or just change the color of the current date? Or some other condition I didn't mention?
-
Initialize the variable before your for-loop. (Edit: clarified addition)
-
If you're deleting a lot of records better to do one query...
-
didn't test the layout, but I think that'll make it work nicely...
-
Well, the easiest way to fix the problem at this point would be just to change that line to this: <?php $target = "../news/" . basename( $_FILES[$photo]['name']); ?>
-
This line is your culprit: <?php $target = $target . basename( $_FILES[$photo]['name']); ?> You need to reinitialize the $target variable each iteration of the loop.
-
Update Multiple Rows - USING PHP!!
bwochinski replied to MichaelGallagher's topic in PHP Coding Help
My first guess would be that you're using the wrong syntax for your multidimensional arrays here: <?php $name=$_POST['name['.$id.']']; $lastname=$_POST['lastname['.$id.']']; $email=$_POST['email['.$id.']']; ?> This would be the correct way: <?php $name=$_POST['name'][$id]; $lastname=$_POST['lastname'][$id]; $email=$_POST['email'][$id]; ?> -
"array_keys()" returns an array of all the keys of the array. You need to refer to $key[0] and $key[1] etc...
-
[SOLVED] How to declare global variables?
bwochinski replied to kks_krishna's topic in PHP Coding Help
In a class global variables are declared at the beginning of the class outside of any functions. Not sure what you mean about the file... -
HTML mail, images and CSS not loading in Yahoo and hotmail
bwochinski replied to ~n[EO]n~'s topic in PHP Coding Help
Well, I don't seen any CSS referenced there, but the problem with your images is that you have to use full pathnames, relative pathnames wont work if the page isn't being browsed from your server. <img src="http://www.yoursite.com/images/mail_big.jpg" width="494" height="481" /> -
The only workaround I can think of would be to not use POST. Not necessarily an option of course.
-
[SOLVED] list shows incorrect numer of records
bwochinski replied to Peterson's topic in PHP Coding Help
Basically the issue is you're skipping the first row. You call "$row = mysql_fetch_row($result);" right after the query, then again in the while loop before anything is output. Just take out that first mysql_fetch_row line. -
HTML mail, images and CSS not loading in Yahoo and hotmail
bwochinski replied to ~n[EO]n~'s topic in PHP Coding Help
Can you paste the HTML? Or if it's long, just the relevant tags would be good. -
Well, simply put, you could just: SELECT username, userlevel FROM users WHERE username<>'Admin' Although if you set the Admin user to a userlevel of "10" or something, you could filter by that, to allow more than one admin level account.
-
As has been said, you really don't want to generate hundreds of pages. The ideal solution for this situation is to use ModRewrite. I'd recommend adding another directory to your pathname, to keep the .htaccess simple. Something along the lines of: http://www.carwebsite.com/model/ford focus Then in the /model/ folder put an .htaccess file with something like this... Options -Indexes RewriteEngine on RewriteRule ^(.*)$ /model/$1/ [R,NC] RewriteRule ^(.*)/$ /model/carpage.php?model=$1 [NC] You would still do your processing in /model/carpage.php, pulling records by model. Be sure to do plenty of data checking.
-
So actually what you're saying is that date(T) incorrectly identifies your timezone as CST, rather than correctly as CDT. Same story for the -0600 offset. CDT offset is -0500. You could put in a workaround - http://us3.php.net/manual/en/function.date-timezone-set.php Or just call tech support for the server and notify them of the problem.
-
Looks like you either need register globals to be "on" (not recommended) or to use the $_GET[] variables: <?php $filename = 'logfile.txt'; if (is_writable($filename)) { if (!$handle = fopen($filename, 'a')) { echo "Cannot open file ($filename)"; exit; } if (fwrite($handle, $_GET['input']) === FALSE) { echo "Cannot write to file ($filename)"; exit; } echo "Success, wrote ($_GET['input']) to file ($filename)"; fclose($handle); } else { echo "The file $filename is not writable"; } ?>
-
Yes, the last parameter on your setcookie() statement is the domain on which the cookie will be avaliable. Having it set like you have there ( to .mtechdev.com ) is probably best ( I assume the dev subdomain is a temporary development location? ) for compatability ( mtechdev.com and www.mtechdev.com will both work that way). Check setcookie on php.net for more information about the function.
-
Have you tried changing the domain on the cookie?? Other than that, start echoing out variables at strategic points. For example, after this line: if ($_SESSION['logged_in'] != 1 && isset($_COOKIE['login_cookie'])) { echo something so you can see if that statement is even evaluating to true.
-
Using snoopy.php library for passworded pages
bwochinski replied to HaLo2FrEeEk's topic in PHP Coding Help
I found an example using cURL by googling: <?php $URL="www.mysite.com/test.php"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,"https://$URL"); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, "Data1=blah&Data2=blah");curl_exec ($ch); curl_close ($ch); ?>