KevinM1
Moderators-
Posts
5,222 -
Joined
-
Last visited
-
Days Won
26
Everything posted by KevinM1
-
Come on, you have to at least admit the web developer tool built-in to IE8 that mimics firebug is a godsend. True, dat. I think I'm more irked by Microsoft's glacially slow acceptance of standards than anything else. Then again, that could be my nightmares of trying to learn CSS during the days of IE 5.5 and 6 talking :shudder:
-
[SOLVED] How to wrap this up in a function and replace the element?
KevinM1 replied to ollie007's topic in Javascript Help
echo "Need more details, and some context, before anyone can help you out."; echo "What element needs to be replaced? How/where are you calling the embed function?"; echo "Also, you DO realize it's rude to simply write a block of code and say 'fix it,' right?"; -
Yup. I have Vista, and have nothing to complain about. My XBOX 360 has been fine in the year and a half I've had it so far (knock on wood ;-P). I like Microsoft's IDE's (I use Visual Web Developer Express 2008, which is free). I love C#. There are definitely some things that I don't like about Microsoft (I still don't like IE, despite its improvements; XBOX Live points are a needless complexity in their marketplace system; MSDN documentation could use an editor or three), but I don't hate them.
-
PHP grabbing url for string after question mark
KevinM1 replied to phpfreakjav's topic in PHP Coding Help
Actually, using $_GET['xy'] is slightly better. -
Validating that the person visiting the page is valid
KevinM1 replied to rv20's topic in PHP Coding Help
You can also reset a user's session id, which is a smart move when they navigate to and from vital areas of a site. See: http://www.php.net/manual/en/function.session-regenerate-id.php -
I believe you have a couple of options. The best would be to click the little green play-button icon at the top of the screen. That starts the debugger, which will compile your program and allow you to insert breakpoints that you can step through to really fine-tune your code.
-
Well, you need to update the $player before attempting to show that it's changed. What I'd do is simply modify the $player with whatever changes (if any) were made, then display those changes. If any changes were made, then I'd update the db at the end of the script.
-
You're updating the db values, but you're not updating the player object's values at the same time. Changes in the db aren't magically transferred to the player. So, the changes are staggered as you don't refresh the player object until the entire page is reloaded.
-
Will there ever be a finalized database? Or will he be adding fields indefinitely?
-
Your echo statement makes no sense. You're trying to output an assignment. Try: $array = array(); $result = mysql_query("SELECT * FROM `main`"); $count = 1; while($row = mysql_fetch_assoc($result)) { $array[] = $row['column']; echo "Row $count value: {$array[$count - 1]}<br />\n"; $count++; }
-
Because of the way PHP's double-quotes work, you can't directly access array values in the manner you're attempting. You need to do one of two things: 1. Leave the value in the string and put curly braces around them. 2. Exit the string and concatenate the values to them. 1: $sql="INSERT INTO markers (name, street, city, state, zip, url, lat, lng, marker_cat) VALUES('{$_POST[name]}','{$_POST[street]}','{$_POST[city]}', '{$_POST[state]}', '{$_POST[zip]}', '{$_POST[url]}', '{$_POST[lat]}', '{$_POST[lng]}', '{$_POST[items]')}"; 2: $sql="INSERT INTO markers (name, street, city, state, zip, url, lat, lng, marker_cat) VALUES('" . $_POST[name] . "','" . $_POST[street] . "','" . $_POST[city] . "', '" . $_POST[state] . "', '" . $_POST[zip] . "', '" . $_POST[url] . "', '" . $_POST[lat] . "', '" . $_POST[lng] . "', '" . $_POST[items] . "')"; If the problem persists, try removing the single-quotes from around the values. Also, you should put single-quotes around your array keys, i.e.: $_POST['city']
-
if(!isset($_POST['some_field'])) { /* code */ } Or, if(empty($_POST['some_field'])) { /* code */ } http://www.php.net/manual/en/function.isset.php http://www.php.net/manual/en/function.empty.php Your problem is that is_array() merely checks to see if the value is an array, not whether or not it exists at all.
-
Well, you're not going to find any PHP-only carousels because PHP is a server-side language. It can't do things like react to browser events or create animation. A quick look through your code leads me to believe you have a scope problem. Try placing the three lines before your window.onload event inside of that function instead.
-
Are you using the $_REQUEST super global array to obtain the data that's passed in by the form? It sounds like you are. Either that, or your form method is set as get. In any case, you should use post as your form method and the corresponding $_POST array. As far as sessions go, they use cookies out of the box, but they're safer than normal cookies. There's a discussion about cookies, sessions, and login systems you may be interested in reading. I think it may steer you in the right direction: http://www.phpfreaks.com/forums/index.php/topic,254261.0.html
-
If you don't mind having the page refresh, you could have the user select their value from the first dropbox, have them submit the form with that value, then redisplay the form with the second dropbox based on that first box's value. You could do something similar using AJAX, to remove the page refresh from the equation entirely, but that may be a bit more intensive than you need/want to do.
-
Well, right now, your cookieid() function won't work because you don't pass $user into it. And, once again, you don't return any values. And I thought that your script came from a 3rd party...the code had that funky 'smell' to it. What you should do is brush up on/learn basic PHP. Functions (arguments and return values) and scope would be a good place to start. As to your functions, here's a quick sketch of how I'd modify it without completely rewriting everything from the ground-up: include ("functions.php"); function readCookie($user) { $cookieData = explode("|", base64_decode($user)); return $cookieData } function index($user) { global $db, $prefix; // <-- Keeping these only because the system depends on them. $cookieInfo = readCookie($user); include("header.php"); //check if the user is logged in or not. if (is_logged_in($user)) { //print welcome message echo "<h3>WELCOME<b>" . $cookieInfo[0] . "</b>!</h3>"; echo "<p>Here are the most recent additions to the public listings:</p>"; $searchstring = "WHERE `account` != '0'"; $table = "listings"; $order = "1"; $pagination = pagination($table, $order, $searchstring, $pre, $pos, $nav, $page, $pages); $navigation = $pagination[0]; $result = $pagination[1]; $num = $pagination[2]; echo "<table class=\"hover\"><tr>"; echo "<th>Contact</th><th>Last Years Earnings</th><th>Location</th><th>Amount</th></tr>"; for($i; $i < mysql_num_rows($result); $i++) { $row = mysql_fetch_array($result); echo ($i % 2 == 0) ? '<tr>' : '<tr class="altrow">' . "\n"; echo "<td>" . $row['ContactFirst'] . " " . $row['ContactLast'] . "</td>"; echo "<td>" . $row['LastYearsEarnings'] . "</td>"; echo "<td>" . $row['City'] . ", " . $row['State'] . "</td>"; echo "<td>" . $row['Amount'] . "</td>"; } echo "</table>"; navigation_menu(); } else { $login_needed = 1; } include("footer.php"); }
-
I still wouldn't attempt to store a password in a session. Other 'remember me' info? Sure. But I'm pretty anal retentive about keeping user passwords safe.
-
Well, my first suggestion would be to stop sending critical information to your system via GET, where anyone could get an idea of what your system is doing merely by looking at the address bar. What are you currently doing to scrub incoming data? It's hard to get an idea of what you should do without knowing what you're already doing (if you're even doing anything at all).
-
Good point. Well i wouldn't use a cookie anyway, sessions, but you are right of course. Sessions still use cookies....
-
All you do is cringe? I feel like I got hit in the wobblies with a baseball bat. LMAO!
-
Exactly. Also, I abhor using globals of any kind. They make code harder to debug and modify. There's a reason why functions can take arguments and return values, and there's a reason why PHP and virtually all other modern programming languages you're likely to encounter have references. So when I see something like: //note for functions: if you want to include a value of some variables inside the funtions, //then you have to GLOBAL it first. I cringe.
-
function index($user) { global $db, $prefix; //<-- I don't like globals here, either //check if the user is logged in or not. if (is_logged_in($user)) { include("header.php"); $cookie_read = explode("|", base64_decode($user)); //define variables to hold cookie values. $userid = $cookie_read[0]; } return $userid; } $userId = index($user); Functions can return values/results to the code that invoked them. Simply assign the function invocation to a variable to capture the return value.
-
You're looking at it the wrong way. It's not that cookies shouldn't be used in a 'remember me' system, it's that a user's password shouldn't be stored in the cookie.
-
Instead of adding globals to your code, why not simply return the value you want?
-
Setting className with javascript not working on hover
KevinM1 replied to Darghon's topic in Javascript Help
Are you using a doctype at all? IIRC, the :hover pseudo-element won't work in IE unless you're using a strict doctype. The same may be true of Mozilla browsers as well.