javascript - Add text to random string -


if text starts http://vk.com add

<iframe src=" 

at end , " width="100%" height="450px" allowfullscreen=""></iframe> @ end

all http://vk.com/random$$ in database.. , link random..

example:

http://vk.com/video_ext.php?oid=187139107&id=163792624&hash=15cbcf3a3c503bd8 

to

<iframe src="http://vk.com/video_ext.php?oid=187139107&id=163792624&hash=15cbcf3a3c503bd8" width="100%" height="450px" allowfullscreen=""></iframe> 

keep in mind, after "video_ext.php?" random.

so.. here script take care of that:

        <?php $mysqli = new mysqli("localhost", "admin_user", "yarak", "admin_name");  if ($mysqli->connect_errno)  {     echo "failed connect mysql: " . $mysqli->connect_error; }  if( $res = $mysqli->query("select * parts") ) {     $i = 0;     $done = array();     while( $row = $res->fetch_assoc() )     {         $link = unserialize( $row['part_content'] );         $link = $link[0];         if( preg_match( '#http://vk\.com/video_ext\.php\?oid=(.*?)#', $link ) )         {             $i = $i+1;             echo 'original link: ' . htmlentities( $link );             $link = preg_replace( '#http://vk\.com/video_ext\.php\?oid=(.*?)#', '<iframe src="http://vk.com/video_ext.php?oid=$1" width="100%" height="450px" allowfullscreen=""></iframe>', $link );             $_link = serialize( array( $link ) );             echo '<br />part id: ' . $row['part_id'] . '<br />new link: '. htmlentities( $link ) . '<br /><br />';              if( $row['part_id'] , !in_array( $row['part_id'], $done ) )             {                 $done[] = $row['part_id'];                 $mysqli->query( 'update `parts` set `part_content` = \''.$_link.'\' `part_id`=\''.$row['part_id'].'\'' );             }         }     }      echo '<br />count: ' . $i . '<br />link conversion completed.'; } else {     echo 'failed'; } ?> 

here get:

original link: <iframe src="http://vk.com/video_ext.php?oid=theimportantpart" width="100%" height="450px" allowfullscreen=""></iframe> part id: 13489 new link: <iframe src="<iframe src="http://vk.com/video_ext.php?oid=" width="100%" height="450px" allowfullscreen=""></iframe>theimportantpart" width="100%" height="450px" allowfullscreen=""></iframe> 

i don't know problem -.-

is you're asking for?

$mysqli = new mysqli("localhost", "admin_e1", "sure", "admin_main");  if ($mysqli->connect_errno) {   echo "failed connect mysql: " . $mysqli->connect_error; }  if( $res = $mysqli->query("select * parts") ) {   $i = 0;   $done = array();   while( $row = $res->fetch_assoc() )   {     $link = unserialize( $row['part_content'] );     $link = $link[0];     if (strpos($text, 'http://vk.com') === 0)     {       $i = $i+1;       echo 'original link: ' . htmlentities( $link );       $link = '<iframe src="' . $link . '" width="100%" height="450px" allowfullscreen=""></iframe>';       $_link = serialize( array( $link ) );       echo '<br />part id: ' . $row['part_id'] . '<br />new link: '. htmlentities( $link ) . '<br /><br />';        if( $row['part_id'] , !in_array( $row['part_id'], $done ) )       {         $done[] = $row['part_id'];         $mysqli->query( 'update `parts` set `part_content` = \''.$_link.'\' `part_id`=\''.$row['part_id'].'\'' );       }     }   }    echo '<br />count: ' . $i . '<br />link conversion completed.'; } else {   echo 'failed'; } 

Comments

Popular posts from this blog

php - Zend Framework / Skeleton-Application / Composer install issue -

c# - Better 64-bit byte array hash -

python - PyCharm Type error Message -