Jump to content

krillz

Advanced Member
  • Posts

    150
  • Joined

  • Last visited

Everything posted by krillz

  1. No problems, glad I could help. Hopefully you learnt a little in the progress
  2. format the string in the forloop so it only adds the class if the browser was recognised { visibility: inherit; } Target IE Method #6 $browser = ''; // declare it to prevent undefined error for($i = 4; $i if (strpos($_SERVER["HTTP_USER_AGENT"], "MSIE $i.0")) $browser = 'class="ie'.$i.'"'; } ?> <br />.ie6 p {color:red;}<br />.ie7 p {color:green;}<br />.ie8 p {color:blue;}<br /> >
  3. in the for loop just make sure it goes up to 8 as now it stops at 7. by doing $i *edit* making it clear in case you did not understand the above. for ($i=4; $i
  4. well to get the same result as in your example: { visibility: inherit; } Target IE Method #6 $browser = ''; // declare it to prevent undefined error for($i = 4; $i if (strpos($_SERVER["HTTP_USER_AGENT"], "MSIE $i.0")) $browser = 'ie'.$i; } ?> <br />.ie6 p {color:red;}<br />.ie7 p {color:green;}<br />.ie8 p {color:blue;}<br /> > some text
  5. the whole determining what browser, and then the second batch of if statements can all be done using a lot less code. Right now you are writing pretty much the same code all over again. And as I presume you have learnt is that whenever something must be repeated you should use loops to make the code smaller and cleaner. Your code can be rewritten as: for($i = 4; $i if (strpos($_SERVER["HTTP_USER_AGENT"], "MSIE $i.0")) echo 'IE '.$i; }
  6. well I see no harm in giving them access to an account with limited access, meaning they would not be complete admins to prevent them from doing everything. Just give them access to modify and add new content. The downside would be that you would have to spend a lot of time in a worst case scenario every week as they need new changes and what not added.
  7. you can either treat it as a form that will be sent whenever a change is done to the dropdown menu then display the specific team's point using php or another language in that particular table cell. check the onSelect() javascript function as a eventlistener to whenever a change is made in the dropdown box, you could call a function let say submit() that sends the form each time a change is done ( in other words a new selection is made) using a code like: document.myform.submit(); inside the submit() javascript option. The downside is that the site would have to reload, if you do not fancy that you should check some "ajax" methods instead. > </pre> <form> Select a Customer: NameOne NameTwo NameThree </form> <br><br><div id="points">Points will be shown here</div> <br selectuser.js var xmlhttp; function showUser(str) { xmlhttp=GetXmlHttpObject(); if (xmlhttp==null) { alert ("Browser does not support HTTP Request"); return; } var url="getuser.php"; url=url+"?q="+str; url=url+"&sid="+Math.random(); xmlhttp.onreadystatechange=stateChanged; xmlhttp.open("GET",url,true); xmlhttp.send(null); } function stateChanged() { if (xmlhttp.readyState==4) { document.getElementById("points").innerHTML=xmlhttp.responseText; } } function GetXmlHttpObject() { if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari return new XMLHttpRequest(); } if (window.ActiveXObject) { // code for IE6, IE5 return new ActiveXObject("Microsoft.XMLHTTP"); } return null; } Now in the javascript file we call getuser.php and beneath is the code for that: $q=$_GET["q"]; $conn = mysql_connect('localhost', 'username', 'pass'); // your mysql info if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("youDatabase", $conn); // change to your database $sql="SELECT * FROM user WHERE playerclubid = '".$q."'"; // the var q might be different in your case, so in the original html code you need to send the attribute needed. // Then query the database, perform the addition in php or in mysql using an appropriate querry. Do the formatting etc. echo "" // Echo the thing you want, in your case the team score. ?> This is just a very rough layout, just to give you an idea on how you can go about doing it. Just be adviced that it also means the code right now is open for exploits and you should add measures to prevent people from manually sending in harmful queries to the javascript function. Look out for sql injections, as I presume the clubid is an integer you could just check that the attibute is in fact an integer and nothing else, and this should be done in the php code before the query and not in the javascript. in the html is a instead, but I assume it should work with your current layout by setting the particular cell elemt's ID and using that. in this example we used the id: points.
  8. if you got the data in the database, you can simply just add another dropdown filled with that info. without seeing how your database is built up it's hard to tell you exactly what to do.
  9. there are a lot of different ways of doing this, from actually matching keywords to content, or the easiest one that became very popular with blogs were tags. You could add tags to each content that describe the content in a couple of words, and when people search it will simply list the content with these tags. And what coding platform you use is irrelevant php/asp.net/ruby/perl/python with mysql/sqlite/xml etc. you can code it in all.
  10. if you check how a mail is built up and function and by reviewing the structure of the mail() function in php you could come to the conclusion that by entering values like mail headers you could get the form to act like you wish, let say I inject a header with copies to all the emails in my spam list, ( not massive spam lists but still) I can get that form to send out spam using your adress as sender. This is a common mistake coders do in online mailforms and a lot of famous ones has at one point been known to have this lack of security and been abused. You should always check all input you are using the mail() function for headers like: TO: CC: CCO: Content-Type. And if these are found you should abort the script and notify that code injection is not allowed. Sorry but I've been working with web security for some good years now, and proof hacking applications are one of my tasks at work, kind of have a eye for these things.
  11. Your code is not protecting against header injections, with that code someone could hijack your form and use it to send out spam. Always make sure no headers are being sent via the inputs.
  12. do you have access to php or any other server side language? If so format it using php and send it through mail(). if not you will need to use javascript to format it into a string and then attach it to the body attribute in the mailto: function.
  13. this is known as cloaking and been known for ages by the landingpages community to quickly get on top positions in searches and save money on not buying adsense spots. However cloaking is part of what we reffer to as blackhat SEO, and you will be strongly punished when revealed by google to mention one. In short your site will either suffer from a ban or it will be put back a bunch of pages, which to be honest is like a ban. That technique was left out by us doing landing pages a long time ago after google started going down hard on sites using blackhat SEO, so I would give you the advice of not doing it. As you are cheating by filling the site with keywords you wanna rank good on without matching it with quality content. And will be seen at with anger by others and if not google themselves someone else will rat you out for ranking so high by cloaking keywords.
  14. krillz

    ip address email form

    you would have to do: $ip = $_SERVER['REMOTE_ADDR']; this will give you the clients current ip adress while visiting your site, however do concider the fact that most poeple do not have static IP adresses but dynamic. So if you are concidering doing a validation or auth script based on the client's IP adress alone this could cause a lot of trouble to the users having dynamic adresses. but I assume you are just using it to log the user.
  15. Make sure you've correctly setup the SMTP parameters in php.ini and aslo make sure that the SMTP server accepts relay in php.ini [mail function] SMTP = smtp.isp.net sendmail_from = me@isp.net change smtp.isp.net and me@isp.net to yours.
  16. the first page deosn't look like a gradient to me, more playing with different shades of the color to get a light effect, often used in posters. try this, fill the background with the color you want to use, let say grey #383838, now slect the brush, a big blurry with hardness 0. select a slightly lighter grey and apply it into the middle. You should now have something very similar to the first url.
  17. Mainly because it's very easy to set up and maintain, also very user friendly and got popular fast among people that maybe did not have the knowledge to publish their works online in a "professional" manner. With years the Wordpress api has become a lot more powerful and today you basically can use it as already stated in a reply as a content cms for any page layout, if you got the imagination then you can get it working. So why it's so popular is mainly because of the blog hype that brought it into its golden age, and soon spread to other areas thanks to the team investing in further developing it, not to forget it's a very easy api to learn and use, mostly thanks to it's modularity. And if you don't feel for wordpress you could check out joomla or other videly used CMS:s.
  18. if you want to preset the body data in the email you need to alter the mailto attributes, otherwise it will remain empty: Send me an email Now I checked your html, and I can see that you have more than 1 form in your source code, I would think you need to wrap all those into one form, otherwise when hiting the submit button all the different form elements won't be sent. Not that it matters in your case as you aren't sending them anywhere anyways. Check this example: action="mailto:yourname@yoursite.com" enctype="text/plain"> name=your_comments> value="Submit Your Comments"> However you have a lot of inputs, that you preferably would wan't formatted into a finnished string that you then attach to the mail body. otherwise you will only get the inputs and not the surounding text. But yeah anyway check the form to mail example I gave you, and recheck your code as it is not functional, I would rewrite and make it a lot cleaner as right now the sourcecode looks like a big mess, as M$ tends to add a lot of unneeded junk.
  19. Alright here are my 2 cents that you might want to concider before jumping into the project: - In short you are doing some kind of online webshop. So with that I have to say, that I do not think you got enough experience to be coding any webshop look a like cms. And it has nothing to do with it will most likely take a long time for you, but more as a respect to the users that will be using it. More specifically the costumers. As you need to concider a lot of safety and personal information storing that you need to keep safely, something you might not be as aware of after only creating a mailform. I would suggest that you instead of reinventing the wheel, with basic skills in wheel making. Instead start looking in php's great open source community. I can garantuee you that there are thousands of ready to go CMSs out there that you can download and build upon and costumize to meet the needs you are looking for. So check code.google.com and search for php + webshop, or something similar. Find a project with good reviews. In your case you should search for one that uses paypayl payments functions. Now you got your major problem solved. All you got to do is diesect the code, use the parts you need, and you are ready to go. It will save you a lot of time, and save you and your friends from any future blunders caused by inexperience. Don't forget to later study and learn how the codes work, and that's the way you learn php, at least that was how it worked for me back in the days, reading a lot of finnished code, and also a lot of broken non functional code, to understand why or why not it was working. And as it goes for mysql need. Sure you could go with alternative ways as saving into a text file, using SQLite, but I have to say MySQL tends to be a smoother way of doing it. However nothing stops you of saving each order in seperate txt file instead.
  20. krillz

    Quick pointer

    I solved it you can lock this thread. Solution if anyone is interested: function toggle(id) { var state = document.getElementById(id).style.display; if (state == 'block') { document.getElementById(id).style.display = 'none'; } else { document.getElementById(id).style.display = 'block'; } } I simply hold the text in a div already, in css set its display: none; to hide it. in the input element I use OnFocus => call the JS function making it appear, onBlur calling it again to make it hide.
  21. So yeah javascript is not my cup of tea, but unfortunately I need it done as my javascript dude called in sick. Basically I got a form, and onfocus on the different input elements text should be displayed in a div that is found on the side. So logically I tried something a long these lines: function change() { document.getElementById('info').document.write("Test"); } and in the input tag added onFocus="change()" but yeah that didn't work, anyone that can point this thing out so I can continue?
  22. Wicked... tried on Windows (pardon my foul language) box running Uniserver' date=' PHP 5.3.1, no problems... I'll figure it out I'm sure, now that I know the code's fine ;-P Thanks for your time anyway! (And thanks to Jon for a PUKKA tutorial) Hank.[/quote'] This error is caused because of php trying to treat a non object as an object and can be caused by numerous reasons here are some common mistakes: Check the constructors in the objects for being set incorrectly, as these type of errors I've come in contact with when the constructors can't set the values and they refer to null causing the fatal error. not using $this->varName and only $varName. Most common is functions that return either an object or a boolean value (True/False) and the code does not check which type the function has returned and uses methods that threat the return as an object. ( like the mysql_fetch_object() ) Another one is that the code has tried to treat something that is not an object as an object again: $thisIsNotAnObject->method() (like in previous example). Which is most commonly caused by calling an object that has not been initialised or it was copied from something else that was not an object.
  23. $this is not required but seen as a good practise to call on class wide or function wide variables within a class. It makes reading the code a lot smoother as you quickly can see and understand the code. so it's basically like this: $new_name = "Ben"; $this->name = $new_name; $this->name is in other words a variable called $name within that class. So assigning $new_name's value to $name is what happened there. Now for you to understand it better let's assume you have a class called Persons for let say a phone book, and you use the class Person to store details about these persons. So you would preferably want to store a new person, and access its details. Class Persons { private $name; // Variable that can only be accessed from within the Person class. private $phoneNbr; // -||- Function __Construct($personName, $personPhNbr ) { $this->name = $personName; // Assign the value from the attribute to the class variable $name $this->phoneNbr = $personPhNbr; } Public Function getName() { return $this->name; } Public Function getNbr() { return $this-phoneNbr; } } // add a person by creating a new object $p = new Person("John", "1234"); // displaying the name of the person stored in the object $p is reffering to echo $p->getName(); // displaying the phone number of the person stored in the object $p is reffering to echo $p->getNbr(); Now you have a nice way of adding persons and getting the info required. So you could now create an array where each element points to a Person class, and you have a nice organised and clean code. the "arrow" between the variable is just a pointer like in most OOP languages, in java it would be a dot but PHP have chosen to go with the arrow instead. In simple terms it says; $p which is pointing/reffering to an object of type Person, Access the function with that name in that object.
  24. So I remembering stumbling over this site some good years back, and have to say congrats on the success to the founder. Really good job and you have come a long way since I last visited. Now with that being said I would like to point out a little flaw in one of your texts that could mislead people to some degree: This is not really correct, and might give false impressions to people coming in contact with OOP through PHP for the first time. I have been programming in both java and php for some good years, and although PHP's OOP support has immensely improved from it's laughable attempt prior to version 5. The OOP was still weak although it had implemented most of the functions one would expect to find in OOP, it still lacked the ability of inheritance from multiple "mothers", namespaces to mention a few. Something PHP 6 addressed. So please revise the phrase Like Java and C#, php finally had a complete OOP infrastructure. As it really hadn't.
×
×
  • Create New...