Jump to content

[SOLVED] Functions


supanoob

Recommended Posts

ok so ima having abit of trouble with functions i have 2 functions 1 to change 1 set of strings into another and another one to reverse the process. now the first one works fine its the reversal that doesnt work. Below is a copy of both functions. the first one reverses a textarea input and the second one is meant to reverse the data in my $about_me field in the database.

 

Function 1 - Reversing the textarea:

<?php

function account ($account) { $account=htmlspecialchars($account); $account=str_replace (array('[', ']', 'url=', '/url', 'img=', 'post id=', '/post', 'font=', '/font', 'left', '/left', 'center', '/center', 'right', '/right', '', '', ':scared:', '', ':roll:', ':mad:', ':love:', '', ':S'), array('<', '>', 'a href=link_out.php?link=', '/a', 'img src=', 'a href=view_post.php?post_id=', '/a', 'font color=', '/font', 'p align=\"left\"', '/p', 'p align=\"center\"', '/p', 'p align=\"right\"', '/p', '<img src=\"/images/forum/wink.gif\">', '<img src=\"/images/forum/tongue.gif\">', '<img src=\"/images/forum/scared.gif\">', '<img src=\"/images/forum/sad.gif\">', '<img src=\"/images/forum/roll.gif\">', '<img src=\"/images/forum/mad.gif\">', '<img src=\"/images/forum/love.gif\">', '<img src=\"/images/forum/happy.gif\">', '<img src=\"/images/forum/confused.gif\">'), $account); return nl2br($account); }

?>

 

Function 2 - Reversing Function 1

 

<?php

function account_reverse ($about_me) { $about_me=htmlspecialchars($about_me); $about_me=str_replace (array('<', '>', 'a href=link_out.php?link=', '/a', 'img src=', 'a href=view_post.php?post_id=', '/a', 'font color=', '/font', 'p align=\"left\"', '/p', 'p align=\"center\"', '/p', 'p align=\"right\"', '/p', '<img src=\"/images/forum/wink.gif\">', '<img src=\"/images/forum/tongue.gif\">', '<img src=\"/images/forum/scared.gif\">', '<img src=\"/images/forum/sad.gif\">', '<img src=\"/images/forum/roll.gif\">', '<img src=\"/images/forum/mad.gif\">', '<img src=\"/images/forum/love.gif\">', '<img src=\"/images/forum/happy.gif\">', '<img src=\"/images/forum/confused.gif\">'), array('[', ']', 'url=', '/url', 'img=', 'post id=', '/post', 'font=', '/font', 'left', '/left', 'center', '/center', 'right', '/right', '', '', ':scared:', '', ':roll:', ':mad:', ':love:', '', ':S'), $about_me); return nl2br($about_me); }

?>

 

i have tried changing the $about_me to the textarea name and that didnt work.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.