Jump to content

arumdevil

New Members
  • Posts

    9
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

arumdevil's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Magic! thanks so much that's exactly what I was after. I did play around with that one too but I couldn't get it to work - like I said I am new!
  2. thanks guys. Had a look at strip tags, but either I cannot get them to work or I didn't explain what I want properly. What I am trying to do is let admin update a news & events page directly through the browser. Hence the HTML form. The input from the form is stored in a text file which is then called from the news & events page to display it. I have this working fine - admin can even add <p> <br> tags etc and that works as expected. the problem is if they try to enter tags containing doublequotes - such as urls... to try to make my point more clear, take the following example: <form method="post"> <input type="text" name="textin" /> </form> <? $var = '<span style="color:#F00;">Red text</span>'; echo '1: '.$var; $post = $_POST['textin']; echo '<br> 2: '.$post; ?> <br> 3: <span style="color:#F00;">Red text</span> the above will output 3 strings of "Red text". 1 and 3 are always red, but if I paste <span style="color:#F00;">Red text</span> into the text box it doesn't show up red. So I am not wanting to strip HTML tags as a security measure - conversely I want them to work, but can't figure it out. Security is not an issue in this case as the people editing will have already logged in... I don't know if that explained my problem in a clearer way - hope so!
  3. Hi all, New to PHP and learning quickish but still a lot to learn! Here's my problem: I have a HTML form with a text area - the data gathered by the text area is stored in a line of a text file which is in turn used as part of the display of a HTML page. Standard text is fine, but the text are needs to be able to accept HTML code with "s (double-quotes) in for entry if image urls etc.... the trouble is the form escapes these characters with \ (backslashes) which are stored in the text file and consequently mess up the HTML on the page. Not sure if that was clear, but if anyone can help me with how to take HTML code from a text area, store it in (1 line of) a text file and then include it on a web-page as an include - I would be most grateful as I am stumped. Even just to point me in the direction of some reading material. I am not storing this data in a database as I have not got that far yet, but I am aware that would probably be a better way to do it. TIA arum
  4. Hi All, I am fairly new to the forum, and fairly new to php also, though I have a fair amount of xhtml/css experience, and some basic coding knowledge (in AppleScript, but I got many of the principals from that). So. I have been asked to set up a subscription based site offering media to subscribed members, specifically video and audio content. Being a newbie to PHP, but someone who can certainly learn this sort of thing, do you think this is something I can realistically expect to be able to do in say, 6 to 12 months (not full time) using PHP and building it myself, or is there something out there already (pref opensource) that will do the job better than me, that you would recommend.. I suppose key requirements are a secure payment system, linked to a member database. I would like for anyone to be able to browse the site, but members must be paid up and logged in to download/view media etc. Any thoughts on this gratefully received. ArumDeVil
  5. excuse me if I missed the point or something, but as I understood from your post, you want to display a small version of an image, 80 pixels wide (or high) with the other dimension corresponding to the correct ratio of the original image. as far as my experience goes, if you define only the width or the height of an image in html or css, the browser will resize the image to the correct ratio... again, sorry if I missed something here.... arumdevil
  6. sorry I wasn't clear. In the example above I have explicitly set each item (key??) of the array in the script. what I would like to do instead, is have the script dynamically set each item of the array to each image file inside a particular server on the folder, the purpose being that the user can then change the available images by simply adding them to and deleting them from the folder - with no need to edit the code... hope that makes sense, sorry I've not learnt the proper terminology yet
  7. awesome, thanks guys, I went for Ken's example in the end as I could make sense of it more easily and got it to show more images....but thank you both. now to make it perfect, how can I get it to set the array to every image inside a particular folder? any thoughts on that? thanks arumdevil
  8. thanks guys, both look like more efficient ways around the problem. As it turns out I have managed to get it working in the meantime, though not as efficiently as either of your suggestions. There were two problems with my original script, 1 being that the array had doubled up values in it which meant for a while while it was in fact working I thought it wasn't very emarrasing... anyway, I will play around with both of your suggestions to understand why and how they work. thanks again. humbly, arumdevil
  9. Hi all... I am new to the forum and new to PHP, so be gentle. I have been searching the web for this all day so forgive me if I have missed a post that answers my question. I want to display 4 images (but with possibility of more in future) on a page which are randomly selected from a number of possible images. at the moment I have each possible image as a list in an array, and have found it simple enough to generate the 4 images randomly. The problem I am having is that I don't want the same image to appear more than once, and am having trouble doing this. As I said, I am new to PHP so I have a lot to learn, but I have built a (fairly basic, admitedly) application in AppleScript on a mac, so I am familiar with many of the basic concepts behind programming, and I could do what I want in AppleScript, but am having trouble translating it to PHP, plus it's been a while since I did that anyway. I'm sure there must be a simple answer, but I can't find it so any suggestions would be greatly appreciated. Here is the script I have so far: (any tips to clean it up also welcome!) <?php $file_array = array ( '93.jpg', '96.jpg', '900.jpg', '962.jpg', '93.jpg', '93.jpg', 'aerobadge.jpg', 'aeroX1.jpg', 'aeroX2.jpg', 'aeroX3.jpg', ); $total = count($file_array); $random = (mt_rand()%$total); $file1 = "$file_array[$random]"; $file_array= array_values($file_array); $random = (mt_rand()%$total); $file2 = "$file_array[$random]"; $file_array= array_values($file_array); $random = (mt_rand()%$total); $file3 = "$file_array[$random]"; $file_array= array_values($file_array); $random = (mt_rand()%$total); $file4 = "$file_array[$random]"; Now I tried to get what I want using if statements or repeat loops but one got very confusing and the other froze up the CPU and didn't really work anyway! then I figured if I move through the images one by one, removing it from the array as it is used, that would solve it, but I couldn't get it to work.... any help appreciated, arumdevil
×
×
  • 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.