Jump to content

TeddyKiller

Members
  • Posts

    1,056
  • Joined

  • Last visited

    Never

Everything posted by TeddyKiller

  1. What do you mean by database indexes? What advice can you give to make code 'un'sloppy, apart from what AlexWD gave?
  2. Sure, the entire file needs to be treated as an image, using the header, putting the function into a seperate file. So if it MUST contain a url, I can't call the function inside the src attribute, and like I said before.. I can't exactly include the file with the function in my page because it'll set a header upon my page and turn it into image... o.O
  3. So if that wont work, what will? I can't use the function in a seperate file, because i'd need to define the header, which is whats causing the problem I believe. - If I included that into my page, the header would be set for that page so it will not recognise the html, right? No idea
  4. I pretty much put it in a function. Called it via ... imageResize($img['avatar'], '75'); added in the line of code imagejpeg($dst); and removed the header, and it jsut comes up with stuff like... �w��3׊VNx�Zy�$Ak��� ��s���s��=Ē�������E�@���d+��r~�VA@3�� So it needs the header, but if I put the header in, it gives the headers already sent error. Any ideas :/ I need to sort this out.
  5. Simple question, I don't know the answer. I access the resize script like.. <img src="resize_image.php?file=image.jpg&size=100" /> I want the resize script to be in a function. Thats easy to do, but how would I use it as it wouldn't be accessing it as simple as a page? My resize script is simple, very small and it ends with this header('Content-type: image/jpeg'); imagejpeg($dst,NULL,100); imagedestroy($src); imagedestroy($dst); Would it even be possible to put it in afunction actually as it uses a 'header' ? Heres the full resize script. <?php $pic = $_GET['file']; list($width, $height) = getimagesize($pic); if($width > $height) // so we can square up the crop area { $long_s = $height; $short_s = $height; } elseif($width < $height) { $long_s = $width; $short_s = $width; } else { $long_s = $height; $short_s = $width; } if (!isset($max_width)) $crop_width = $_GET['size']; if (!isset($max_height)) $crop_height = $_GET['size']; $dim_1=($long_s - $short_s)/2; //top left cords in original to anchor the crop area $src = imagecreatefromjpeg($pic); $dst = imagecreatetruecolor($crop_width, $crop_height); imagecopyresampled($dst, $src, 0,0,0,$dim_1, $crop_width, $crop_height,$short_s, $short_s ); header('Content-type: image/jpeg'); imagejpeg($dst,NULL,100); imagedestroy($src); imagedestroy($dst); ?>
  6. Most sites infact dont need to use server clustering if you have a decent dedicated server... but facebook once started off slow, and made shed loads of money through ads, so they could upgrade. I'm going up to a VPS to remove my inode limit and process limit. At the moment I'm limitting my site to 1000 users... just to be safe of that. Need to perhaps revise some of my code to see if i can speed it up even the slightest. The money that 1000 users can bring if setup correctly is quite good, just hope luck comes my way. By the time I need to server cluster, it'd be a major upgrade and a downfall of 1 weeks uptime maybe, but i should earn enough money to be able to do that and be happily with the changes... Hmmm.. I use alot of includes, because I have alot of classes... but theres not really a way I can reduce that is there apart from just get rid of it all?
  7. ooo .. can you explain more about that please? Also, what do you both mean about having loads of web servers, and database servers? How can you make a website run on multiple web servers? o.O
  8. My bandwidth is unlimited but im on a shared host, i know Unlimited isn't actually unlimited, its like.. unmetered or something. Though what do you mean by alot of database servers, and web servers?
  9. I believe its common knowledge that.. the more code you have, the slower your page loads. Though with sites like SMF, Facebook other HUGE sites.. how do they load so quick when they have aload of code? My site sometimes runs slow and I want to know how to speed it up. I'm not too sure if this is the right place, but it is the PHP i'm talking about, I have a massive config file.. consisting of a settings file, session and user file, language file, database file, mailer file, side bar file (but im removing that) and image file (again, removing it as It's going ot be included into pages that need it). This slows down website performance, as it really does take its time to load... apart form the two files with the brackets next to, all files included are needed for every page made so far. Now, maybe that config file, is tiny compare to some sites, but how could I make the performance of my code load faster?
  10. I understand that, cURL can grab information from other websites... but what exactly would I need to search for it?
  11. Hi. Basically, I've seen sites where you can sign in using.. facebook, google, other places. Now, I'm not wanting to be able to connect users to facebook from my site, but I do want to be able to offer some sort of service where another site can connect to mine. Is this as simple as an optional config file, or is it much more complicated than that?
  12. Yeah. The codes long though.. I had to change it to something like this.. $onSiteContinuedDiv = ' <table style="margin-left:40px;"> <tr> <td style="text-align:right;">Secret Question</td> <td "style="text-align:left;">' . $row['secretQ'] . '</td> </tr> <tr> <td style="text-align:right;">Secret Answer</td> <td style="text-align:left;"><input type="text" size="30" name="onSiteSecretA" /></td> </tr> <tr> <td></td> <td><input type="submit" name="onSiteSubmit" class="button" /></td> </tr> </table> '; echo '<script> $(function() { $("#onSiteDiv").show(); $("#onSiteFirstForm").hide(); $("#onSiteContinuedDiv").show(); });</script>'; The overall div, is onSiteDiv.. but I've seperated it into two inner divs too. So.. one hides, one shows depending on whats what.. this works fine. but if I ever tried to use $("#mydiv").html("Some html"); it doesn't work.. it doesn't record the new html. It shows in the source code fine.. but it doesn't actually change the content of the div.
  13. I have something like this - in php. <?php $onSiteContinuedDiv = ' <div style="height:1px; border:1px solid #DBE6F4; margin-bottom:6px; margin-top:4px;"></div> <table style="margin-left:40px;"> <tr> <td><span style="color:#e11919;">Sorry, you have not set any security questions. You cannot continue</span></td> </tr> </table>'; ?> <script>$(function() { $("onSiteDiv").html(<?=$onSiteContinuedDiv?>); });</script> This doesn't change the content of the onSiteDiv... and I'm not sure why. I'm wanting to change that content to $onSiteContinuedDiv ...how can I do it? What am I Missing?
  14. Mmmm.. I understand. It's just I want to be able to go $db->execute("query"); inside of functions.. and the only way is to pass $db as a parameter but over and over again just gets messy considering I have others too.. like $user. That is like $user->column_name and it gets the value for that user. Now using the define() method would use.. DB->execute("query") .. I think? Which I dislike the use of DB.. I always like it as $db, its just.. neater to my eye... but if it has to be used as DB instead of using 'global $db' then .. I guess I would have to do that. I saw information on a registry class.. but I do not wish the use Zend_config. I would like to make my own kind of registry class... although I don't understand much about it.
  15. global $variable; in a function is very handy. Although I've been told never to use them, but I'm not 100% sure why? I'm sorry if I've posted a thread about this before, I just still don't understand. I've searched for links and everything, but nothing that explains properly. Can anyone explain? Thanks.
  16. Theres alot of ajax, but i'll only post one form. (All forms run the same) // JavaScript Document $(function() { // Changing the pass onsite $("#passonsite").click(function() { if ($("#passonsiteDiv").is(":hidden")) { $("#passonsiteDiv").slideDown("slow"); if ($("#passonemailDiv").is(":visible")) $("#passonemailDiv").slideUp("slow"); } else { $("#passonsiteDiv").slideUp("slow"); } }); // Changing the pass by email $("#passonemail").click(function() { if ($("#passonemailDiv").is(":hidden")) { $("#passonemailDiv").slideDown("slow"); if ($("#passonsiteDiv").is(":visible")) $("#passonsiteDiv").slideUp("slow"); } else { $("#passonemailDiv").slideUp("slow"); } }); // Continue the onSiteForm $("#onSiteContinue").click(function() { $.ajax({type: "POST", url: "modules/forgotPassword/forgotPassword.php", data: {state: "3", email: $("#onSiteEmail").val()}, cache: false, success: function(html){ $("#continueForm").slideUp("slow"); $("#finishForm").html(html); $("#finishForm").slideDown("slow"); } }); return false; }); // onEmailForm Submit $("#onEmailSubmit").click(function() { $.ajax({type: "POST", url: "modules/forgotPassword/forgotPassword.php", data: {state: "1", email: $("#onEmailEmail").val()}, cache: false, success: function(html){ $("#onEmailMessage").html(html); $("#onEmailMessage").slideDown("slow"); } }); return false; }); // onEmailForm for Change Pass $("#changePass").click(function() { $.ajax({ type: "POST", url: "modules/forgotPassword/forgotPassword.php", data: {state: "2", pass: $("#newPass").val(), confirmPass: $("#confirmPass").val(), email: $("#changePassEmail").val()}, cache: false, success: function(html){ $("#changePassMessage").html(html); $("#changePassMessage").slideDown("slow"); } }); return false; }); $("#changeCancel").click(function(){ $("#finishForm").slideUp("slow"); $("#continueForm").slideDown("slow"); return false; }); $("#tryAgain").click(function(){ $("#finishForm").slideUp("slow"); $("#continueForm").slideDown("slow"); return false; }); // onSiteForm Submit $("#onSiteSubmit").click(function() { $.ajax({type: "POST", url: "modules/forgotPassword/forgotPassword.php", data: {state: "4", pass: $("#onSitePass").val(), confirmPass: $("#onSiteConfirmPass").val(), answer: $("#onSiteAnswer").val(), email: $("#onSiteEmail1").val()}, cache: false, success: function(html){ $("#onSiteMessage").html(html); $("#onSiteMessage").slideDown("slow"); } }); return false; }); }); <form action="" method="post"> <table style="margin:0 auto;"> <tr> <td style="text-align:right;">Email:</td> <td style="text-align:left;"><input type="text" id="onEmailEmail" size="30" /></td> </tr> <tr> <td></td> <td><input type="submit" id="onEmailSubmit" class="button" value="Submit" /></td> </tr> </table> </form> Sorry its messy. I've actually removed this now and kept it less complicated.. but I would like to find out the problem so I could use this method in future.
  17. How can I explain this? I have 2 onclick events, and.. well, it's explanatory in the code below. I have forms inside of the divs that get displayed via onclicks. If I complete a form.. Close the div (onclick event again, same thing) and then open it, or even open the other div.. it closes it.. It's like im clicking twice, only i'm clicking once.. it just slidesDown, and slidesUp. The code for that is.. // Changing the pass onsite $("#passonsite").click(function() { if ($("#passonsiteDiv").is(":hidden")) { $("#passonsiteDiv").slideDown("slow"); if ($("#passonemailDiv").is(":visible")) $("#passonemailDiv").slideUp("slow"); } else { $("#passonsiteDiv").slideUp("slow"); } }); // Changing the pass by email $("#passonemail").click(function() { if ($("#passonemailDiv").is(":hidden")) { $("#passonemailDiv").slideDown("slow"); if ($("#passonsiteDiv").is(":visible")) $("#passonsiteDiv").slideUp("slow"); } else { $("#passonemailDiv").slideUp("slow"); } }); When I complete a form, it goes through something like this.. // onEmailForm Submit $("#onEmailSubmit").click(function() { $.ajax({type: "POST", url: "modules/forgotPassword/forgotPassword.php", data: {state: "1", email: $("#onEmailEmail").val()}, cache: false, success: function(html){ $("#onEmailMessage").html(html); $("#onEmailMessage").slideDown("slow"); } }); return false; }); So I'm wondering why it .. stops the div opening and closing working properly, instead just opening it and closing it together with just one click. If I haven't clicked submit on any of the forms.. it works as it should do. Opens with one click, closes with the other. Has anyone else got this issue? How can I fix it? Cheers!
  18. Ok, if I take the button option. How can I do it?
  19. Right. what happens. I click the button, it says loading. Loading disappears and content is displayed. I click the button again, it says loading. Loading DOESN'T disappear and content is displayed.
  20. yeah, but what i mean is.. when the script has finished executing, clicking submit again doesn't get rid of the loading.. it brings the loading up and stays there.
  21. My next problem, is that if i clicked the submit, and click it again.. the loading message doesn't disappear... how can I fix this?
  22. Thanks. It would be this - $("#regTitle").html("Hello World");
  23. When completing a form, it goes through this process below. #changePassMessage gets a message.. eg: 'Your password has successfully been changed' but if I click submit again, it puts the message next to the message already there. What I want is to whipe that div before putting the new content in. How can I do it? $("#changePass").click(function() { $("#changePassLoading").slideDown("slow").html('<span class="loading">loading</span>'); $.ajax({ type: "POST", url: "modules/forgotPassword/changePassword.php", data: {pass: $("#newPass").val(), confirmPass: $("#confirmPass").val(), email: $("#changePassEmail").val()}, cache: false, success: function(html){ $("#changePassMessage").prepend(html); $("#changePassMessage").slideDown("slow"); document.getElementById('content').value=''; document.getElementById('content').focus(); $("#changePassLoading").hide(); } }); return false; });
  24. Some more info. If I put everything from the sendWelcome into the function that calls it, it works fine. I have config.php, which includes mailer.php and defines it as $mailer. I have a process.php, which includes config, and which calls the login function in session.php. That works fine. The login function has global $mailer; but that doesn't do anything. I know its bad to have globals, but im not sure how to pass it through. Any help?!
×
×
  • 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.