Jump to content

ToonMariner

Members
  • Posts

    3,342
  • Joined

  • Last visited

Everything posted by ToonMariner

  1. ToonMariner

    eregi help

    [code] if (preg_match('/\'|"|\!|@|#|\$|%|\^|&|\*|\(|)|:|;|\{|}|\[]|>|</', $_POST['fn'])) {        $error[] = "<strong class=\"error\">You entered an invalid character.</strong>";         $show = 'y'; } [/code] It woudl look something like that - someone will come up with a more elegant solution I am sure oh and correct my regular expression too - just woke up so not firing on cylinders yet.
  2. For xml to be valid it MUST have a closing tag for each element! That particular file is not valid xml and should not be parsed by any compliant app (only a superdooper error friendly one MAY still do it but as far as I am aware, or concerned for that matter, that example should fail hands down. You could make it valid by parsing the content of the file and looking for elements with no closing tag and give them one (no entendre!!!!).
  3. try this... echo <<<__HTML_END <FRAMESET ROWS="95,*" frameborder="yes" border="1" bordercolor="#000000" framespacing="0"> <FRAME NAME="header" SRC="header.php?id=$tutid" scrolling="no" noresize> <FRAME NAME="tutorial" SRC="$url" scrolling="auto" noresize> </FRAMESET><noframes></noframes> __HTML_END; NOTE I have simply included ?id=$tutid in teh src of the header frame!!!!!
  4. Have a look at file_put_contents. If you do not have php 5 then you will need to use fopen fwrite fclose
  5. You can save the image where ever you wish (depending on whether open_base_dir is set in your php.ini file!). The only thing then is to ensure you link to it with the correct path. You can save the image to the database and write a standalone script to echo the image out - but that is another story...
  6. You will have to post the code in the dbconnect file (make sure you change all the connection details mind you!) There is a significant difference between 4 and 5 mainly in the implementation of classes so if there is any oop code in there that could be you problem.
  7. the code we would need to see is in the php file that processes these requests. When you say it has been disabled for those elements then there could well be a simple switch
  8. Thanks for reply but unfortunately no joy there - output array is empty. Any other suggestions?
  9. Each time I think I get these something happens which indicates i dont. OK I have a html file that a place contents into a string using file_get _contents. now I want to return from the string everything from '<center><br>' upto and including '</textarea>' which have tags inbetween and newlines etc. etc. Now I have tried preg_match('/<center><br>.\s*<\/textarea>/', $string, $outstr); preg_match('/<center><br>(?!<\/textarea>).\s*<\/textarea>/', $string, $outstr); and some other embarrassing combinations. Bit of help would be very much appreciated.
  10. what path have you set in cookie? try setting it to '/'
  11. have a look for the set_cookie function - its dead easy
  12. You need javscript for that. on your <select ... you should add the onChange="" attribute and point it to a suitable js function to do the checking. Google for js scripts there will be plenty for this.
  13. It appears that register globals is off (which is good!) in that case you will need to do this... [code]<?php $id = $_GET['id']; switch ($id) { case 'issue1cd':   include 'issue1cd.php';   break; case 'issue2cd'; .... } ?>[/code]
  14. change your query. have ALL the fields in the table listed in the fields of teh query and those where no value should be inserted simply have '' in coreesponding values position. Assuming the only field you have omitted is the unique id and that has autoincrement... do this $query = ("INSERT INTO `users` (`unique_id`, `username`, `email`, `pass`, `aim`, `msn`, `yim`, `priv`, `regip`, `regdate`) VALUES ('', '$username', '$email' '$pass', '$aim', '$msn', '$yim', '$priv', '$regip', '$regdate')"); Now some other help for you.... comparing strings - use the strcomp functions instead. checking user input: use mysql_real_escape_string to prevent mysql injection. use the sha1 instead of md5 - its just a bit better IMO.
  15. brush up on the curl library. Also let people use what they want to - paypal is very popular - let em use it. The more methods of payment you have the better for you.
  16. As far as I know the only option you have is to load a page with an animated gif (or what ever to show something is happening). The html is output first and then the php script. Once all the php code has finished executing have the last line echo out javascript to close the window. Its not really a progress bar in the sense that it analyses the percentage of work done - but it looks like one!
  17. OK. There is always an issue of someone simply guessing the correct username password combo. But in this case there is much more going on not only does the hacker need to know the login details but they must also know how to get access to the database away from your php scripts - i.e. phpmyadmin. In order to do that they would need to know the url of your server control panel (and the login details for that of course) or phpmyadmin tool. So its not JUST the database username password they need. These values are not spilled out in any http headers sent between client and server. The php scripts contain the login details and reside on the server they have no need to send any information other than success/failuer to the client to establish a connection. The only information that can be viewed without any knowledge of usernames and passwords for your server/ftp/database are those sent in the headers. That is information the user submits to the server and any information the server sends back - like cookie values etc. etc. The only answer is to use 2 database connection files - one for the front end where people can insert/view/edit and a spearate file for admin purposes with full rights - and in an obscure direcory on your site (with ALL directories of your site having an idex.htm or index.html or whatever the server default is.) If you are concerned about this type of information then you should ensure that login is secure by using ssl. If you aint got a certificatte I think they are about £60-70 - but your hosting provider may have some facility you can use.
  18. if you made an array of results you could use implode(',',$arr);
  19. neither first off - if this is out side the class then unless you have instantiated a class and given it the identifier $mg2 then it will throw an error. So first you would need something like... $mg2 = new YourClass; now if you simply had $mg2->getlanguages(); then providing that function was defined in your class it will be 'executed' but unless you have anything in you function to perform anything - like set a session var or print info or something it won't help you much. For example - if the function simply queried the database for what languages were installed and nothing else you could not access any of that info. now if you did... $info = $mg2->getlanguages(); this would return teh result of the function and you now have access to it so you can do 'stuff'.
  20. to have one selected by default you need to add 'selected="selected" 'to the option tag. You would need an if statement to compare the value from your database and add that text of it is true.
  21. I do not know the answer but.... Pdf's created from a word processor that allows internal hyperlinks may be able to do what you are asking. If you use word to generate the table of contents automatically from header tags then any pdf created is capable of mimicing these hyperlinks. This is similar to the document tree that you can view in word. Now I haven't tried it but it may be worth you looking into... Alternatively you could use php to extract all the info from teh pdf and create html or even a database to serve the info from... For you information - since php can create pdf's it may be desirable to have the catalouge in a database, serve up generated html through php and then get php to create the full pdf document should you need it (image it woudl be a damn site cheaper than your printing company!!! ;) )
  22. how many files are in the directory? You loop through rows and columsn INSIDE the file loop - so you will probably get 9 of the first file and then 9 of the second and so on do the row and column loop outside and have some continue in there to move on to the next file.
  23. Firstly ehy do you need to do this? The beauty of databases and primary keys with auto increment is that they are simply a way to identfy and cross reference items. IMO you should avoid using keys of a table for anything else. BUT if you really must (this could get messy)..... You know which items you have deleted - if they are all consective (5,6,7,8) then there is not so much of a problem... create an comma separated list of the ids to go, count how many and then update the table like so... This assumes you have a form with checkboxes next to each job you are deleting called "jobdel[]" (the [] creates an array of jobdel) and a value set to the id of the job. [code]<?php $delarr = implode(',',$_POST[jobsdel]); $number = count($delarr); // do the delete.... $sql = "DELETE FROM `jobs` WHERE `pk` IN (" . $delarr . ")"; $sql = mysql_query($sql); // do teh update... $sql = "UPDATE `jobs` SET `pk` = `pk` - $number WHERE ``pk` > " . $delarr[$number - 1] . ""; $sql = mysql_query($sql); ?> [/code] If the job numbers are not consecutive then the update would be a little more complex - you could either loop through the array doing an update wit `pk` = `pk` - 1 where pk > than element each time OR more efficient loop and generate a query string each time ending in ; and then mysql_query the whole lot.
  24. Not read your post fully - it's too big for me!!! A suggestion..... Why not have a checkbox beside each item in yur form instaed of a submit button. Then at the bottom o fthe form a method of selecting an action (edit, delete etc.) like set of radio buttons or a select box. That way you can use just one submit button and do alot more like deleting multiple items....
  25. so ALL diagonlas? -ie any diagonal starting from an element on the outside of the matrix? from top left to bottom right? or in all directions?
×
×
  • 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.