Jump to content

xam

Members
  • Posts

    23
  • Joined

  • Last visited

    Never

Posts posted by xam

  1. hello,

    I've over 500 files with same names (with same specialtag) under many dirs + subdirectorys

    example:
    d:/ftp/directory1/subdirectory/specialtag_filename1.gif
    d:/ftp/directory2/subdirectory/subdirectory2/specialtag_filename1.psd
    d:/ftp/directory2/subdirectory2/subdirectory3/specialtag_filename2.jpg

    how do I change the specialtag front of each file?
    example:
    d:/ftp/directory2/subdirectory/subdirectory2/[b]specialtag[/b]_filename1.psd
    to
    d:/ftp/directory2/subdirectory/subdirectory2/[b]xam[/b]_filename1.psd

    or

    d:/ftp/directory2/subdirectory2/subdirectory3/[b]specialtag[/b]_filename2.jpg
    to
    d:/ftp/directory2/subdirectory2/subdirectory3/[b]xam[/b]_filename2.jpg

    is this possible with php?

    regards,
    xam.
  2. [quote author=Barand link=topic=99045.msg391003#msg391003 date=1151940373]
    http://uk.php.net/manual/en/language.types.string.php
    [/quote]

    Its hard for me ;( my english not enought for this tutorial thats why I wrote here....

    ???
  3. [quote author=Barand link=topic=99045.msg390437#msg390437 date=1151836056]
    [quote author=Barand link=topic=99045.msg390167#msg390167 date=1151765522]
    Do you mean this
    [code=php:0]
    $lang['Copyright'] = 'Copyright  All Rights Reserved.';

    echo  $lang['Copyright']; //-->  Copyright  All Rights Reserved.
    echo '<br>';
        // text in single quotes
    echo  '$lang[\'Copyright\']'; //-->  $lang['Copyright'];[/code]
    [/quote]

    I already have
    [/quote]

    I mean:
    lang-en.php
    [code=php:0]
    $lang['protected2'] = 'Copyright '.$MAIN['url'].' All Rights Reserved.';
    [/code]

    Form (to change/edit language text in adminpanel):
    [code=php:0]
    echo '<input onClick="highlight(this);" size="200" type="text" name="new_lang[protected2]" value="'.$lang['protected2'].'"><br>';
    [/code]

    Output (to input value):
    <input onClick="highlight(this);" size="200" type="text" name="new_lang[protected2]" value="Copyright All Rights Reserved.">

    I want:
    Output (to input value):
    <input onClick="highlight(this);" size="200" type="text" name="new_lang[protected2]" value="Copyright '.$MAIN['url'].'  All Rights Reserved.">
  4. [quote author=Barand link=topic=99045.msg390167#msg390167 date=1151765522]
    Do you mean this
    [code=php:0]
    $lang['Copyright'] = 'Copyright  All Rights Reserved.';

    echo  $lang['Copyright']; //-->  Copyright  All Rights Reserved.
    echo '<br>';
        // text in single quotes
    echo  '$lang[\'Copyright\']'; //-->  $lang['Copyright'];[/code]
    [/quote]

    no, I mean:
    $lang['leecher'] = 'This page is only avaliable from the '.$MAIN['url'].' site.';

    The code:
    <input onClick="highlight(this);" size="200" type="text" name="new_lang[leecher]" value="'.$lang['leecher'].'">

    It shows:
    <input onClick="highlight(this);" size="200" type="text" name="new_lang[leecher]" value="This page is only avaliable from the  site.">

    It should be:
    <input onClick="highlight(this);" size="200" type="text" name="new_lang[leecher]" value="This page is only avaliable from the '.$MAIN['url'].' site.">

    It must show '.$MAIN['url'].' string as text not a php value/string..
  5. well, I have another question / I need another help..

    An example language file content:
    language.php
    [code]$lang['Copyright'] = 'Copyright '.$Settings['url'].' All Rights Reserved.';[/code]

    An example modify script for language file:
    [code]
    include_once ('language.php');
    echo '<input onClick="highlight(this);" size="200" type="text" name="new_lang[Copyright]" value=" '.$lang['Copyright'].' ">'
    [/code]

    It shows:
    [code]<input onClick="highlight(this);" size="200" type="text" name="new_lang[Copyright]" value="Copyright  All Rights Reserved.">[/code]

    I want:
    [code]<input onClick="highlight(this);" size="200" type="text" name="new_lang[Copyright]" value="Copyright '.$lang['Copyright'].'  All Rights Reserved.">[/code]

    $settings[xxxx] values should be write as text content..
    I use htmlspecialchars but It wont help ...
  6. [quote author=Orio link=topic=99045.msg389894#msg389894 date=1151701226]
    [url=http://www.php.net/manual/en/function.stripslashes.php]stripslashes()[/url]

    Orio.
    [/quote]

    ok done, thx
  7. Hello,

    I use below code to change my language files.

    [code]<?php
    session_start();
    function addslashes2 ($string) {
    if (!get_magic_quotes_gpc())
      return str_replace('\'','\\\'',$string);
    else
      return str_replace('\'','\\\'',stripslashes($string));

    }
    if (isset($_POST['new_lang'])):
        $current_lang = $_SESSION['lang'];
        $new_lang_file_content = array();
        foreach ($_POST['new_lang'] as $key => $value):
              $new_lang_file_content[] = '$lang[\''.$key.'\'] = \''. addslashes2($value) .'\';';
        endforeach;
        $handler = fopen('lang.inc','w');
        fwrite($handler,"<?php\n".implode("\n",$new_lang_file_content)."\n?>");
        fclose($handler);
        Die ('Language file has been updated. Click <a href=javascript:history.go(-1)> here</a> to go back.');
    endif;
    include_once 'lang.inc';
    echo $lang['category'];
    ?>
    <form method="post">
    <input name="new_lang[category]" type="text" value="<?=$lang['category'];?>">
    <input type="submit"></form>[/code]

    It works fine but I need some help about; When I insert a text with php string into input area, e.g. following text: You have been redirected to main page '.$MAIN['mainpage'].'
    It save it as a text I want to save it as php string, take a look at below example thats what I want..

    e.g.:
    I wrote: You have been redirected to main page '.$MAIN['mainpage'].'
    It has been saved as (lang.inc):
    [code]<?php
    $lang['category'] = 'You have been redirected to main page \'.$MAIN[\'mainpage\'].\' ';
    ?>[/code]

    I want:

    [code]
    <?php
    $lang['category'] = 'You have been redirected to main page '.$MAIN['mainpage'].' ';
    ?>[/code]

    without slashes..
  8. Hello everyone,

    I dont know whats wrong with below sql code..
    [!--sql--][div class=\'sqltop\']SQL[/div][div class=\'sqlmain\'][!--sql1--]$keywords [color=orange]=[/color] trim($_GET[[color=red]"keywords"[/color]]);
    $ekeywords [color=orange]=[/color] sqlesc($keywords);
    $res [color=orange]=[/color] mysql_query([color=red]"[span style=\'color:blue;font-weight:bold\']SELECT[/color] [color=blue]COUNT[/color](*) [color=green]FROM[/color] [color=orange]posts[/color] [color=green]WHERE[/color] MATCH (body) AGAINST ($ekeywords)"[/span]) [color=blue]or[/color] sqlerr(__FILE__, __LINE__);
    $arr [color=orange]=[/color] mysql_fetch_row($res);
    $hits [color=orange]=[/color] 0 [color=orange]+[/color] $arr[0];
    if ($hits [color=orange]=[/color][color=orange]=[/color] 0)
    print([color=red]"[span style=\'color:orange\']<[/color]p[color=orange]>[/color][color=orange]<[/color]b[color=orange]>[/color]Sorry, nothing found![color=orange]<[/color]/b[color=orange]>[/color][color=orange]<[/color]/p[color=orange]>[/color]"[/span]);
    else
    {
    showing search results....
    [!--sql2--][/div][!--sql3--]

    the sql code return with 0 results, it wont work.. Please help..
  9. Hello everyone,

    I need help to fix my firefox problem with my below code..

    This is my tracklink.html file
    [code]<script type="text/javascript">
    function logClick() {
        window.focus();
        bug = new Image();  
        bug.src = 'http://mywebsite.com/track.php?pg=' + escape(document.title);
    }
    </script>
    <iframe src='showads.html' frameborder='0' width='300' height='50' onFocus='logClick()'></iframe>
    [/code]

    This is my track.php file
    [code]
    <?
    mysql_connect("localhost", "root", "mypass") or die(mysql_error());
    echo "Connected to MySQL<br />";
    mysql_select_db("stats") or die(mysql_error());
    echo "Connected to Database<br />";
    $ip = $_SERVER['REMOTE_ADDR'];
    $page = $_GET['pg'];
    mysql_query("INSERT INTO stats (page, ip) VALUES ('$page', '$ip')") or die(mysql_error());
    mysql_close();
    ?>[/code]

    When someone click a link on the tracklink.html page, it should send pagename and visitorip to track.php and track.php should send this results to my database..

    Everything is work with Internet Explorer, But mozilla cant sent results to track.php..

    I tested it with direct link with mozilla e.g.: [code]http://mywebsite.com/track.php?pg=test[/code] It work.. Its %100 javascript error.... I need more stable javascript code to track clicked links..

    My regards.
  10. [!--quoteo(post=357968:date=Mar 24 2006, 06:06 PM:name=wickning1)--][div class=\'quotetop\']QUOTE(wickning1 @ Mar 24 2006, 06:06 PM) [snapback]357968[/snapback][/div][div class=\'quotemain\'][!--quotec--]
    First you need to know what collations you are using. The database can have a default collation, each table can have a default collation, and each column can have a collation. phpMyAdmin should show you this information, or you can log into the command line client and run commands like "SHOW CREATE TABLE mytable"

    Then you need to use ALTER TABLE to make them all match. Something like:

    ALTER TABLE mytable CHANGE mycolumn mycolumn TINYTEXT CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL
    [/quote]

    My my.ini setting about default collation:
    [code]default-character-set=latin1[/code]

    Phpmyadmin results for each table:
    [code]Varchar, text, mediumtext etc= latin1_general_ci. - int, tinyint etc= empty..[/code]

    I made a new table to see my default collation so i know its "latin1_swedish_ci"
  11. [!--quoteo(post=357315:date=Mar 22 2006, 04:30 PM:name=wickning1)--][div class=\'quotetop\']QUOTE(wickning1 @ Mar 22 2006, 04:30 PM) [snapback]357315[/snapback][/div][div class=\'quotemain\'][!--quotec--]
    This is a bug that has been fixed in the latest versions of 4.1 and 5.0. Until you upgrade, you'll have to set the columns in both tables to the same collation, or change the collation inside the query - in one half of your union.
    [/quote]

    I'm using mysql Client API version 5.0.18... could u tell me that how I set the columns ...or change the collation inside ..... ?
  12. Hello,

    [code]$limit        = $settings['Search Results Per Page'];
        $extraSql     = "$searchby LIKE '%".$searchtext."%'";

        if($searchby == 'article')
        {
            $extraSql .= " OR description LIKE '%".$searchtext."%'";
        }

        // Select all online articles which are in date and are displayed on a category
        $sql = "SELECT n.categoryid, n.articleid, n.title, c.name as categoryname
                FROM " . TABLE_PREFIX . "p2_news n
                INNER JOIN " . TABLE_PREFIX . "categories c
                ON c.categoryid = n.categoryid
                INNER JOIN " . TABLE_PREFIX . "pagesort p
                ON p.categoryid = n.categoryid AND p.pluginid in ('2', '2000', '2001')                                                
                  WHERE $extraSql AND (n.settings & 2)
                AND (n.datestart = 0 OR n.datestart < '" . time() . "')
                AND (n.dateend   = 0 OR n.dateend   > '" . time() . "')
                LIMIT $start, " . ($limit + 1) . "";

        $getarticles = $DB->query($sql);

        $rows = $DB->get_num_rows($getarticles);[/code]


    Can someone help me about above code ?
    I've 2 tables: p2_news and p2000_news, How I modify this 2 tables for my search page?
    Above code is works perfect, When someone put a text in search field, it show results from p2_news database but I want to show results from 2 tables (p2_news and p2_news)..

    I did some modify for it but I got error shown below:

    [code]Invalid SQL: SELECT n.categoryid, n.articleid, n.title, c.name as categoryname
                FROM sd_p2_news n
                INNER JOIN sd_categories c
                ON c.categoryid = n.categoryid
                INNER JOIN sd_pagesort p
                ON p.categoryid = n.categoryid AND p.pluginid in ('2', '2000', '2001')                                                
                  WHERE title LIKE '%3%' AND (n.settings & 2)
                AND (n.datestart = 0 OR n.datestart < '1142989835')
                AND (n.dateend   = 0 OR n.dateend   > '1142989835')
                LIMIT 0, 11
                UNION ALL
                SELECT n.categoryid, n.articleid, n.title, c.name as categoryname
                FROM sd_p2000_news n
                INNER JOIN sd_categories c
                ON c.categoryid = n.categoryid
                INNER JOIN sd_pagesort p
                ON p.categoryid = n.categoryid AND p.pluginid in ('2', '2000', '2001')                                                
                  WHERE title LIKE '%3%' AND (n.settings & 2)
                AND (n.datestart = 0 OR n.datestart < '1142989835')
                AND (n.dateend   = 0 OR n.dateend   > '1142989835')
                LIMIT 0, 11            
    Error: Illegal mix of collations for operation 'UNION'
    Error number: 1271 [/code]


    Or Is this possible, SELECT n.categoryid, n.articleid, n.title, c.name as categoryname FROM " . TABLE_PREFIX . "p2_news n[b] [u]AND " . TABLE_PREFIX . "p2000_news[/u][/b]
  13. [!--quoteo(post=336540:date=Jan 14 2006, 09:11 PM:name=fenway)--][div class=\'quotetop\']QUOTE(fenway @ Jan 14 2006, 09:11 PM) 336540[/snapback][/div][div class=\'quotemain\'][!--quotec--]

    It's not a count, it's a sum. Strange-looking filenames, by the way. Try the following:

     

    SELECT SUM(downloads) FROM yourTable

     

    Hope that helps.

     

    I used this code for it

    SELECT SUM(downloads) AS 'total' FROM mytable

     

    Thank you, I find to right way with you :)

     

     

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