Jump to content

digibucc

Members
  • Posts

    142
  • Joined

  • Last visited

Posts posted by digibucc

  1. i had to do two things:

     

    1) quote out config.php's include - i can't see that file so i don't know the issue, but quoting that and

    2) adding "if(!empty)" to your $username=$_GET['p'] statement. check before you assign.

     

    <?php
    header("Content-type: image/png");
    // ---------------------------------------------------------+ - +--------------------------------------------------------- \\
    //include ('config.php');
    // ---------------------------------------------------------+ - +--------------------------------------------------------- \\
    $img = imagecreatefrompng("imagine.png");
    $culoare_alb = imagecolorallocate($img,255,255,255);
    $culoare_rosu = imagecolorallocate($img,255,0,0);
    $culoare_albastru = imagecolorallocate($img,27,27,224);
    $culoare_verde = imagecolorallocate($img,37,224,27);
    if (!empty($_GET['p'])){$username = $_GET['p'];}
    // ---------------------------------------------------------+ - +--------------------------------------------------------- \\
    if(isset($_GET['p']))
    {
        $username = $_GET['p'];
        $respect = FTP_pini_Get($username.".ini",'Respect',$host,$user,$password,$path);
        $level = FTP_pini_Get($username.".ini",'Level',$host,$user,$password,$path);
        $sex = FTP_pini_Get($username.".ini",'Sex',$host,$user,$password,$path);
        $origin = FTP_pini_Get($username.".ini",'Origin',$host,$user,$password,$path);
        $leader = FTP_pini_Get($username.".ini",'Leader',$host,$user,$password,$path);
        $member = FTP_pini_Get($username.".ini",'Member',$host,$user,$password,$path);
        $age = FTP_pini_Get($username.".ini",'Age',$host,$user,$password,$path);
        $deaths = FTP_pini_Get($username.".ini",'Deaths',$host,$user,$password,$path);
        $admin = FTP_pini_Get($username.".ini",'AdminLevel',$host,$user,$password,$path);
        $paycheck = FTP_pini_Get($username.".ini",'Paycheck',$host,$user,$password,$path);
        $ore = FTP_pini_Get($username.".ini",'ConnectedTime',$host,$user,$password,$path);
        $helper = FTP_pini_Get($username.".ini",'Helper',$host,$user,$password,$path);
        $vip = FTP_pini_Get($username.".ini",'VipLevel',$host,$user,$password,$path);
        $money = FTP_pini_Get($username.".ini",'Money',$host,$user,$password,$path);
        $bank = FTP_pini_Get($username.".ini",'Bank',$host,$user,$password,$path);
        $crimes = FTP_pini_Get($username.".ini",'Crimes',$host,$user,$password,$path);
        $phone = FTP_pini_Get($username.".ini",'PhoneNr',$host,$user,$password,$path);
        $car = FTP_pini_Get($username.".ini",'Car',$host,$user,$password,$path);
        $car2 = FTP_pini_Get($username.".ini",'Car2',$host,$user,$password,$path);
        $car3 = FTP_pini_Get($username.".ini",'Car3',$host,$user,$password,$path);
        if($respect != '')
        {
            imagestring($img,5,2,77,"GameStatus.In",$culoare_albastru);
            imagestring($img,5,170,77,"-",$culoare_rosu);
            imagestring($img,5,185,77,"XXXXXXX",$culoare_verde);
            // ----------+ - +---------- \\
            imagestring($img,3,105,2,"TEXT1",$culoare_alb);
            // ----------+ - +---------- \\
            imagestring($img,3,105,17,"TEXT2",$culoare_alb);
            // ----------+ - +---------- \\
            imagestring($img,3,105,32,"TEXT3",$culoare_alb);
            // ----------+ - +---------- \\
            imagestring($img,3,105,47,"TEXT4",$culoare_alb);
            // ----------+ - +---------- \\
            imagestring($img,3,105,62,"TEXT5",$culoare_alb);
            // ---------------------------------------------------------+ - +--------------------------------------------------------- \\
            imagestring($img,3,185,2,"{$age}",$culoare_rosu);
            // ----------+ - +---------- \\
            imagestring($img,3,220,17,''.$_GET['p'].'',$culoare_rosu);
            // ----------+ - +---------- \\
            imagestring($img,3,235,32,"",$culoare_rosu);
            // ----------+ - +---------- \\
            imagestring($img,3,215,47,"",$culoare_rosu);
            // ----------+ - +---------- \\
        }
        else
        {
            imagestring($img,3,150,3,"that player doesn't exist",$culoare_rosu);
        }
    }
    else if(!isset($_GET['p']))
    {
        imagestring($img,3,150,3,"no player selected",$culoare_rosu);
    }
    
    else
    {
        imagestring($img,3,150,3,"Error ...",$culoare_rosu);
    }
    
    
    // ---------------------------------------------------------+ - +--------------------------------------------------------- \\
    imagepng($img);
    imagedestroy($img);
    // ---------------------------------------------------------+ - +--------------------------------------------------------- \\
    ?>

  2. that was my fault, i left an old var in there

     

    <?php
    $con = mysql_connect("localhost","root","");
    if (!$con)
      {
      die('Could not connect: ' . mysql_error());
      }
    
    mysql_select_db("terra_elegante_operations", $con);
    
    foreach ($_POST as $key=>$value){
    if ($value != '' && $value != 'Submit'){
    $cols .= mysql_real_escape_string($key). ', ';
    $vals .= '\''. mysql_real_escape_string($value). '\', ';
    }
    }
    
    $columns = substr($cols,0,-2);
    $values = substr($vals,0,-2);
    
    $sql="INSERT INTO customer_information( $columns )VALUES ( $values )";
    
    if (!mysql_query($sql,$con))
      {
      die('Error: ' . mysql_error());
      }
    echo "1 record added";
    ?>
    

     

    should do the same with no error.

     

    this line

    <?php 	$message .= mysql_real_escape_string($key). ' = '. mysql_real_escape_string($value). ' <br>'; ?> 

    was trying to continue a variable that didn't exist, and you had no need of. this is reused code, and i forgot to remove that part.

  3. since your field names are the same as your input names, what about this?

    <?php
    $con = mysql_connect("localhost","root","");
    if (!$con)
      {
      die('Could not connect: ' . mysql_error());
      }
    
    mysql_select_db("terra_elegante_operations", $con);
    
    foreach ($_POST as $key=>$value){
    if ($value != '' && $value != 'Submit'){
    $cols .= mysql_real_escape_string($key). ', ';
    $vals .= '\''. mysql_real_escape_string($value). '\', ';
    $message .= mysql_real_escape_string($key). ' = '. mysql_real_escape_string($value). ' <br>';
    }
    }
    
    $columns = substr($cols,0,-2);
    $values = substr($vals,0,-2);
    
    $sql="INSERT INTO customer_information( $columns )VALUES ( $values )";
    
    if (!mysql_query($sql,$con))
      {
      die('Error: ' . mysql_error());
      }
    echo "1 record added";
    ?>
    

  4. in add_customer.php

     

    <?php
    $sql="INSERT INTO customer_information (account_#, name_first, name_last, address, city, state, zipcode, telephone, telephone_alt)
    VALUES
    ('$_POST[account_#]','$_POST[name_first]','$_POST[name_last]','$_POST[address]','$_POST[address]','$_POST[city]','$_POST[state]','$_POST[zipcode]','$_POST[telephone]','$_POST[telephone_alt]')";
    ?>

     

    should be

     

    <?php
    $sql="INSERT INTO customer_information (account_#, name_first, name_last, address, city, state, zipcode, telephone, telephone_alt)
    VALUES
    ($_POST['account_#'],$_POST['name_first'],$_POST['name_last'],$_POST['address'],$_POST['address'],$_POST['city'],$_POST['state'],$_POST['zipcode'],$_POST['telephone'],$_POST['telephone_alt'])";
    ?>

     

    for 2 reasons:

    a) values need to be enclosed in single quotes if they are static, you are inserting variables ($_POST) , and so they are not enclosed.

    b) the index of the $_POST array needs to be enclosed in single quotes.

  5. as Dan said, $rdrs = myload($sql); creates an array of all the records, namely the $rdrs array.

    $x was never an array, it was a single variable being overwritten in a loop for no reason.

     

    so , $rdrs is your array - what do you need to do with it?

     

    edit: ok -

     

    your problem is in your return, lines 40-45 of your function

     

    <?php
    
        $ret.= '<tr class="listrow">
        <td class="listgrid">'.$r['pay_date'].'</td>
        <td class="listgrid">'.display_field('', $rdrs[0],'pay_date_payment_recieved'.$r['id'], $styles['osreqdate']).'</td>
        <td class="listgrid">'.display_field('', $rdrs[0],'pay_amount_recieved'.$r['id'], $styles['osreqstring']).'</td>
        <td class="listgrid">'.display_field('', $rdrs[0],'pay_default'.$r['id'], $styles['osreqstring']).'</td>
    </tr>';
    
    ?> 

    <?php
    $rdrs[0]
    ?> 

    is selecting the same record every time. based on the declaration:

    <?php
    function payments_section2($rec_id) {
    ?>

     

    i think those line should read

    <?php
    
        $ret.= '<tr class="listrow">
        <td class="listgrid">'.$r['pay_date'].'</td>
        <td class="listgrid">'.display_field('', $rdrs[$rec_id],'pay_date_payment_recieved'.$r['id'], $styles['osreqdate']).'</td>
        <td class="listgrid">'.display_field('', $rdrs[$rec_id],'pay_amount_recieved'.$r['id'], $styles['osreqstring']).'</td>
        <td class="listgrid">'.display_field('', $rdrs[$rec_id],'pay_default'.$r['id'], $styles['osreqstring']).'</td>
    </tr>';
    
    ?> 

     

    i'd also recommend not having so much html in your function, it should return values and that's it.

  6. those are functions, so on their own they don't really do anything, they need to be called. and that's not just an echo inside the function.

    you'll want to keep functions in a separate file and include it in your final script, but for the sake of this test, just put them in a file (with <?php ?>), and call the function at the bottom.

     

    <?php
    function diff($oldhistory, $newhistory){
        foreach($oldhistory as $oindex => $ovalue){
            $nkeys = array_keys($newhistory, $ovalue);
            foreach($nkeys as $nindex){
                $matrix[$oindex][$nindex] = isset($matrix[$oindex - 1][$nindex - 1]) ?
                    $matrix[$oindex - 1][$nindex - 1] + 1 : 1;
                if($matrix[$oindex][$nindex] > $maxlen){
                    $maxlen = $matrix[$oindex][$nindex];
                    $omax = $oindex + 1 - $maxlen;
                    $nmax = $nindex + 1 - $maxlen;
                }
            }   
        }
        if($maxlen == 0) return array(array('d'=>$oldhistory, 'i'=>$newhistory));
        return array_merge(
            diff(array_slice($oldhistory, 0, $omax), array_slice($newhistory, 0, $nmax)),
            array_slice($newhistory, $nmax, $maxlen),
            diff(array_slice($oldhistory, $omax + $maxlen), array_slice($newhistory, $nmax + $maxlen)));
    }
    
    function htmlDiff($oldhistory, $newhistory){
        $diff = diff(explode(' ', $oldhistory), explode(' ', $newhistory));
        foreach($diff as $k){
            if(is_array($k))
                $ret .= (!empty($k['d'])?"<del>".implode(' ',$k['d'])."</del> ":'').
                    (!empty($k['i'])?"<ins>".implode(' ',$k['i'])."</ins> ":'');
            else $ret .= $k . ' ';
        }
        return $ret;
    }
    
    $oldhistory = 'oldhistory';
    $newhistory = 'newhistory';
    var_dump(diff($oldhistory, $newhistory));
    var_dump(htmlDiff($oldhistory, $newhistory));
    ?>
    

     

    in each case, you would define the old and new history variables, and i have it var_dump as that provides detailed information about the return. you can then figure out how to format it depending on it's type.

     

    you can also assign them to variables for another use

    <?php
    $diff = diff($oldhistory, $newhistory);
    $htmlDiff = htmlDiff($oldhistory, $newhistory);
    ?>
    

  7. have a separate table that just holds the created types, yours and theirs. the entry there would correspond to an id field in your original table.

     

    read the new table in, foreach type make a link, etc. when they add a type just add it to the new table.

  8. while should have a colon not semi colon after

    <?php
      while($i <  $count):
                 print ''.$fisiere[$id].''; 
                  $i++; 
         ftp_close($conexiune); 
         endwhile; 
    ?>

    not

    <?php
      while($i <  $count);
    ?>

    also

    <?php $director = /Users'; ?>

    should be

    <?php $director = '/Users'; ?>

     

    also, wrap your code in code tags (there's a button) it makes it easy to read like mine is.

  9. sorry it's been a busy few days at work. if you are still looking:

     

    <ul id="portfolio-list">
    <?php 
    $categories = get_terms('gallery_cats');
    foreach ($categories as $cat ) :
    foreach($latest_projects as $post) :
    $catg = get_the_category();
    if ($cat->term_id == $catg->cat_ID) {
    // get the about post's category/taxonomy, and make sure it matches the current category in $cat, from your foreach loop above.
    setup_postdata($post);
    $recent_project_thumb = wp_get_attachment_image_src(get_post_thumbnail_id(), 'recent-work');
    ?>
    
    <li><a href="https://ivyvintage.com/gallery-category/<?php echo $cat->slug; ?>" title="<?php the_title(); ?>"><img src="<?php echo $recent_project_thumb[0]; ?>" alt="<?php the_title(); ?>" width="162" height="100" class="imgstyle" /></a></li>
    }
    <?php endforeach; ?>
    <?php endforeach; ?> 
    
    </ul>

     

    but that's assuming "foreach($latest_projects as $post) :" gives you a proper post return, that gives it's id via post->id

  10. <?php get_header(); ?>
    
    <ul class="double-cloumn clearfix">
        <li id="left-column">
            <?php if (!is_category()) { ?><h4 class="section-title"><?php _e("Topics containing", "ocmx");?> "<em><?php single_tag_title(); ?></em>"</h4> <?php } ?>
            <ul class="blog-main-post-container clearfix">
    
                <?php if (!is_category()) {
                while (have_posts()) : the_post(); ?>
                    <li><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></li>
                    <?php endwhile;
            } else {
                if (have_posts()) :
                    global $show_author;
                    $show_author = 1;
                    while (have_posts()) :	the_post(); setup_postdata($post);
                        include(TEMPLATEPATH."/functions/fetch-list.php");
                    endwhile;
                else :
                    ocmx_no_posts();
                endif;
            }?>
    
            </ul>
            <?php motionpic_pagination("clearfix", "pagination clearfix"); ?>
        </li>
        <?php get_sidebar(); ?>
    </ul>
    <?php get_footer(); ?>

  11. try this:

     

    <?php
    $banner = "/images/" . $name . "/Banner.png"; 
    $template = file_get_contents('../Header/Template.php');
    $data = str_replace( '/*-headerbanner-*/', $banner, $template);
    //etc, str_replace your vars
    file_put_contents('../Header/'. $name. '.php', $data);
    print "Data Written"; 
    ?>

     

    but if the folder structure is always

    "/images/" . $name . "/Banner.png";

     

    i would put it in the template as

    "/images//*-headerbanner-*//Banner.png"

     

    and then:

    <?php
    $template = file_get_contents('../Header/Template.php');
    $data = str_replace( '/*-headerbanner-*/', $name, $template);
    //etc, str_replace your vars
    file_put_contents('../Header/'. $name. '.php', $data);
    print "Data Written"; 
    ?>

  12. i'm sorry, change

     

    <?php
    $data = fopen("../Header/Template.php", "r"); // with the appropriate checks of course
    str_replace( '/*-headerbanner-*/', $banner, $data);
    ?>

     

    to:

    <?php
    $template = fopen("../Header/Template.php", "r"); // with the appropriate checks of course
    $data = str_replace( '/*-headerbanner-*/', $banner, $template);
    ?>

     

    and wrap your code in <?php ?> tags, as it makes it easier to read.

  13. you shouldn't have so much html in your php file.

     

    i would have an external file that is the template for what you want to create, and you fopen that into a string and then str_replace markers with values in your script.

     

    for example, instead of:

    <span class="menu-mid"><b>Messages(<?php echo $nb_new_pm; ?> unread)</b></span>

    you'd have something like:

    <span class="menu-mid"><b>Messages(/*-msgunread-*/ unread)</b></span>

    in a template file.

     

    then you open that template file, and replace the placeholders with the data

    <?php
    $data = fopen(template.htm, "r") // with the appropriate checks of course
    str_replace( '/*-msgunread-*/', $nb_new_pm, $data);
    //etc, str_replace your vars
    $handle = fopen(dest_file.htm, 'w'); // with the appropriate checks of course
    fwrite($handle, $data); // with the appropriate checks of course
    ?>
    

    and then write the new file.

     

    if it's php, make it php - but you are writing a lot of html and if you write the vars into a static file why make it php?

     

     

  14. i can think of manually running a loop and setting a counter +1 for every time it finds that name in the array, but that is ugly and won't scale. i don't recommend it.

    i am eager to see the best response for this as I am sure there is a simpler bit of code than a comparison loop.

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