Spectre
Members-
Content Count
1,034 -
Joined
-
Last visited
Everything posted by Spectre
-
.htaccess Redirect Question redirect ALL traffic to another domain
Spectre replied to snlildude87's topic in Programming
The idea is that a temporary redirect indicates that the original page is going to be restored at some stage soon, and a permanent redirect means it's not coming back (or at least, won't be there for an extended period). For example, if you are doing site maitainance and don't want any of your pages viewed during the process, you might '302' them to, say, '/message.html' to inform them of this. But if you renamed your page from '/page.html' to '/otherpage.html', you might want to permanently redirect traffic from the former to the latter.Most search engines also treat 301 and 302 redirection very differently. If you change your site to another domain name, then it is generally a good idea to use permanent redirects to point to your new domain name, informing the search engine that your site has been moved. -
Lozbo, the HEAD method exactly the same as the GET method. A quick example: HEAD /file.ext HTTP/1.1Host: host.tldAccept: */*Connection: close
-
Empire Earth Series Good Enough compare to Age Series
Spectre replied to Nileshpatel's topic in Computer Gaming
And on another note, shouldn't this be placed in the RTS forum? -
Empire Earth Series Good Enough compare to Age Series
Spectre replied to Nileshpatel's topic in Computer Gaming
In my opinion, Empire Earth (I have only played the first one) is one of the greatest real time strategy games ever created, at least at the time of its release. Not that it's so great to play (it is immense fun, but as noted, the micro-management and other such details tend to get in the way), but the fact that it is so large - it spans from thousands of years BC to present to thousands of years into what we would now consider the future, all in a real-time environment with multiple civilizations as well as different units and buildings for each epoch. Personally, I find that quite incredible. I was a huge fan of the original Age of Empires, as well as Age of Empires II and it's expansions. However, I didn't particularly like Age of Mythology. Whilst it was still a reasonably good game, the mythological element didn't appeal to me - one of the things that kept me interested in the original games was that they were played out with realistic units in realistic environments. Speaking of Age of Empires, I believe the newest edition is to be released some time this month. I'm sure this has strategy fans drueling the planet over. I haven't downloaded the demo or watched any of the videos yet, but I'm sure Ensemble Studios won't let us down - it should be spectacular, as all others before it have been. Anyway, this is getting off-topic... back to Empire Earth. I think that it's one of those games that appeals to a certain audience, and requires a bit of time and dedication. I, for one, have happily spent hours on end lost in it's world, battling a host of other nations through the ages for global supremecy - however, when I first played the game, I didn't like it, and it took me a few goes to really get into it. So whilst it may not be the game that everyone will like to play, I do not think that it can be dismissed as simply being another run of the mill real time strategy game, and I think that it very easily compares to Age of Empires (you have to apperciate that they are both different slightly styles of the same genre, in my humble opinion). -
mendezgarcia, I'll assume that was directed at me. That was a long time ago - when PHP first came about. It moved to an executable CGI after that, and is now available in various forms, including an Apache module (although it is in no way limited to this). I do always use <?php ?> in scripts. In the beginning of the tutorial, I noted that anything outside of the <? ?> tags will be ignored - but this isn't unique to PHP. There are numerous scripting engines (some more widely used than otehrs) that use <?(.*?) ?> to determine what should be processed and what shouldn't. It is true, however, that using <?php ?> is best practise and should always be compatible. Normally, indentation is up to 9 blank spaces, whether they are actually 9 consecutive instances of 0x20 or a single 0x9 (incrementing each level - or least, that's how I do it); IPB trims the character 0x09, and I -think- it trims more than a few consecutive spaces or character 0x20. As such, code in this post is not particularly well indented. That aside, it is only concept code - most of the code posted here would not actually work anyway (or would have very little value) in the form in which it currently exists (eg. '} else { statement; }' - obviously, not a real statement). Structure is not incredibly important in this particular tutorial (and the only reason it matters elsewhere is for ease of readibility, something which, for one reason or another, is not always wanted). I already mentioned this in 'if...then..else'. There are not major differences - the former checks only the value, the latter both value and type (eg. $x == 4 would match a string value of '4'; $x === 4 would not). See: 'It is also possible to set explicit condition requirements by using an additional equals symbol...'. I didn't cover it in great detail, but it was mentioned.
-
You can't really get the exact size of a web page, especially if it contains dynamic content - everybody uses their own style of markup, and it makes it difficult to extract and calculate the sizes of images etc. Apache (and most HTTP v1.1 servers) support the 'HEAD' method, which returns just the header for the requested file and not the actual file contents. This makes it easy to get the size of binary files, but it cannot be used with text/html files - ie. web pages.
-
Note the line: if($prod->id == $id2) The '$prod' variable is not an object, yet here you are treating it as if it were. This would cause problems. I'm not sure exactly what 'id' is supposed to be, but if the array '$AL' contains arrays within itself, each with an inded 'id', try replacing '$prod->id' with '$prod['id']'. It would help a lot if you could give an example of the structure of the '$AL' array. How many dimensions, is it numerically or associatively indexed, what is the data it contains, etc. A simple var_dump() would be sufficient.
-
.htaccess Redirect Question redirect ALL traffic to another domain
Spectre replied to snlildude87's topic in Programming
Oh, you can also redirect access via PHP, using the header() function: // Permanent redirect:header('HTTP/1.1 301 Moved Permanently', true);header('Location: http://forums.xisto.com/no_longer_exists/ Temporary redirect (note that sending the 'Location' header automatically sends a 302 redirect unless it is explicitly overwritten, as it is above):header('Location: http://forums.xisto.com/no_longer_exists/;; -
.htaccess Redirect Question redirect ALL traffic to another domain
Spectre replied to snlildude87's topic in Programming
You have a couple of options, the simplest of which you have already mentioned (although I would recommend using a 301/permanent redirect over a 302/temporary equivalent). Note that you can use 'temp' or 'permanent' in place of the HTTP request codes. Also try looking up the RewriteRule (or mod_rewrite) -
Php And Mysql Problem Need a little help
Spectre replied to saga's topic in Websites and Web Designing
The mysql_num_rows() function returns the number of rows returned from the last query executed, as has been mentioned. Any easy approach would simply be: mysql_num_rows(mysql_query('SELECT blah FROM blah WHERE sex = "male"')); When modifying data in a table, the mysql_affected_rows() function returns the number of rows affected by that query (eg. mysql_query('DELETE FROM blah LIMIT 2'); mysql_affected_rows() = 2). -
Making A Refresh Link On Your Website. refresh local webpage
Spectre replied to kakingho's topic in Programming
An easier way (which doesn't require the user have JavaScript support): Press F5. Nearly all browsers designate the F5 key as the Refresh command. -
No you didn't. You may have picked up the very basics of the language, but it is not possible to learn any language in just four days (not even the simplest of high-level programming languages). I would very much doubt that you are very skillful in the language in question if you spent only four days learning it.
-
That would take about 3 milliseconds to bypass. Most people opt to have Explorer display hidden files rather than hide them. Apart from that, if the CD were copied, the hidden file would be copied as well.It is possible to write your own CD checks and implement a certain level of security. If you've ever heard of the 'two sheep' system, you may be able to use that to your advantage. There are also commercial options to prevent CD copying. But even those are not invulnerable, and if someone is determined enough, they are going to find ways to get around the copy protection.
-
This is getting slightly off topic. But anyway, Perl is a CGI; so is Python. PHP can be run as a CGI, but most people usually favor the module (for security and other reasons - but not all web servers support this). CGI stands for common gateway interface, and is basically a server-side program that the web server can interface with, allowing for certain scripts to be executed on the server. Anyway, thanks for all your comments. Maybe I'll get around to writing up a second part some time. And HmmZ, feel free to expand on it.
-
There are no 'secrets' to getting good rankings in Google (or any other major search engine). Obviously, you can't just place a collection of keywords you would like to target in the meta tags and then have Google give you a number 1 ranking for those pages. People have tried nearly all the tricks in nearly all the books, and Google gets wise to 'blackhat' SEOers. The ultimate punishment is being dropped all together from Google's index - and it doesn't take a great deal for them to do so, especially if you aren't already well established. The only way to get decent rankings in any search engine that is worth having decent rankings in is by providing quality, optimized content, and being patient. If your site contains good content, then search engines will pick up on this, and your rankings will start to rise.Having links pointing to your site is good for rankings, but not critical - regardless of what a lot of people seem to think (I am speaking from first-hand experience here). Search engines weigh links based on how important they consider the page that contains the link to your site - so a poorly ranked site that the engine sees as having low-quality content and not being of much use will not do anything to help your rankings (it has been said that they can even have a detremental effect), but a link from a highly ranked site that the engine considers to be of high importance will help to increase your rankings. They way they figure, if a good site is pointing to your site, then your site musn't be so bad either (although a single link from a decent site won't automatically grant you number 1 rankings).Just to dispell some myths concerning SEO, some time ago, I set up a small web site on a domain name I wasn't using that related to Internet-based marketing and advertising. I ended up stopping work on the site, but didn't take it offline. There was not a single link pointing to it, and pretty much no one knew of its existance - the domain name didn't contain any special keywords, and I'd nevere really mentioned it to anyone. After about four months, I was checking the logs for that server (which hosts several other web sites) and noticed that I had been receiving quite a lot of hits for some pretty decent, competetive keywords - and sure enough, when I checked them in Google, Yahoo! and MSN, I had top-ten pages for all of the keywords and phrases. I was quite suprised by this, as I hadn't really put any time into the site and hadn't optimized the content a great deal. But it goes to show that well-written pages with keyword-rich (but not too many keywords) will get you good rankings, despite all other factors a lot of 'SEO freaks' tend to talk about.
-
Ugh. HTML is a markup language - it is used for creating the graphical front end of a web site. PHP is not. Apart from syntax highlighting and code formatting (as well as possible error checking), there isn't a great deal any editor can do for you. So you might as well stick to your free, simple text editor. Although I don't know of any, there may be editors floating around that allow rapid PHP development by containing shortcuts to functions etc. Anyway, if you want to learn any language, you can't do it overnight. I would suggest you either put in the time and effort, or don't bother at all.
-
I Tried To Learn C++ In 7th Grade I might pick it up again.
Spectre replied to LessThanThree's topic in Programming
It seems that everyone has a different opinion, and that everyone is an expert when it comes to how you should learn different programming languages and in what order. So here's my two cents. Visual Basic is not a very good language. There are certainly things that it is useful for, and if you need to develop something quickly then it can do the trick; however, as it is a relatively high-level language, it is significantly slower and less powerful than some of it's lower-level counterparts, such as C. If you don't mind this, and you don't intend to ever learn a lower-level language, Visual Basic is probably going to do you fine. But because of the almost pseudo-like coding involved, it is going to teach you to become a 'lazy' programmer (regardless of whether or not you want to acknowledge that), and it is likely you will have difficulty moving to another language such as C which is significantly more complex - the majority of people that attempt to make this move usually end up frustrated and give up. It is not required that you learn C and then C++. You can learn either in any order, or only one, and be just as good a programmer as you otherwise would be. C++ has pretty much superceded C, so you are probably better off 'knowing' the latter than the former, but neither requires knowledge of the other. Although some people may find it easier to pick up C++ if they have previously worked with C, others may find it just as difficult either way, and some people may even find it more difficult to move to C++ after C because of some of the differences in the two languages. If you are looking to learn a comparatively simple language before moving on to C/C++, I, personally, would recommend going with one of the scripting languages PHP or Perl, or both, in that order (PHP is generally easier to learn than Perl). The two of these languages slightly resemble C in syntax and in some of the functions. But anyway, there are no shortcuts to learning a programming language, much like learning a spoken language. You can read all the tutorials and books you like, and download all the example source code you can find, but it is still going to take time, practise, and dedication. Although people may be able to help with the learning process, no one is going to be able to teach you all there is to know about the language in question. And remember that it's the same for everyone - some people may pick it up quicker than others, but every single person who learns a language has to go down the same long road, and through the same things. So don't get discouraged and give up if you think you aren't learning fast enough. -
How Do You Find Lines In Php? The Title says it all :P
Spectre replied to scab_dog's topic in Programming
I think we get the picture. A text editor which displays line numbers. Got it the first few times. Anyway, daman, an easy way (in my opinion, anyway) is to use PHP to find the troublesome block of code, something to the effect of: <pre><?php$code = file('script.php');for( $i=error_line-5;$i<(error_line+5);$i++ ) { $output[] = isset($code[$i]) ? $code[$i] : '';}echo implode("\n",$code);?> It's often easier to spot errors if you can crop the section of code causing the problem. -
It's not really possible to detect when a user closes their browser window, per se. There are ways to do it - such as raising a window with the JavaScript OnClose() event, but that isn't reliable as not all clients are going to support it, and it could be blocked by anti-popup software and the like, as well as any number of other possible problems. The way IPB works out which users are online is by tracking their movements with a timestamp of their last page view, and then automatically removing all session data for each user that has been inactive for a certain amount of time. Although it makes it easier that there is a login system, you would be able to use cookies, session data, or the client's IP address to track their movements and remove their session from the database when they don't refresh a page for, say, 20 minutes. Unfortunately, this isn't a 100% surefire way of doing it either, as visitors may share an IP address or block cookies or not support session information being stored, but it is probably your best bet.
-
Change The Name Of The Paging Depending On Db Resu
Spectre replied to kvarnerexpress's topic in Programming
I would probably do something like this (similar to what beeseven suggested): <?php// Obviously, this isn't a real function, just an example. $result = extract_database_information(); $page_title = $result['page_title'];?><html><head><title><?=$page_title == '' ? '' : $page_title . ' - ';?>Peoplesdatabase.com</title></head><body>... -
Open Php Page From Another Server If a server does not support php
Spectre replied to p_a's topic in Programming
It is almost impossible to create an online guestbook or other such feature without being able to store content on the server (which would require a server-side language). It is possible, however, to incorporate PHP scripts from another site - but it could be quite risky, security wise, as you would need to pass all data to the script out in the open where anyone can see it. One solution might be to set the 'action' of the form to point to the script on your other server, then have that script redirect users back to your other site once finished. As for including content from scripts within pages, it would be difficult to do so without the use of frames - in a 'normal' environment, the script would be able to modify and add to the output before it is sent to the client, but as it is obviously unable to do so in such a situation, the only solution that I can see is using frames. I'm don't think that it's possible, but you may be able to have JavaScript retrieve the contents of a webpage, store it in a variable, and then display it somewhere in the page. I avoid using JavaScript wherever I can, so I don't know - but it's unlikely it would work, as JavaScript has little to no file handling abilities (particularly where remote files are concerned). A very unpractical (to the point of being absurd) solution could be to have the script on the server that supports PHP to generate an image containing the text and then display that image on your other web page. There are obviously a million reasons why this would be a stupid idea, but at a pinch, it could work. There are various sites around that provide 'free' (usually ad-supported) guestbooks and other such remotely hosted scripts, but I'm quite sure most of them use frames. -
Try changing $uploadDir = '/uploads/'; to $uploadDir = $_SERVER['DOCUMENT_ROOT'] . '/uploads/'; As it is now, PHP will try and copy the uploaded file into the '/uploads' directory on the root of the server - not the root of your site, which is probably something like '/www/username/public_html/'.
-
Opaque Gift Sig t ospice up your sig block :D
Spectre replied to Saint_Michael's topic in Graphics, Design & Animation
As great as that is, do people really need to have enourmous images in their signatures taking up immense page space? -
Uh, yes... I think you're missing what I said. A hypertext reference is treated by the client as relative to the current directory (and directories are obviously delimited by a '/'). Which is why I said that I think you should always specify a link's path relative to the root directory of the site, NOT relative to whatever directory you are currently in.So if you were current viewing '/fo1/index.html' and wanted to get to '/fo2/index.html', then in my opinion, it would be better to specify a link to '/fo2/index.html' rather than '../fo2/index.html'. Or if you were currently viewing '/fo1/fo2/fo3/fo4/file.html' and wanted to get to '/fo1/index.html', then you should use '/fo1/index.html' as opposed to '../../../index.html'.Anyway, you're obviously free to create your web pages however you wish.
-
Php Menus Without Javascript Has PHP possibility to do it without JS
Spectre replied to p_a's topic in Programming
You can use PHP to send the HTML/DHTML/JavaScript/whatever code to the client. The dynamic generation could be done with PHP to change the entries the menu contains, for example. The actual menu would be constructed using, most likely, a combination of HTML and JavaScript. I don't know why anyone would want to do this - menus are usually a static method of travelling around a web site. Such as: <?phpecho '<whatever>' . date('M jS') . '</whatever>';?>