Jump to content


  • Posts

  • Joined

  • Last visited

About Deji

  • Birthday 01/01/1994

Previous Fields

  • Languages
    C++, ASM, (X)HTML, CSS, PHP, SQL, JavaScript, jQuery, Ajax, RSS, BB Code?

Contact Methods

  • Website URL
  • ICQ

Profile Information

  • Location

Deji's Achievements


Newbie (1/7)



  1. This is absolutely awful. That's why I'm throwing it out there for anyone who wants it: https://pastebin.com/C0WLbbmN It's an API for generating HTML code using object oriented programming. It sounds nice, but in reality OOP just doesn't fit with HTML. Here's an example of creating a simple page using this god forsaken API: <?phprequire("html.inc.php");/*EXAMPLE 1: Nested Tags<div class="myImagePlaceholder"><a href="/myimage.png" title="click me!"><img src="/myimagethumb.png" alt="" /></a></div>*/$myImagePlaceholder = new html_tag_div(new html_tag_a("/myimage.png", new html_tag_img("/myimgthumb.png")));echo $myImagePlaceholder->build();/*EXAMPLE 2: Adding content without arrays.<div id="myDiv"><h3>Hello World</h3><br /><p>Do you know who I am?</p></div>*/$myDiv = new html_tag_div();$myHeader = new html_tag_header(3, "Hello World");$myParagraph = new html_tag_paragraph("Do you know who I am?");$myDiv->add_content($myHeader, new html_tag_linebreak(), $myParagraph);echo $myDiv->build();/*EXAMPLE 3: Adding content with arrays.<select name="religion"><option value="scifi">Star Trek</option><option value="pirate">Pastafarian</option><option value="normal" selected="selected">Sun Worship</option></select>*/$options = array(new html_tag_option("Star Trek", "scifi"),new html_tag_option("Pastafarian", "pirate"),new html_tag_option("Sun Worship", "normal"));$select = new html_tag_select();$select->add_option($options);$select->set_selected_option(2);$select->set_attr_name("religion");echo $select->build();// Apologies for missing out satanism?> Yeah, for small bits of code, it's not that bad. But I'd advise against trying to create a site with it. It's incomplete but as you can see from the API code, it's very easy to expand with new tags and such. I stopped working on it when I started adding table classes as it just began to get ridiculous. Anyway, I'm not gonna use it myself and it's otherwise going to waste. So feel free to extend on it, use it, print it then burn it.
  2. Oh my bad. I swear I already cleared out the cache (and I've not used IE9 in months) but perhaps clearing all saved data and reconnecting the internet fixed it. There's still a slight issue of one login input box being 1px higher than the other, but since every other browser displays them inline, it's IE9's issue, not mine. Thanks anyway
  3. Didn't know where to put this topic, since the problem isn't specifically HTML or CSS, but it is a design compatibility issue. I have an Internet Explorer related compatibility issue. While the copy of my site installed on my localhost server is displaying fine in Internet Explorer 9, the online copy is very messed up. Sizes of elements and positions are seemingly being ignored. Localhost{IMAGE REMOVED} Perfect. IE exceeds itself. Online{IMAGE REMOVED} Baaaad. Border radius' aren't working, the plus sign on the dropdown box in the top-right hand corner of the screen isn't scaled down, as set in the CSS. Most noticeably, the menu isn't inline (as forced by display:inline-block, IIRC). The only content difference between the two sites is what is in the database. But it has very little effect here. So I'm down to assuming IE9 is doing something wrong intentionally and I wondered if there was a way to correct this without having to dive into the CSS and HTML again.
  4. It's true that there is no way to get file data out of a user's computer with JavaScript, but that doesn't mean use an iFrame. I just want to validate the data before proceeding to the next page. Luckily, I found another way to do that.
  5. It doesn't NEED to, that's just a way of doing it.
  6. Okay, first the "HTML". I know it's probably hard to read, I like to write everything super optimised and in PHP (you get used to reading through it after a while). But it's not really important... <form id="uploadForm" action="". $_SERVER['REQUEST_URI'] ."" method="post" enctype="multipart/form-data"><input type="hidden" name="mod" value="". $mod['id'] ."" /><table class="plain fullwidth"><thead><tr><th>". $lang['downloads']['field1h'] ."</th><th>". $lang['downloads']['field5h'] ."</th></tr></thead><tfoot><tr><td colspan="2"><fieldset class="stylish" style="padding-top:6px"><input type="submit" value="". $lang['downloads']['upfile'] ."" /></fieldset></td></tr></tfoot><tbody><tr><td><fieldset class="stylish"><input type="text" size="35" name="title" maxlength="32" /></fieldset></td><td><fieldset class="stylish"><input type="file" size="25" name="file" /></fieldset></td></tr></tbody></table></form> Now the PHP code (ajax.inc.php): if($_POST['act']=="upload" && $_POST['type']=="mod"){ require("getlang.inc.php"); if($_POST['title']) { $_POST['title'] = str_replace("c#38;", "&", $_POST['title']); if(strlen($_POST['title']) < 3) { echo $lang['downloads']['submiterror1']; exit; } elseif(!preg_match("#^[ a-z0-9\-\+%!'\"£$():\.,&\?]+$#i",$_POST['title'])) { echo $lang['downloads']['submiterror2']; exit; } } else { echo $lang['downloads']['submiterror2']; return; } print_r($_POST['file']); // testing the output ($_FILES is empty)} And the JQuery... $(document).ready(function(){ $("#uploadForm").submit(function(event){ event.preventDefault(); $("#upTable").hide(); $("#waitTable").show(); var $form=$(this),mod=$form.find("input[name='mod']").val(),title=$form.find("input[name='title']").val(),file=$form.find("input[name='file']").val(); $.post("/includes/ajax.inc.php",{act:"upload",type:"mod",mod:mod,title:title,file:file,}, function(data){ if(data=="1"){window.location.replace("/mods/ucp.php");} else { alert(data); $("#upTable").show(); $("#waitTable").hide(); } } ); The problem is fairly obvious. File form data can simply not be passed using this method. However I want to use something like this (which is why I ignored online tutorials and had to wing it). All the online tutorials show methods using iframes, which I don't want.And as you can see, I don't want to keep the page live if the upload is successful. I just want to validate the file BEFORE the page reloads.I can't find any way to do what I want online. So hopefully someone here can help.
  7. Backup. I considered the reluctancy of some browsers to submit upon clicking the images, so assuming JavaScript is enabled, it would take action of the form wasn't already submitting. I'll add it again if I find a browser doesn't submit when the images are clicked.
  8. Okay, sorry for "double posting" but that post was pretty long.I found a solution but it's far from professional: echo "<div class=\"langselect\"><form method=\"post\" action=\"". $_SERVER['REQUEST_URI'] ."\" style=\"display:inline\"><fieldset style=\"display:inline\">". $lang['main']['langselect'] ." <input type=\"hidden\" name=\"v\" value=\"99\" /><input type=\"image\" src=\"/images/flags/en.gif\" alt=\"English\" title=\"English\" /></fieldset></form><form method=\"post\" action=\"". $_SERVER['REQUEST_URI'] ."\" style=\"display:inline\"><fieldset style=\"display:inline\"><input type=\"hidden\" name=\"v\" value=\"3\" /><input type=\"image\" src=\"/images/flags/pt.gif\" alt=\"Português\" title=\"Português\" /></fieldset></form><form method=\"post\" action=\"". $_SERVER['REQUEST_URI'] ."\" style=\"display:inline\"><fieldset style=\"display:inline\"><input type=\"hidden\" name=\"v\" value=\"1\" /><input type=\"image\" src=\"/images/flags/ru.gif\" alt=\"Руский\" title=\"Руский\" /></fieldset></form><form method=\"post\" action=\"". $_SERVER['REQUEST_URI'] ."\" style=\"display:inline\"><fieldset style=\"display:inline\"><input type=\"hidden\" name=\"v\" value=\"2\" /><input type=\"image\" src=\"/images/flags/pl.gif\" alt=\"Polski\" title=\"Polski\" /></fieldset></form></div><img src=\"/images/logo.png\" alt=\"\" /></div></div><div id=\"left\">";
  9. I don't understand how I can retrieve the selected language that way... Here's the current PHP code. echo "<div class=\"langselect\"><form method=\"post\" action=\"". $_SERVER['REQUEST_URI'] ."\"><fieldset>". $lang['main']['langselect'] ." <input type=\"hidden\" name=\"l\" value=\"1\" /><input type=\"image\" name=\"v\" value=\"99\" src=\"/images/flags/en.gif\" alt=\"English\" title=\"English\" /><input type=\"image\" name=\"v\" value=\"3\" src=\"/images/flags/pt.gif\" alt=\"Português\" title=\"Português\" /><input type=\"image\" name=\"v\" value=\"1\" src=\"/images/flags/ru.gif\" alt=\"Руский\" title=\"Руский\" /><input type=\"image\" name=\"v\" value=\"2\" src=\"/images/flags/pl.gif\" alt=\"Polski\" title=\"Polski\" /></fieldset></form></div><img src=\"/images/logo.png\" alt=\"\" /></div></div><div id=\"left\">"; if( !defined( 'LANG_EN' ) ) define( 'LANG_EN', 0 );if( !defined( 'LANG_RU' ) ) define( 'LANG_RU', 1 );if( !defined( 'LANG_PL' ) ) define( 'LANG_PL', 2 );if( !defined( 'LANG_PT' ) ) define( 'LANG_PT', 3 );if($_POST['l'] == "1" && $_POST['v']){ $_POST['v'] = (int)$_POST['v']; if($ipbwi->member->isLoggedIn()) { //[...] } else { if($_POST['v'] == LANG_RU) $_SESSION['lang'] = LANG_RU; elseif($_POST['v'] == LANG_PL) $_SESSION['lang'] = LANG_PL; else $_SESSION['lang'] = LANG_EN; } echo "Click <a href=\"{$_SERVER['REQUEST_URI']}\">here</a> if you are not redirected"; header("Location: {$_SERVER['REQUEST_URI']}"); exit;} That's on the header of every page, before HTML output.Assuming in your example, when Portuguese was selected, the value of "Português" would be 1, would that mean I'd have to check each of the names to see which one of them is 1?And this works but I can't figure out how to remove all the default styles that browsers put to the button tag (which I'm sure is against the W3C Standard): echo "<div class=\"langselect\"><form method=\"post\" action=\"". $_SERVER['REQUEST_URI'] ."\"><fieldset>". $lang['main']['langselect'] ." <input type=\"hidden\" name=\"l\" value=\"1\" /><button name=\"v\" value=\"99\"><img src=\"/images/flags/en.gif\" alt=\"English\" title=\"English\" /></button><button name=\"v\" value=\"3\"><img src=\"/images/flags/pt.gif\" alt=\"Português\" title=\"Português\" /></button><button name=\"v\" value=\"1\"><img src=\"/images/flags/ru.gif\" alt=\"Руский\" title=\"Руский\" /></button><button name=\"v\" value=\"2\"><img src=\"/images/flags/pl.gif\" alt=\"Polski\" title=\"Polski\" /></button></fieldset></form></div><img src=\"/images/logo.png\" alt=\"\" /></div></div><div id=\"left\">"; And to continue the classic JavaScript yay/nay discussion :)Facebook has loads of bugs and have even outputted some of their PHP source code in the past, I hear... And Google has been ruined by JavaScript. The main reason I keep a JavaScript blocker (aside from ad blocking and tracking) is so I can get past the annoying "feature" of automatic searching as I type, which just causes an inability to get the URL for what I have just searched for (simple things really annoy the end user). As much as Ajax is nice, it's much slower than reloading the page and I have a really bad wireless internet service, so again, I'm a big victim of it (I believe there is no room for cache when Ajax is involved).jQuery does fix a lot of JavaScript issues but still has a considerably low response time. The most annoying thing is how many websites expect the user to have JavaScript and have no support for a lack of it, even for such simple things. Don't get me wrong, I do use it. But I make sure to try and keep it minimal and clean. I use it mostly for form validation and mostly on file submission forms (this is a case in which Ajax is bound to be faster, because the user doesn't have to wait for the file to upload to the server).EDITLol, JUST bumped into another annoying JavaScript thing.. How the developers seem to have a lack of understanding of the concepts "tabbed browsing" and the back button. So you see something on Facebook you want to click, right after you've clicked a link, then you press the Back button to see what it was. Unfortunately, Ajax has changed that with completely new content. A bit irritating.And middle-clicking on links to open them in a new tab, which I do for most of the links I click. Unfortunately they decided to implement some JavaScript to make it open in the current window instead. And JavaScript popups don't help either. What's wrong with target="_blank"? At least that supports tabbed browsing and doesn't leave me with a tab containing an empty page and a weird URL (a JavaScript command). Okay, I'm done. I have a tendancy to rant when something annoys me
  10. Dreamweaver. I use barely any of the features aside from it's text editor, FTP and file browsing but I'm used to the interface. It makes it easy to work with my localhost server.
  11. Thanks for the reply.As I said, I use PHP to do everything. So the source HTML of the page is completely different to what I've actually done. It makes it go to the homepage because I was on the homepage when I opened the source.W3Schools shows that image is a valid type.I tried to use the <button> tag but it seems to be impossible to remove all of Firefox's styles for it. And changing a button to an image using CSS hacks doesn't feel like the best way around it, since there was an attribute made for submitting values with images. Still, if it's the only way, I'll consider it.My issue is mainly not with JavaScript but how it is used and how depended it is. It's a web designers dream (despite the fact it steers away from well known syntax standards) but more often than not, a users nightmare... just look at Facebook and Google That's why I use a script blocker on most of the sites I visit.
  12. I've been designing a website for a while with multilanguage functionality. I managed to create easy language switching by clicking an image of the appropriate flag in the corner of the website. I made it a form since it allows PHP to do what it needs to do after submission, then reload the page to get the new language to actually appear.So after clicking a flag, the form would send to a page (the same page) and the PHP header file would take care of what it needs to do. Then another redirect is made to the same page (without being apparent to the user). It works well but relies on the use of a form to work.The problem is that since I made this, it has suddenly stopped working. I'm assuming because of updates to Firefox and Internet Explorer. <div class="langselect"><form method="post" action="/"><fieldset> <input type="hidden" name="l" value="1" /><input type="image" name="v" value="99" onclick="submit()" src="/images/flags/en.gif" alt="English" title="English" /><input type="image" name="v" value="3" onclick="submit()" src="/images/flags/pt.gif" alt="Português" title="Português" /><input type="image" name="v" value="1" onclick="submit()" src="/images/flags/ru.gif" alt="Руский" title="Руский" /><input type="image" name="v" value="2" onclick="submit()" src="/images/flags/pl.gif" alt="Polski" title="Polski" /></fieldset></form></div> It used to send to "$_POST['v']" in PHP perfectly. But now, only "l" is sent.
  13. I decided not to do it because of more tables and more queries that have to be done. I've used that technique plenty for my downloads system, though.Still, it seems my way of searching within a serialized array is probably the only way.
  14. If you're asking for an oppinion, I'd say the first one would be better. Purely that it uses commands already part of MySQL.The 2nd one might be problematic with strings? I'm not sure... It should work fine as long as the input is valid.
  15. But my website isn't based entirely on cars.. It's a pretty small part of the whole idea.To be more specific, I could add that the cars aren't even real. I didn't think this info would be part of the answer so I decided not to bother on specifics of the usage, I was mainly using it as an example. Chances are I'll have to use a technique like this in future, anyway.What's more, adding a new database is frankly a messy task with my host so I want to keep the number of extra tables low, since there are already about 120 tables taken by the IPB Forum and my other systems.This idea of using serialization was from the example set by the other tables that were created for IPB. They use serialization for all data for which there is not a guranteed number of fields.For example, I'm allowing user input and maybe my members will decide to add information about the cars handling... They may give information such as "acelleration", "mass" or even more advanced information about the car. Stuff which I know nothing about. I want to ensure that all this data will be displayed properly. With an array, showing the data inside is easy and can be done by automatic processes.However, a new table requires changing the code based on that table... And changing the table based on what people want to put into it. "you should have another table, say called specs, that holds all possible specifications" is not possible when I don't know half the specifications.It's a bit hard to explain.. but basically this is all done on one page. The page is simple and even uses Javascript functions to order the elements on the table. Everything is done but the search, for which there are automatic options. For example, if someone provided information on how many wheels the car has, a new search option would pop up allowing the user to search for the desired number of wheels. Well, maybe I won't go that deep (since there are only 212 cars in the database anyway, and most visitors know about them all) but I do this mainly for education and exploration... Good for next years college course and such.You're probably right about the database usage in the long run and I should some day read more into using databases, but I was looking for a solution on the PHP side of things, since my tables are already set up how I'm used to using them and I'm not looking for a database commited to this page in particular.Sorry for any confusion.
  • Create New...