Jump to content

DarkElf

Members
  • Posts

    103
  • Joined

  • Last visited

Everything posted by DarkElf

  1. Forgive me if I'm wrong, but that looks like they are just shifting the contents of a paragraph not included in the div up the page using position relative so that it appears to be inside the div?It's a nice idea but doesn't quite work for my problem as my div is not of a fixed size.
  2. I've been having a lot of fun with this opacity stuff, however I've just noticed a problem on my pages and can't work out how to fix it.Basically I've got a div which contains text and images which has opacity of 75% so that the background image is partially visible through the div. But it turns out that not only is the div itself transparent, but all of its contents are as well. This is barely noticable with black text, in fact until now I hadn't spotted it at all, but once I started adding images its quite obvious and isn't the desired effect. What I want to do is make the background colour of the div only transparent, the contents should preserve their full opacity.Is this possible? I tried changing the opacity values of the images but that only changes their opacity in relation to the div, not the background image!
  3. It's possible to rewrite the php files everytime you update the variables, you just need to set the correct access permissions on the files.But you are creating hurdles you don't need to! What you are effectively talking about is flat files, these used to be all the rage before relational databases. The reason relational databases are now used so commonly is because they are much better at the job.If you really want to use a flat file system I would go back to your xml files. Just place them in a folder without public access, that way a public request for them will be denied but your php scripts (executed on the server) will still be able to access them and do what you want with them.
  4. There are loads of things you can use to make a game, for your text based style game I would suggest the following:1. A good working knowledge of html/xhtml, css, and javascript (you are making a website after all).2. A good working knowledge on xml - I'm a bit of a hypocrit here as I've never used it much, but it goes with the above point.3. An extremely good knowledge of a server side script such as PHP or ASP, or possibly another more powerful scripting language that can be integrated with the web.4. An extremely good knowledge of a database system, MySQL is a good one for beginners.5. If you want to take this seriously you will really need to run this on your own server........ learn a lot about this.Basically you've got a lot to learn about a lot of things on the internet.
  5. Always check for other threads on your topic before posting, you will often find the answers you are looking for http://w3schools.invisionzone.com/index.php?showtopic=5409
  6. DarkElf

    Blank Field Check

    This is normally something you'd do with javascript before the form has been posted, but if you want to do it with php then you could use a simple if statement to test each field. The best way to do it would be an if with an is not (=!) clause to which will return true if the value isn't empty. Something like: if($_POST('fieldname') =! ''){code to be executed} This can be followed by an else clause if you want it to do something special if the field is empty.
  7. Which assumes you have that kind of control over your server (if you are renting webspace that is quite unlikely!)
  8. What do you mean by tools? as SFB says, php itself can be downloaded from php.net if that is what you mean.If you mean the tools for writing and working with php then you just need a simple text editor such as notepad, nothing more complicated is required.If you want to test php scripts on your pc then you also need to install a server and php, this can be done the easily by using a prebuilt package such as xampp.
  9. Without wanting to dampen your enthusiasm (which is great).... The coding you need for those kind of games can get pretty complicated (I'm talking thousands and thousands of lines of code). As with a lot of things in life, you can't just dive straight in at the deep end, you need to start somewhere simple and learn the building blocks step by step.Build lots of websites and learn to use PHP to perform simple tasks for these sites. Once you're comfortable with that you can start using it for more complex things and eventually you will gain the knowledge and experience to build your game. You will probably also find you need to learn some other skills such as using a MySQL database.You have to understand that what you are asking for is not something you can write a tutorial on. Its not like there is a set piece of code for these things that you change a few values in and there you have it, if it were that easy everyone would do it. You're talking about something on par with writing your own piece of software. You need to master the basics first and then learn how to apply them to increasingly complex situations.
  10. Not sure where the slashes come in, but I think you can do it using query strings.The query string variable is added to the url: www.mywebsite.com/index.php?page1To retrieve the variable use this: $variable = $_SERVER['QUERY_STRING']; The you can then use variable in your code, this could for example be the name of a file that contains the content to be displayed on the page, therefore you can use your index.php file as a template and import the content using something like this: $content = file_get_contents($variable.'txt');echo '<p>'.$content.'</p>';
  11. You need to store the titles in an array, and then have a subarray under each title storing the subtitles. You can then use nested foreach loops to work through the main array and then each subarray to list the contents.
  12. Ok, I don't approve of just giving people the answer, on top of which I've not got time to try it all out and test it, but here are a few things you could try playing with.The first thing that leaps out is that you've got all those pictures floating left, floats can commonly cause problems in which things spill out of divs (exactly what you are seeing now). You have to have the float there so try and see if you can find another way to ensure the div stays the right size other than purely expecting it to resize to fit the content. If you are only ever going to use the same number a size of images then you can simply set the dimensions of the div. Otherwise you may need to use a script to resize the div based upon its contents, this can be achieved with both server and client side scripts depending upon your preference.The other thing I notice is that all those images are inside a <p> tag, I'm failing to see the neccesity and this may also be possibly causing problems. You can acheive exactly the same effect without the <p> tags be reassigning some of those values either to the div or to the images.Go away and have a play.
  13. I can't see the problem immediately, but its likely to be something you've missed out. A fair few problems between browsers arise when they apply different css defaults to values; the IE default gives you the desired effect but the firefox default doesn't so you need to make sure you define the problem value.Although Firefox is a better browser, I must admit I always find problems occur in Firefox more than IE, the best way around this is test your scripts in Firefox and other browsers from the beginning. Its a pain if you've been writing a script and testing it in IE all along, and once its finished you then have a look in Firefox or Opera or something to find that it looks horrible and you've 100 lines of css to find the problem in!
  14. Brilliant thanks very much.Apologies, I should have looked on php.net, I'm turning into one of those lazy people who don't think for themselves
  15. Thanks guys, I can't believe some of the things they go into in the article, its a fair bit more powerful than I had thought.
  16. I want to set the background colour of a div to be partially transparent so that a image behind shows through a bit but not completely (so its still easy to read text inside the div). I am aware that there is an opacity property in CSS 3 but as this isn't yet supported by some of the main browsers I'm loath to use it.I know there must be an alternative (though probably more complicated) solution that is supported by more browsers because I recall seeing the effect applied previously in older browsers.Does anyone know of any good articles on this?
  17. Who are you and what is this all about?This isn't exactly the most professional of advertising environments so you aren't quite inspiring me (or anyone else) with confidence about who we might be working for/with. You need to tell us what this is about and show us some credentials. You also need to tell us what money is involved (you use the word professional so I assume you intend on paying people).
  18. PHP has this really useful ability to handle variable variables, these can be written as such:$$variablethis can be really useful in certain circumstances, for instance where you are writing a script to perform the same action on numerous variables but you don't know the name of the variables when writting the script. I've used this in many instances to great effect.I've recently discovered a problem using this in an array though. I'm trying to refer to a specific key in a variable array and it doesn't work. I'm refering to it like so:$$array[$key]This simply doesn't return a value, if i just refer to $$array i get the usual response. Any suggestions?
  19. Yes, it's the SMTP that is the problem. However I have absolutely no idea how to fix this, personally I would just add the address to your hotmail contacts and the problem is solved
  20. DarkElf

    No MySQL results w/ IE

    If Firefox displays the results then it's neither an SQL or a PHP problem, there must be something in the end HTML that IE doesn't like, can you give us that to have a look at? (i.e. the source code that is sent to the browser after all PHP is parsed)
  21. DarkElf

    variables in URL?

    I don't think so. $_GET is a global array used to retrieve information passed to the current page by the HTML 'get' method - most commonly information entered by the user on a form (although most people would use the 'post' method and I have to admit I've never quite worked out why you would ever need to use get instead, if someone else would care to explain I'd love to hear an explanation).You should note that information passed to a page using either the post or get methods is also available to the $_REQUEST global variable, this is occassionally useful.
  22. I'm sure I'm not the only one who gets annoyed by the small number of topics that seem to come up again and again in certain parts of these forums.I tend to spend a lot of time in the PHP forum and I especially see a lot of posts relating to; email forms, sessions and login scripts. I'm sure that other parts of the forums also get lots of similarly repetative requests.Whilst the best solution to all these problems would be for stupid noobs to run a search for what they are looking for before diving straight in and posting, that is never going to happen. Unfortunately the law (in most parts of the world) prevents us from shooting them as an alternative.I see two plausable solutions: Some of these requests may be solved by building the answers into the w3schools tutorials, but I actually don't think that this would be the best or appropriate solution in all cases. The tutorials are about teaching eager young developers how to use the languages involved in web development, not about spoon feeding them all the scripts they will ever need. The other alternative would be for someone to run through all these repetative posts and pick out all the best responses people have given in the past, and then collate these into a few stickies that might get the noobs attention before they start wasting everyone elses time.I certainly would be willing to devote a little time to addressing the problem topics from the php forum and was wondering what other people thought, or if anyone had some other ideas?(before anyone says anything - yes I do note the irony that this is another topic that has been widely discussed/whinged about)
  23. DarkElf

    variables in URL?

    This is for the benefit of anyone else who might want the answer to this question, I had a bit of fun when I first tried to work this out myself so figured I would give a detailed answer here:You can store strings in a url very easily, you simply add a question mark '?' and then whatever information you would like to the end of a url. The browser calls the url upto the question mark and then ignores the rest of it when calling the site, so you really can put whatever you like after it. That's it, it's that simple, you can store whatever data you like in a url in just that way.Once your browser has called the url with added string it is then available to your PHP scripts using the 'server' superglobal. Simply call the variable $_SERVER['QUERY_STRING']. This isn't entirely that useful for storing variables; it simply returns the string. However a few 'explode' statements later and you can turn your string into any type of variable you want.It's all very easy really, the real question is why would you want to do it? The main use of this form of passing a variable is to replace cookies. Cookies are great, but they don't always work - they are easily disabled by the users browser settings or other security features. This form of passing variables can't be disabled. There are of course obvious disadvantages, mainly that your urls will start to look a bit messy. Also remember that information passed in this way is no more secure than cookies (in fact its less so because any old fool can look at the screen and see the extension to your url, but most won't know how to find and look up the details of your cookies!).
  24. There is a function called add slashes which you can perform on a string like so: $string = addslashes ($string) That will add a backslash to all character's that need escaping, Is that what you are after?
  25. DarkElf

    Login Page Codes

    a very simple example, and not the most secure, but here's a start:page1.php will contain a user name and password form which submits to page2, if you don't know how to do that then you need to go back and read the tutorials. page2.php can look something like this: <?php//start sessionsession_start();//create login variable$_SESSION['login']='no';//get inputted username and password$username = $_POST['username'];$password = $_POST['password'];//check username and password and set login variable if correctif $username == 'DarkElf' {if $password == 'Spoon' $_SESSION['login'] = 'yes'; };?>DOCTYPE....HTML headers.....<body><?php//check login variable and display content accordinglyif $_SESSION['login'] == 'no' echo '<p>Sorry, you are not a recognised user, please go back and try again.</p>';else if $_SESSION['login'] == 'yes' echo '<p>Welcome user..... more page content etc.</p>';?></body></html> The second chunk of php needs to be included on every page of your site which you would like to be password protected. After succesfully signing in the user will be 'logged in' for the duration of the session (i.e. until they close that browser window).Please note that this is an extremely simple example, it only allows for one user and the username and password are hard coded into the php. You'll need to learn some considerably more advanced PHP and preferably a web database such as MySQL before you can start making genuinely useful login scripts.
×
×
  • Create New...