Jump to content

ToonMariner

Members
  • Posts

    3,342
  • Joined

  • Last visited

Everything posted by ToonMariner

  1. just a test - get permission denied error trying to post the question i actually want to. wierd!!! any way here it is... Hi, I am not as clued up on the behind the scenes issue of php as i should be! Hence this.... (this relates to open_basedir btw) Could someone please explain the significane of the global and local valeus of the conf settings (as described by phpinfo). Running on my machine and viewing the ini file I see no instance where open_basedir has a local or global setting - just one option to set it (therefore I assume on shared servers, each site has its own ini file). Which setting do I need to consider if my scripts need access to files outside the open_basedir prefix?
  2. function print_link_item($item) { echo '<p>'; echo "<a href=\"$item['URI']\" target =\"'_blank" onMouseOver=\"window.status='$item['URL']'; return true;\" onMouseOut=\"window.status=''; return true;\">$item['Heading']</a> echo '</p>'; }
  3. Melv! Tony was correct! It appears that your installation on windows has register_globals turned off - which it should be these days anyway (hope they remove that config option in future versions). if you are passing through the url like you say (index.php?page=1) then BEFORE you include contents.php define $page by... $page = $_GET['page']; $page will be 0 (or false or even unset) unless you do so.
  4. hmmm maybe an execution time thing - you outputting lost of pics? is there any difference if you refresh the page?
  5. is it just gif's that don't display properly? if so check which gdlibrary you have installed - there was a period where gif support was not included some check out [a href=\"http://uk.php.net/manual/en/function.gd-info.php\" target=\"_blank\"]gd info[/a]
  6. use a regualr expression. so if the users submits a hotmail account in the registration form... if (preg_match('/hotmail/',$_POST['mail'])) { ...do stuff to stop registration... } you can also have... $stop = '/hotmail|'; $stop .= 'yahoo|'; $stop .= 'gmail/'; if (preg_match($stop,$_POST['mail'])) { ...do stuff to stop registration... }
  7. no. [code] $name = 'john'; $var = 'name'; echo $name; // outputs 'john' echo $var; // outputs 'name' echo $$var; // outputs john $name1 = 'john'; $name2 = 'pete'; $i = 1; $var = 'name$i'; do { echo $$var . "<br>"; $i++; } while ($$var); // this will output.. john pete[/code]
  8. Variable variables (as they are called) can be very useful. neylitalo has the basics correct.... $var = 'name'; creates a container so you can vary the varibale used so echoing $$var would echo out the contents of $name. It becomes really useful looping through similar variables like so.. say you have lots of variables called: foo1, foo2, foo3....foo4 now you don't have any array to loop through as they are all independant vars as far as php is concerned BUT if you do this $i = 1; do { $var = 'foo$i'; echo $$var; $i++; } while ($$var); that would echo out each and every variable fooNUMBER.
  9. yes. have a look at this [a href=\"http://uk.php.net/manual/en/function.get-html-translation-table.php\" target=\"_blank\"]html translation table[/a] Are you using a wysiwyg editor? it maybe that that generates the special entities - use the above table to do a string replace or something similar.
  10. you won't it aint your server and even if you somehow managed to install any piece of software on there, any hosting company worth their salt would have it off pretty damn quick. Go and find yourself a package with php and mysql (should be around the $100-120 a year mark i would imagine).
  11. writing code to find the section to cut out is difficult! what you can do in php is resample the entire graphic to make a smaller version of it. I have an upload class wirtten that you can ave that does this - just trying to find it - could take me a while. PM me later on and I will e-mail it to you with instructions.
  12. first thing you can do to make it faster is to change your for loops. In the declaration of the loop you use sizeof() as the count limit. This is very slow as it is evaluate each time the loop runs. change it to $stop = sizeof($cordinates); for($i = 0; $i < $stop; $i++) {..... do similar for the other loop.
  13. I think he means where is $page coming in teh sense is it a url variable (i.e. set in the ......php?page=1) or is it passed from a form using the post method (hence will be available in $_POST['page'])
  14. right sorry... thought you had set up a table on your database called validate - but its the actual database that is called validate!!! ok in the query line $updatedb = mysql_query("UPDATE `valadate` SET `var` = $_post($rand_no!)"); change that to this $updatedb = mysql_query("UPDATE `YOURTABLE` SET `FIELD` = $rand_no"); (don't know why you have that $_post($rand_no!) in - it won't work!) now you need to replace TABLE with the name of the database table you are using to store this in, and FIELD by the name of the field in that table that you are storing this in.
  15. I would still re-consider ussing the session id in teh file name. Remeber these are generated randomly - they ARE NOT unique to each user - each time you login in the seesion id will in 9 zillion cases be different to the last session id you had. Now if you set a session variable called ID and set that to the unique identifier for the user form your database - that would be a different matter and your system would then work.
  16. sorry try... } while (mysql_affected_rows() < 1);
  17. yes if you are talking about them logging in, placing an ad and it auto storing those together then you need only to use a session or a cookie. easy to write so go and look at the those sections on the php site.
  18. [code] do { $random_min = 1; // change to your min $random_max = 200; // change to your max. $rand_no = rand($random_min, $random_max); $updatedb = mysql_query("UPDATE `validate` SET `var` = $rand_num!); } while(mysql_affected_rows() === 0); echo $rand_no;
  19. You have already output some html before you have called the session_start() function. place it at the very top of your script and all shoudl be well.
  20. The error on your local machine is down to a configuration setting... Open your php.ini file and find the setting 'SMTP =' (its probably set equal to localhost. Now you need to change this setting to teh smtp of your own internet provided. I am with telewest so mine is SMTP = smtp.blueyonder.co.uk your will be different I imagine. If you have outlook or outlookexpress as your email app on you pc you can find the smtp you us in there.... TOOLS > e-mail accounts > view or change... > change. You shoidl then see a form and on the right hand side you will see 'Outgoing mail server' it is the text in that box you need to copy adn paste into your php.ini file. Oh and when you try it on-line again tell us what erros you are getting.....
  21. you will have to place the image generation script into a separate file... e.g. genimage.php [code] <?php $qry = mysql_query("SELECT `pic` FROM `yourtable` WHERE `uniqueid` = '$picid'"); echo mysql_result($qry,0,"pic"); ?> [/code] Then in your imgtag put this... <img src="genimage.php?picid=<?php echo $food_categories[$key][UNIQUEID];?>"> making sure you replace the UNIQUEID with the name of the field in your table that is the primary (or what ever else you use to identify it)
  22. well if you use the header function it must be used before you output any html. Now as you want to prevent this refresh problem, using the header to change the page after processing the data means that you no longer need to output any html in the script that does the insert/edit/delete form teh database. Therefore you won't get that error!
  23. When all the checks have be done and the query is executed, have the next line of code... header("Location: " . $url); Now url shold be another script that will display whether the query was completed or not. as part of url u can pass paramters so that this script can display messages and possible links like so... $url = "message.php?mssg=succes&back=form.php&next=index.php"; you can then do anything with those parameters in the new script and if you hit refresh it won't execute teh query again.
  24. $sql = "SELECT * FROM aaform WHERE (map1 IN ('$s_map1', '$s_map2', '$s_map3') OR map2 IN ('$s_map1', '$s_map2', '$s_map3') OR map3 IN ('$s_map1', '$s_map2', '$s_map3')) AND honor BETWEEN ('$to' , '$from') ORDER BY honor ASC"; I think anyway - long time since i used between. have a look around for it in the mysql manual you should find it somewhere.
  25. just have it as a link <a href="registration.html">Register</a> I suspect you will be back on here fairly soon...
×
×
  • 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.