-
Posts
4,362 -
Joined
-
Last visited
-
Days Won
11
Everything posted by Zane
-
Because of the fact that I have to sign up to your website to help you.. I gave up on figuring this out. But I can give you some excellent advice that will aid you in future and current problems. Get the Firebug add-on for Firefox!! It has an Inspect feature that allows you to highlight a specific element on your page in which it will tell you exactly what CSS properties are involved with it. That is most likely how haku spotted your problem... assuming he registered for your forum.
-
Everything everyone has told you is far more than what I would have time to explain, but I'll try to answer you last question. Though, please put it in regards to what gizmola has told you. The session_id that you get from starting a session (or a site starting one) is stored by default.. on the server. This means, that in order for a hijacker to grab/sniff/hijack your session_id, he/she would have to have access to that particular server that issued the hash. Though, as roopurt mentioned... these hashes are not only stored on the server but typically stored in a COOKIE. Notice I said typically. This means that they are normally not in a cookie. But if they are in a COOKIE.. the hash is stored on the client's computer. This is how the hijacker gets the session id. Unless of course the developer decides to pass the session id through a GET variable which is typically... not a good idea. So why did your script not work? For one. You have to set your session id BEFORE you start the session.. Secondly, your script DID WORK. It worked perfectly; it just didn't hijack anything like you had hoped. If you print_r an empty session.. what would you expect it to print? .... Exactly! Nothing at all. Try setting the session_id before the session_start and see what happens
-
Don't you think it's a little bit.. no.. REALLY redundant to use the variable $bgclass over and over and over again? When you're just gonna use it to distinguish whether or not that particular element is nested within an.. odd... or even element. You're going about it all the wrong way. You know you're doing it the right way when you only have to use that variable ONCE For example YOUR CODE echo " $imgIcon $from $subject $date $bot "; It's very obvious to me that the only differences that appear. (whether odd or even) is the $bot variable .. and a number before that. And judging by your logic before all this.. $bot is either gonna be nothing at all.. OR "bottom". So assuming this is the "last" post.. your class will look like this when echoed If you notice.. the class name is odd3bottom.. with no spaces. That means you need a class in your stylesheet named just as such. Which I'd assume you don't. The simplest fix to all this would be to separate each with spaces so your class name is odd 3 bottom. That way is has 3 classes. BUT, let's not stop there! Why even put odd in every single td element when you could just as easily put it in the TR tag instead? Better yet... why even put the "bottom" class name either? In short.. change your code to something a little more like this $i = 0; $mailSQL = mysql_query("SELECT * FROM `mail` WHERE `To`='$username'"); $num=mysql_num_rows($mailSQL); while ($fetchMail=mysql_fetch_object($mailSQL)) { $bgclass = ($i % 2) ?'even':'odd'; $bgclass = ($i == $num) ? $bgclass : 'bottom'; ////// Use just one variable for your classes if($fetchMail->Read=="0"){$imgIcon="";}else{$imgIcon="";} $from="$fetchMail->From"; $subject="$fetchMail->Subject"; $date="$fetchMail->Time, $fetchMail->Day $fetchMail->Month $fetchMail->Year"; echo " $imgIcon $from $subject $date $bot "; $i++; } Of course.. this means you'll also have to edit your stylesheet accordingly..
-
How would you calculate mileage between two cities?
Zane replied to tomdelonge's topic in PHP Coding Help
Here, I'll let you in on a super secret.. (passed down from generation to generation) thread/topic that deals about this very question you have asked. If that doesn't help you out, then I'd recommend premiso's suggestion... manually checking it through Google Maps.. (I highly doubt you'll need to though) http://www.phpfreaks.com/forums/index.php/topic,208965.0.html -
just a shot in the dark, but I think you only need this if not this
-
You'd need an array for each set of open/close hours So for example.. The Monday - Friday array would look like this $monfri['open'] = "10AM"; $monfri['close'] = "7PM"; $operatingHours = array(); Same concept for saturday and sunday.. As for the special days, you'll have to explicitly check for those days on load time.... when the page loads, and set them accordingly using the strftime and date functions something like this $date = strftime('%u'); if ($date >=1 AND $date if ($date == 6) $operatingHours = $sat; if ($date == 7) = $sun; $date = strftime('%x'); //For the strict dates if ($date = "3/29/2010") $operatingHours = $sat; //etcetera etcetera //If the operatingHours is empty then the store is closed if(empty($operatingHours)) echo "The store is closed";
-
Something like this $mandatory[] = "usr_firstname"; $mandatory[] = "usr_surname"; $mandatory[] = "usr_username"; $mandatory[] = "usr_email"; foreach($mandatory as $item) if(!isset($_POST[$item]) || empty($_POST[$item])) $errors[$item] = true; if(count($errors) > 0) echo "You've got errors"; else { // Continue with your script }
-
you can either go with COOKIES or a simple boolean value in a database. Either one would suffice If you want this display option to appear everytime they login.. then use sessions instead.
-
well.. I'm no MySQL expert, but I'm sure the difference in speed between the two is no more than a few thousand milliseconds... if not more. It wouldn't be enough to notice... depending on your server's CPU speed. Ideally though, it's best to select only the columns you need so that when you're debugging you know exactly what columns you're working with instead of going back and forth between phpmyadmin and your script.
-
Whats quickest cheapest? Going to the grocery store and getting EVERY food item possible.. or Going to the grocery store and getting exactly what you need/want/came there for.
-
How would you calculate mileage between two cities?
Zane replied to tomdelonge's topic in PHP Coding Help
This is basic math... the most basic of basic if you ask me. Think about it. If it is 100 miles between two points, the only other variable that you need is the speed. The paradox that you'll run into is that.. obviously no one will ever be going a constant speed for an entire 100 miles. That's impossible. You've got dynamics to look at such as [ot] - the posted speed limits - the mileage/condition of the car itself - the weather - the tire pressure - the number of passengers AKA the weight of the car - the alcohol level of the driver - the chance of a wreck - slow drivers in front of you - back seat drivers ruining your focus - slowing down to change the radio station... --- it can go on and on [/ot] but all it really boils down to is a relative speed.. You could get all fancy and use sin waves and such if you wanted... but to start off simple. If you're traveling 65 mph to a distance 100 miles away, how long do you think that would take? Well.. If you can 65 miles in 1 hour.. You should be able to get 100 miles in (100 / 65) hours ........which is 1.54 -
My guess is that at some point in time.. Windows was installed on this NTFS partition. An installation with a few unprivileged users. Unless you login to that drive with an admin account, you'll forever be restricted from it. I'm not exactly sure how to login to an ntfs drive with linux, but that's your problem at hand.
-
Best way to add/remove comma seperated IDs in DB
Zane replied to TEENFRONT's topic in PHP Coding Help
Well.. your query would actually be the most ideal when I think about it. For some reason I was writing it in the assumption that I didn't know the id of the team name, but obviously you would have that information. The INNER JOINs and LEFT JOINs just make things easier... less queries. You probably will use at least one JOIN before it's over with. By using a JOIN you can SELECT not only all the awaiting player id WHERE the team = suchAndsuch.. but you can also have MYSQL select those ids... match them with their respective player names / team names.. and return that instead. Say for instance, instead of a list of the awaiting ids.. you wanted a list of the actual player names. That's the ticker right there. SELECT players.name FROM awaiting INNER JOIN players ON awaiting.pid = players.id WHERE awaiting.tid = $teamid -
my only guess is that this IF statement failed if(substr($line, 0, 1)==')') An undefined offset pretty much always mean... the index does not exist. If the offset 0 doesn't exist then I'd say the array was never populated.
-
Best way to add/remove comma seperated IDs in DB
Zane replied to TEENFRONT's topic in PHP Coding Help
[ot]I tried going down this road just recently and failed.. I guess it's just a fact. Sticking a comma separated list of id within a column is complete no-no in web development.[/ot] Rather than have awaiting set as a column, it needs to be it's own table. Crazy right? No.. that's the way it's gotta be. Create a table called awaiting or something relevant to what you're making and considering the information you've given us.. put 3 columns in it.. all INTs - ID // For the awaiting id - TID // For the team id - PID // For the player id Now, when you have a user request to be on a team... run a query similar to this INSERT into awaiting (`tid`,`pid`) VALUES ($desiredTeam, $currentPlayer) To see all the players awaiting approval for a certain team.. then run this query SELECT name.players FROM awaiting LEFT JOIN players ON awaiting.pid = name.id INNER JOIN teams ON awaiting.tid = teams.id WHERE teams.name = "Bulldogs"; At least I think the above query would work... don't take my word on it. -
You've obviously got the AJAX part of it down. This is Javascript problem. The reason it flickers it because that is exactly what you tell it to do... replace the data after 5 seconds.. no transition or nothing. Which is understandable because you're not using any kind of Javascript library. You're using plain ole Javascript. If you check out some of the newest Javascript libraries out there like jQuery or mooTools I'm sure you'll figure out what your problem is. By using a library, you're equipped with a multitude of effects, animations, transitions, even custom animations and you can even use it alongside regular Javascript. My favorite library so far is jQuery. For the simple reason that it's only one file.. you just include it and start coding with the jQuery API
-
Given that information... you really only have two options in the matter (well four if you count POST) 1.) You can use the browser to make this request.. onClick ; known as client-side 2.) You can do as PFM suggested and set the tabs as anchor links to preset URLs .. containing relevant GET/POST information to perform a server-side function. There is no wrong option here, though the second one is less of a hassle. In a client-side request.. data can be manipulated. Also since it's client-side, users have the ability to disable their functionality on your site;Most people call this "turning off Javascript" This rendering all your work and motives pretty useless. Though it's really all in how you code it. A good programmer knows how to use the noscript tag as well.
-
Static Classes vs Objects (when to use one over the other)
Zane replied to Anti-Moronic's topic in PHP Coding Help
The benefit of using a non-static method/property is the fact that you can use the public/protected/final/private methods & properties along with your current object. If you have a static object.. the use of $this is of no use (as least I think I'm sure in that assumption). Choosing whether you want a static or non-static object all boils down to whether you need to use a context.. such as $this.. or $parent.... It's actually pretty fortunate that you're so accommodated at using static classes, because that was actually the hardest concept for me to grab and usually the hardest concept to teach. -
Nice, I did not know this
-
what you are referring to as "Indirect References" are commonly/correctly called Variable Variables so your script would look like this $name = "Air nike"; ${$name} = "Registered item"; print $AirNike; The only problem is that you can't spaces in a variable name.. So $name would have to be "AirNike" insted of "Air Nike"
-
eventhough the date() function comes equipped with a leapyear check.. You could just as easily divide the year by 4... and see if it returns a remainder... using the modulus operator. if(1776 % 4 == 0) echo "Christopher Columbus sailed the ocean on a leap year!";
-
Click buttons to Increaese/Descrease height of DIV
Zane replied to jasonc's topic in Javascript Help
it should be theDiv = document.getElementbyId('my_div'); theDiv.style.height = theDiv.style.height = parseInt(theDiv) + 1 + "px"; not theDiv = document.getElementbyId('my_div'); document.theDiv.style.height = theDiv.style.height = parseInt(theDiv) + 1 + "px"; you've already specified the document object in theDiv variable. -
I have you tried.. not using short tags -----------------------------------*** update
-
Click buttons to Increaese/Descrease height of DIV
Zane replied to jasonc's topic in Javascript Help
Oh yeah.. I think you do have to strip off the px before doing the math. That makes sense. I'm too spoiled with jQuery. You could do something like this theDiv = document.getElementbyId("yourDIV"); onClick(theDiv.style.height = parseInt(theDiv) + 1 + "px"); -
Click buttons to Increaese/Descrease height of DIV
Zane replied to jasonc's topic in Javascript Help
when you say "it did not seem to work"... by this do you mean - you copy/pasted the code and it didn't work immediately so you gave up? - an error message appeared? - nothing at all happened? - the height of another div (on another website) increased? - the height not only increased but auto posted a reply for you here saying it didn't work? Details, details.. what does your code look like currently?