Jump to content

bltesar

Members
  • Posts

    109
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

bltesar's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. when using imagecreatefromjpeg() I sometimes get the following error mesage: Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 6400 bytes) in... The unusual thing about this is that it does not appear related to the image size.  It has worked for a 642K image while failing for a 610K image.  Any ideas why?
  2. your form can look like this- [code] <form enctype="multipart/form-data" method="post"> <input type="hidden" name="click" value=""></form> [/code] and then in the HTML of your page, the image will look like this: [code] <img src="pictobeclicked.jpg" onClick="document.forms[0].click.value=1;document.forms[0].submit();"> [/code]
  3. to your first onClick event handler         onClick="window.location.href='<?php echo $cart_url; ?>';" add ?c=300. Then set up your cart.php page to direct to the index.php?c=whatever page
  4. PHP can't do anything with onCLick unless there is a javascript function that sets the value of a form input that is then submitted to the server. e.g. [code] <a href="javascript:document.forms[0].some_click_flag.value=1;">your picture</a> [/code] then only when forms[0] is submitted will the server get some_click_flag and know that the picture was clicked. Perhaps you want the user to click and send stuff to the server without having to reload your page.  To do that, you can set upa hidden frame that holds forms with hidden inputs that are sumitted when the user clicks photos in the visible frame.
  5. thank you.  Are you sure echo $output will actually produce an image onscreen?  I believe in a previous post someone said that it wouldn't, that the data read from the file must somehow be processed into an image.  Also, do you think this method offers any advantages over the .htaccess approach?
  6. That doesn't make sense.  I've not had such behavior with refreshes.  Perhaps it is due to the settings on your browser.
  7. it seems we're not speaking the same language?! ??? what exactly do you mean by template?  If you mean a page with basic structure that is shared among many pages, but with some places for page-specific data within, it'll be something like this top of page shared by all pages a bit of data unique to page middle of page shared by all pages more data unique to page bottom of page shared by all pages what you do actually, instead of creating one template page, is create separate template pages for the parts that are shared by all pages, e.g. top.htm, middle.htm, and bottom.htm.  then each page in your site will be a .php page that looks something like this: [code] <?PHP         include(top.htm);         //code to generate output unique to this page         include(middle.htm);         //code to generate more output unique to this page         include(bottom.htm); ?> [/code]
  8. that should work.  perhaps you didn't show it, but for the first block of code, you don't have session_start(); The session variables really don't help you.  Anyone can go to the page once, without submitting the form, and the session variables will be set.  They can then navigate to another domain and from there submit data to your index2.php page.  The session variables will be preserved across navigation outside your domain.  I know because I have tested it.  By the way, that also means that testing for the $_GET and $_POST does not ensure data is submited only from your form.  One way to protect from this sort of hacking is to use HTTP_REFERRER.  This is not set on a lot of sites, and I do not even know how to make sure it gets set on my site.  What I do know is that if it is set, you can then make sure whoever submits data is coming from your site by checking that HTTP_REFERRER is set to your domain. Another way is to use .htaccess  Put all your receiving pages, such as index2.php, into a directory with a .htaccess file that blocks access from outside your domain.
  9. yes, it will still work with two arrays, but you only need to pass the $points array to the arsort function.  both arrays share the same key, so you sort $points by its values(not keys) and then go through $points and use the keys to reference back to the $names array.
  10. from what you wrote, it seems your form is using the GET method, so try what I wrote earlier, replacing $_POST with $_GET.
  11. doesn't arsort preserve the key=>value relationships, and so the assocaition between names and points should be preserved? another approach is to set up your array as follows: [code] $data=array('John'=>7, 'Peter'=>8, 'Jeff'=>2); arsort($data); [/code]
  12. What I originally wrote should work fine, except that these things are case sensitive.  The query should be SELECT COUNT(*)... Using that with totalrows=$row['COUNT(*)'] is preferred over just doing a SELECT *... because the latter approach will take up more resources because it actually gets all the contents of all the rows.
  13. did this code once work and then suddenly stop working correctly? this seems unusual- [code] if (mysql_num_rows($query)) { echo "NO ROWS"; $errorhandler .= "There is no such info in the database<br />"; $errorhandler .= "Please try again or contact us for questions<br />"; }[/code] because it should have a '!', or at least it seems it should, this code block won't be executed if the query failed for some reason.  How is the server's error display set?
  14. try [code] arsort($points);  //sorts array by values highest to lowest, preserving key=>value relationship. foreach($points as $key=>$value) {     echo $name[$key].'-'.$value.'<br>'; } [/code] of course, you could achieve your objective in many differnet ways.
×
×
  • 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.