scootstah
Staff Alumni-
Posts
3,858 -
Joined
-
Last visited
-
Days Won
29
Everything posted by scootstah
-
As for security, follow all the normal guidelines as a start. You can find some penetration/vulnerability testing tools to check for things like XSS, SQL injection, etc. Also you could post your site on the Beta Testing forum and let people test it.
-
The server change shouldn't effect anything, as long as everything works the same afterwards. But, if you expect down time you should use an HTTP 503 Temporarily Unavailable header, so that search engines know to try again later and that it is not a permanent problem.
-
Is this "safe" to do with a $_SESSION variable??
scootstah replied to cbassett03's topic in PHP Coding Help
Using a multi-dimensional array is no more or less safe than using a one-dimensional array. -
PHP6 was scrapped and most of the features were rolled into PHP5.4. PHP5 will be supported for many years to come.
-
What are the specs of the laptop, and what do you want to do with it? You can run a simple LAMP stack on some pretty lowend hardware.
-
The problem is that strpos() is returning 0 (because that is the position of the match), which PHP is interpreting as "false" (because PHP is a loosely-typed language). You tried if (strpos() === true), but that won't work because strpos() never returns boolean true. It only returns the position (if found) or boolean false (if not found). So, the solution is thus: if (strpos($value, 'MC#') === 0) { EDIT: Actually, if you want to check if "MC#" exists anywhere in the string, you can go with: if (strpos($value, 'MC#') !== false) {
-
If i understand correctly, something like this should work: <?php $count = 1; echo '<tr>'; while($row = mysql_fetch_array($query)){ echo "<td align=\"center\"><h3><img src=\"". $row['Image'] ."\" alt=\"" . $row['First_Name'] . " " . $row['Last_Name'] . ", " . $row['Prefix'] . "\" width=\"100\" height=\"139\" class=\"docphotos\" /></h3>"; echo "<h3><a href=\"./doctors.php?action=bio&name=" . $row['Last_Name'] ."\">" . $row['First_Name'] . " " . $row['Last_Name'] . ", " . $row['Prefix'] . "</a></h3></td>"; if ($count % 2 == 0) { echo '</tr><tr>'; } $count++; }
-
It's kind of not-that-useful, though. For example: $a = 'a'; var_dump(isset($a) ?: false); = (bool)true, not "a" It's really only useful if you can do something like: $a = 'a'; var_dump($a ?: false);.But, then you have to make sure the variable is initialized first. So yeah, it exists, but it's not terrible useful. EDIT: If you want to assign a variable, you can do something like: <?php $foo = 'bar'; isset($foo) AND $bar = $foo; But, unfortunately you can't echo that way.
-
Don't leave us hangin' like that.
-
This topic has been moved to MySQL Help. http://forums.phpfreaks.com/index.php?topic=364026.0
-
In addition to my previous reply, try changing LEFT JOIN `users` as f5 to INNER JOIN `users` as f5
-
ON f4.user_id = f5.user_id AND f5.username = '" . $_SESSION['username'] . "' That should work I think.
-
How many rows should there be? You have a lot of code going on there. Try reducing it a bit until you're sure everything works. What does this give you? $sql = mysql_query("SELECT courseID, courseName, courseTYRS FROM courses") or die(mysql_error()); echo mysql_num_rows($sql) . ' rows returned';
-
Which query?
-
That really shouldn't be in a template file. You're using Smarty, which means you have an exceedingly easy way to separate application logic from presentation logic.
-
Yeah, I forgot to mention that. Using the class name as the constructor is oldschool PHP4 stuff. PHP5 supports __construct, so use that instead.
-
I disagree. PHP was not meant to be a strictly typed language, and a lot of things wouldn't work in their current state if it was. There are many other languages that follow suit. I don't think it is a huge deal. As long as you understand the difference between == and ===, you shouldn't ever have any problems.
-
You will need to use an array. You'll have to use an array for $replace too, and the keys have to match up. $search = array( '/\[link\](.*?)\[\/link\]/si', '/\[b\](.*?)\[\/b\]/si', '/\[i\](.*?)\[\/i\]/si', ); $replace = array( '<a href="$1">$1</a>', '<b>$1</b>', '<i>$1</i>', );
-
You didn't provide the code for your User class, so we don't know what the $this->loggeduser holds. $this->loggeduser = (!isset($_SESSION['userid'])) ? NULL : new User($_SESSION['userid']); Here, you are assigning $this->loggeduser to NULL if the $_SESSION['userid'] is unset. So, in that case, $this->loggeduser->userlevel will be undefined (and thus the error you're getting). What you should do instead is return an empty object with empty values from the User class, or check that userlevel exists first.
-
This topic has been moved to PHP Regex. http://forums.phpfreaks.com/index.php?topic=363997.0