Jump to content

son

Members
  • Posts

    1,024
  • Joined

  • Last visited

Everything posted by son

  1. Thanks for your inputs... Will have a go and see how I get on with this. Am on holiday now, but still need to finish this off. Guess a good incentive to get on with it as then there is no reason not to relax next to the pool:-) Son
  2. dsonesuk, As I have not much knowledge about Javascript would not even know where to start to change the code, so have to admit that I would be useless in trying this... davej, I realise that this bit needs to go in script tags within head section, but am not sure what else I need to do in html for this to work. I created a div with id="imgdiv" and put inside few images. But this did not work. How would I test your script? Thanks, Son
  3. I use in head of page; <script type="text/javascript">var mygallery3=new fadeSlideShow({wrapperid: "fadeshow3", //ID of blank DIV on page to house Slideshowdimensions: [800, 533], //width/height of gallery in pixels. Should reflect dimensions of largest imageimagearray: [["pic1.jpg", "", "", "Picture Holiday"],["pic2.jpg", "", "", "Picture House"],["pic3.jpg", "", "", "Picture Pool"],displaymode: {type:'auto', pause:4500, cycles:0, wraparound:false},persist: false, //remember last viewed slide and recall within same session?fadeduration: 1500, //transition duration (milliseconds)descreveal: "always",togglerid: ""})</script> As you can see the dimension of image container need to be entered and hence I think I have to get different script. As for the rest is just the given jQuery code in two separate .js files. Am not very good with Javascript and have been thrown into the deep end with this. This is why I would rather like to use something that is already working. Thanks, Son
  4. Okay. Got this. But issue here is that there are portrait and landscape photos and my friend want them in each case to be as big as possible. Maybe not possible then and have to stick to make either width or height 90%? And you think it is not a problem that slideshow sets dimensions? Shall I set them to very high then? Thanks, Son
  5. Thanks for your reply. I tried this with a website container which is 90% wide and high which was also set to position relative. I then set the image to 90% (width/height), but it looked distorted. The Javascript I used uses the exact dimensions and this is probably wher the distortion comes from. However, I am not very good at Javascript, so am not sure if the script used could be adjusted. Hence am after another one... Son
  6. Hi there, Does anyone know good Javascript slideshow that I could use on website where images adjust automatically to screen size? Am after a way to have website container and images adjust to whatever screen size is used... Found some marvellous jQuery slideshows, but they all seem not to be what am after... Thanks, Son
  7. Hi there, In a .htaccess with rewrite rules to make URLs more user-friendly I want to exclude 'real' files and folders from rewrite rules and have the following entries:RewriteCond %{REQUEST_FILENAME} -f [NC,OR]RewriteCond %{REQUEST_FILENAME} -d [NC]before my actual rewrite rules. It works fine, but I now found in error log the following warnings:RewriteCond: NoCase option for non-regex pattern '-f' is not supported and will be ignoredRewriteCond: NoCase option for non-regex pattern '-d' is not supported and will be ignored Why would pattern -f and -d not be supported? I have this from Apache Org website which states:You can perform various file attribute tests:'-d' (is directory)Treats the TestString as a pathname and tests whether or not it exists, and is a directory.'-f' (is regular file)Treats the TestString as a pathname and tests whether or not it exists, and is a regular file. Any ideas? Son
  8. Guess I ought to take things with a pinch of salt from now on... Thanks for your help:-) Son
  9. Thanks for this. I also was just now able to see their phpinfo() and it shows: mysqli MysqlI Support enabled Client API library version 5.1.66 Active Persistent Links 0 Inactive Persistent Links 0 Active Links 0 Client API header version 5.1.49 MYSQLI_SOCKET /path/to/mysqld.sock This is looking fine to me. Or is there anything else I would need to check? Think the guys at this huge host might simply not know all the features they offer. Still a bit strange they said it is not possible as this is not selling their product well... Thanks,Son
  10. Ok. Got you. They might have php5, but an old version of mysql and this is why they cannot enable mysqli. Do you know from which mysql version onwards mysqli would work? They say that they have mysql 5 and as far as I know we are now around 5.6.sth... Son
  11. This is what I thought. So, if host says they have php5, but no mysqli possible this does not make much sense, does it? Son
  12. Hi there,Silly question but is MySQLi extension something different to a MySQLi database? I am asking as a new host provides php5 on package we selected. This should normally offer the MySQLi extension. As far as I know it should contain extension since version 4.1. However, host said in correspondence that for a MySQLi database you would need to a different package. Am I now getting here totally confused? Son
  13. I use ini_set('display_errors',1);error_reporting(E_ALL); However, I find that often when there is an issue with a db nothing shows on page (in other scenarios works fine)... Son
  14. Hi there,I have an issue to retrieve and store data from/to two different dbs. On each page at top I have include_once ('/complete/path/domain.com/scripts/db.php'); // connect to databasemysqli_set_charset($dbc, 'utf8'); As now I need to also access another db I have created an additonal file to db.php which is called db2.php. They are different in the connect and select statements (remainder identtical) as $dbc = mysqli_connect (DB_HOST, DB_USER, DB_PASSWORD);mysqli_select_db ($dbc,DB_NAME);for db.phpand$dbc2 = mysqli_connect (DB_HOST, DB_USER, DB_PASSWORD);mysqli_select_db ($dbc2,DB_NAME);for db2.php As long as each is accessed separately everything works fine. However, I have now a web page where both dbs need to be accessed and I tryed: include_once ('/complete/path/domain.com/scripts/db.php'); // connect to databasemysqli_set_charset($dbc, 'utf8');include_once ('/complete/path/domain.com/scripts/db2.php'); // connect to databasemysqli_set_charset($dbc2, 'utf8'); which does not work. From the insertion of db2.php everything blank on page. If I insert it right at the top it is an empty page, if lower down it is blank from insertion point onwards which shows me that this is the incorrect way to use db2.php. How should I properly access the second db? The data is retrieved for main part of page where first db brings in data that sits in header and footer of relevant page... Thanks,Son
  15. I can see that the function itself does not return any data, but when I use$analyticUpd = escape_data($analyticsUpd);I apply the function to the data gathered from the form and then store this in $analyticUpd. I thought this then means that I "return" the value?Thanks,Son
  16. What you said totally confused me first as I thought to myself "This is what I thought I did. What can he mean?", but then looking at the relevant code again I could not believe that all this time I had not noticed that there is actually a spelling mistake in my variable name (see below): if (!isset($_POST['analytics']) OR empty($_POST['analytics'])) { $analyticsUpd = ''; } else { $analyticsUpd = $_POST['analytics']; $analyticUpd = escape_data($analyticsUpd); Correcting this solved the issue. I think that I am unwell so often seems to really affect my brains considerably|-) Thanks for your patience:-) Son
  17. So, thinking about what you are saying does this mean that I would need to manually replace any single quotation marks before assigning it to variable to avoid the issue and then bring them back before displaying content on web page? For example use htmlentities($analytics, ENT_QUOTES); before sending data to database and html_entity_decode ($analytics, ENT_QUOTES); to display in head of web page? Or is there a different, better method to deal with that sort of thing? Thanks,Son
  18. Hi there,First of all my apologies for getting back so late... Due to a health condition I am sometimes not able to do any work and hence the long silence. I hope this is ok.Regarding issue I can see the data in error message. Trying just <"test" 'now'> as an example including single and double quotes I get the following: [_POST] => Array ([MAX_FILE_SIZE] => 2097152 [title] => name [desc] => [analytics] => <"test" 'now'> [submitted] => TRUE [submit] => Change ) and UPDATE tableDB SET webTitle = 'name', desc= '', analytics= '<"test" 'now'>' WHERE pid = 1 So, the single quote before now stop analytics which is not correct and causes the issue. However, I assumed that the escape_data() funtion that I use on any variable before submitting to the db would take care of this... In var_dump() of analytics I also can see that <"new" 'test'> is as it is without being escaped. Any ideas? Son
  19. Hi there,I did not put anything in between the <textarea /> tags for this demo, but there was obviously some code before I submit the form which then deletes the code. The relevant textarea field is empty afterwards... Son
  20. Justsomeguy,I did dump the query and the analytics variable. The query is complete and runs fine, only that the value for analytics is empty. Also, when dumping the analytics variable it shows only string(517) "" without the value. The textarea is: <textarea id="analytics" name="analytics" rows="5" cols="60"></textarea> but var_dump($_POST['analytics']); show also only string(517) "" without the value. I am not getting this... Son
  21. Thanks justsomeguy. Sorry to get back late on this. Wasn't well for some time and just now back on my computer... It confirms my assumption that single and double quotation marks are escaped. This is weird as it simply does not let enter data in db with double and single quotation marks. Also, I have to correct myself: actually the single quotation marks cause the issue. When I replace all single by double quotation marks query runs just fine (but obvioulsly is usely as a function). The actual code is (analytics): <script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'GoogleUniqueNumber']); _gaq.push(['_setDomainName', 'domainName.co.uk']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })();</script> Why else could there be an issue? I simply do not get it as single quotation marks are escaped and hence should be unproblematic|-) SonI
  22. I run the following query before inserting javascript code into db from form field as: function escape_data ($data){// address magic quotes. if (ini_get('magic_quotes_gpc')) { $data = stripslashes($data); } // check for mysql_real_escape_string() support if (function_exists('mysqli_real_escape_string')) { global $dbc; // need the connection $data = mysqli_real_escape_string ($dbc, trim($data)); } else { $data = mysqli_escape_string ($dbc, trim($data));} The double quotation marks are problematic. The insert statement does not work with them. Why is that? Does mysqli_real_escape_string not escape double quotation marks after all? Son
  23. When I do changes on websites often clients complain that the pages do not look alright due to their web browser using cached version of web page and/or stylesheet (most often stylesheet) when they look at changes... Is it a good idea to prevent browsers from caching altogether? Son
  24. We have an entry in .htacess to rewrite if file is not physically present asOptions +FollowSymlinksRewriteEngine OnRewriteCond %{REQUEST_FILENAME} !-fRewriteRule ^([A-Za-z0-9_-]+)$ /folder/index.php?id=$1 [NC]RewriteRule ^([A-Za-z0-9_-]+)/$ /folder/index.php?id=$1 [NC]RewriteRule ^([A-Za-z0-9_-]+)/page([0-9])\.php /folder/index.php?id=$1&page=$2 [NC] Now, the issue is that it needs to be combined with another re-write which we have asOptions +FollowSymlinksRewriteEngine OnRewriteCond %{REQUEST_FILENAME}.php -fRewriteRule (.*) $1\.php [L]RewriteCond %{REQUEST_FILENAME} -f [NC,OR]RewriteCond %{REQUEST_FILENAME} -d [NC]RewriteRule .* - [L]RewriteRule ^([A-Za-z0-9_-]+)$ page.php?page=$1 [NC,QSA]RewriteRule ^([A-Za-z0-9_-]+)/$ page.php?page=$1 [NC,QSA]The first one is only for files with folder, the second one for anything else that is not a physical file. How would that best be achieved? I simply cannot get my head around this... Son
  25. son

    xml in php file

    Thanks for all your inputs. You put me in right direction... The main issue was that text from db contained a lot of markup stuff which I did not realise until I checked code in detail. I use now strip_tags() before generating the xml, copied the generated source code into xml file and checked this on successfully with http://feedvalidator.org.It is looking good now as the usualy rss screen comes up, but just to double-check:To have news.php withheader('Content-Type: text/xml');that is supposed to act as rss file (and is well-formed) is common practice/ok to use? As there is a lot of changing data from db I have no option to do this static. This is my first rss straight from db and want to make sure that I check all eventualities... Son
×
×
  • Create New...