Jump to content

deadimp

Members
  • Posts

    185
  • Joined

  • Last visited

    Never

Everything posted by deadimp

  1. I'm not entirely sure that GMail just uses AJAX, but rather a combination of that and iframes. As far as actually looking into the code, they've obfuscated their javascript, so it'll be as fun as crap trying to figure out how they did it.
  2. File uploads in AJAX would mean that a user would have to allow the browser (JavaScript) to read files on their machine. That opens all sorts of security holes, and if search for how to do AJAX uploads, you'll see that you'll need to make a couple of tweaks to Firefox's security to allow it to happen. The alternatives are your best choice.
  3. [url=http://pnotepad.org/]Programmer's Notepad 2[/url] - Open source, free, lightweight, highly configurable. The binaries are for Windows. There's also something called pypn, which I guess is pnotepad using python, but I haven't tried it yet.
  4. The code I posted is about as straightforward as it's going to get. You're going to need proportions, check if the image is proportional, if not, find the largest dimension, find out the relation between that and the desired size, and resize your image accordingly. That's in the middle of the code, which you can cut out if you don't need the multiple image formats or what not. Tutorial doing just that: link
  5. Is there a way to easily utilize a style of virtual inheritance in PHP? I'm looking for a structure where I could use the 'dreaded diamond structure', mentioned in C++ FAQ Lite. Where I would apply it: I have a database interface class, and from that class are derivatives. I have two abstract classes (though I don't name them as abstract) that extend this class: > OrderedItem - This manages manual ordering for database items, that way you can define a custom ordering. > UserItem - This item is connected to a user, something like a forum post, a news post, a comment, etc. What I would want to do is see if I could combine the two, have a child class extend both OrderedItem and UserItem (since at those levels of functionality there isn't really a collision). Is there a viable way to do this? Or am I just pot out of luck? It would suck if I was... I've never really need virtual inheritance in the language that has it, C++, but now that I do, I'm in a different one.
  6. There's always Thacmus. It's in beta development (alpha releases, though), and started about 2 months ago. I've been designing it for simplicity and ease of use and change. I don't have the framework / CMS enforce naming conventions, but I do suggest styles for organizational and aesthetic reasons.
  7. Just search the interwebs for code. I've got a thumbnail function in Thacmus (you can see it here, under Media::imgResize()), and there's more out there.
  8. The code I wrote before pretty much handles that. Just make each element in the array an array, containing the url and the image for the banner.
  9. I think you're looking for the implode() function. I'm gonna take a look at what join() does. EDIT: Nevermind, it's an alias. See what query is being sent to MySQL. If you're looking into use a key/value relationship for your values, try something like this: $stuff=array( "name"=>"Timothy", "age"=>22, "worth"=>null ); $q="insert into am_ups_xml ("; $val=""; //String to hold values foreach ($stuff as $key => $value) { $q.="`$key`,"; $val.="'".encode($value)."',"; //encode() isn't a function - put yours here } //Lazy way of getting that last comma off $q=substr($q,strlen($q)-1); $val=substr($val,strlen($val)-1); //There's probably a shorter way somewhere $q.=") values ($val)"; ... Another way would be to use an array function, split the keys from the values, and loop from there. Whichever way fits you the best.
  10. Your code looks like you come from ColdFusion or something... What exactly are your errors when trying to show the image according to category?
  11. What do you mean by headers? And why are you using such a large range for random when you're using about the same amount of weight per url? You can simplify it some: $list=array("ViewProduct.php?ID=123","Misc.php?Page=AboutUs","ViewProduct.php?ID=126"); $index=(int)rand(0,count($list)-1); //Get a random index inside there $Sboost=$list[$index]; What are the numbers in question?
  12. 1. As for how sites are structured and all that, the best way to get into this is actually skim through a couple of frameworks and what not. There are different stylings, different methods, each with their pros/cons (organization, automation (locating/using plugins), aesthetics (simplicity), etc). I have my own simple framework as part of my CMS, Thacmus, which you can browse through (online via Source or downloading the code), but let me say that this is for more or less of a hobbyist. In theory it and every other system could handle a lot of content, and could be made more customizable, but then again, it's how easily it can handle the content / be customized that counts. A good place to look for PHP 5 software is the GoPHP5 website. Look into the frameworks listed there. 2. Frameworks are the low-level bases of the site, meant for core functionality. They should include the simple, heavily used pieces of the system, something like a database interface, parsing tools, user handling, etc. The focus should be how easily could you create a large piece of software, and how easily it can be maintained, depending on its own coding and the framework's. 3. What's a league script? [This probably belongs in the Desgin forum]
  13. Look into PHP Date and Time, namely on how timestamps work.
  14. Search for currency conversion rates, or look into PHP locales.
  15. Your MySQL query isn't working (that's why there's a PHP warning about it not being a valid resource). Be sure that the table it's talking about exists.
  16. Look at count() / sizeof() in the PHP Manual. It should be in the Array section, so you should see other functions for arrays there.
  17. Look at imagejpg() in the PHP documentation, and it'll tell you how to save the image to a file.
  18. Well, this is kind of a PHP forum, but... You need a little more checking around that element, because a text field won't have a variable named 'checked', so that could create problems further down the road. function hasASelection() { var list=document.getElementsByName(t_id); for (k in list) { cur=list[k]; if (cur.tagName=="INPUT" && cur.type=="radio" && cur.checked) return true; } return false; } Though, I'm not sure what entirely this acheives, since by default you should have one radio enabled. By the looks of it, you only have one.
  19. Have you tried inserting a simple PHP script, something like this? echo "Test";
  20. I think including an install.php script in your software would be the best step, or just simplify your installation process to where no one would really need to use such a script (make a one-file compact configuration file). Having remote installation would make people, including myself, very uneasy, however trustful you make yourself out to be. As for moving the files around, you would need an FTP connection, thusly, FTP information. As for MySQL, you would have to make sure that you can externally access the database, which isn't always the case. You can just have the database created in the local installation file, which should be all they really need.
  21. Well, I'm not sure which session part isn't working, but take a step back for now and look at how repetitve your code is. You could easily simplify that and make it more flexible. Plus, intead of using forms 'n buttons for the process, it would be easiers to make links, with a url being "process.php?page=..." Example: (it's kinda messy, but you get the point) //Arrays aren't better than using a class, but for a simple example you'll see what I'm saying $pages=array( array("stuff","Stuff to happen"), array("blarg","Stuff that won't happen"), array("etc","Et cetera"), ... ); //process.php - Checking which page to include $page=$pages[0]; //First page by default, if no others are found foreach ($pages as $p) { if ($_GET['page']==$p[0]) { $page=$p; break; } } $_SESSION['pageselect']=$page[0].".php"; //I'm not sure why you're doing this in the first place... header("Location: index.html"); //Outputting the options echo "Select a step:<ul>"; foreach ($pages as $p) { echo "<li><a href='process.php?page=$p[0]'>$p[1]</a></li>"; } echo "</ul>";
  22. Try getting some sort of SQL sandbox, phpMyAdmin if you have it, and enter in that query and see what happens. Also, this line kind of got my attention (since it stopped the highlighter from working after that point): include("?va=<?php echo $clan_id_var; ?>&info=home"); If you're actually sending code by a GET/POST variable to be executed by that other script, then I gotta say that that's a really bad idea. This could allow people to inject code into your script that really shouldn't be run.
  23. I skimmed through your code right quick, and it doesn't seem like you actually outputted the image to a file. Look at the functions like imagepng() or imagejpeg().
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.