Please help me edit this script code well - displays error

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Please help me edit this script code well - displays error

    352. $left = "{" ;
    353. $right = "}" ;
    354. foreach ( $global_whati as $sillyvar ) {
    355. $global_what [ ] = $left . $sillyvar . $right ;
    356. }
    357. $data = str_replace ( $global_what , $global_with , $data ) ;
    358. foreach ( $whati as $sillyvar ) {

    It displays this error on the site

    Warning : Invalid argument supplied for foreach() in /home/u601023255/public_html/config.php on line 354 . . .

    and it doesn't connect to the dbase... Pls help me out wapmasters...

    #2
    it is most probably the fact foreach is used with arrays, and from what ive tested the error
    dissapears the moment i introduce the Variables to an array like so.



    PHP Code:
    <?php

    $global_whati 
    = array();
    $left "{";
    $right "}";
    foreach(
    $global_whati as $sillyvar)
    {
    $global_what[] = $left.$sillyvar.$right;
    }
    $data str_replace($global_what$global_with$data);

    $whati = array();
    foreach(
    $whati as $sillyvar)
    {
    }
    ?>

    also i removed all unnessicary white space..

    i found no error to print out once the array was established.
    <?php
    include ('Ghost');
    if ($Post == true) {
    echo '

    sigpic
    alt='coding-talk.com!!' />';
    echo 'Sharing Is Caring!';
    } else {
    echo '

    alt='the username GHOST has been comprimised!' />';
    echo 'OMG SOMEBODY HELP ME!!';
    }
    ?>

    Comment


      #3
      this what i use as you can see ive used curl before or you can use file_get_contents
      all it is is function to read data from template ex insert php data into the page templates,
      you have global data and then you have page by page data
      PHP Code:
      /////GLOBALS WHAT/////
      $global_what = Array(
      'baseaddr',
      'action',
      'mode',
      'directory',
      'images',
      'sitename',
      'site',
      'sitecolor',
      'shadow',
      'username',
      'uid',
      'mobads',
      'mobads2',
      'ipaddress',
      'browser',
      'email',
      'mysql_error'
      );

      /////GLOBALS WITH/////

      $global_with = Array(
      $baseaddr,
      $action,
      $mod,
      $directory,
      $images,
      $sitename,
      $_SESSION['sitename'],
      $_SESSION['navcolor'],
      $_SESSION['sitecolor_shadow'],
      $_SESSION['username'],
      $_SESSION['uid'],
      "<a href=\"http://info.wapdesire.com\">click here for help</a>",
      "<a href=\"http://info.wapdesire.com\">click here for help</a>",
      ip(),
      browser($_SERVER['HTTP_USER_AGENT']),
      fetch_array("email",members,"id = 1"),
      $mysqlerror
      ); 
      PHP Code:
      function Template($what$with$temp)
      {
      global 
      $global_what,$global_with;
      if (!
      is_file("./templates/$temp.xhtml")) error("file not found!");
      $data file_get_contents("./templates/$temp.html",1);
      /*
      $cURL = curl_init();
      curl_setopt($cURL, CURLOPT_URL, "http://www.wapdesire.com/templates/$temp.html");
      curl_setopt($cURL, CURLOPT_HEADER, 0);
      curl_setopt($cURL, CURLOPT_RETURNTRANSFER, 1);
      $data = curl_exec($cURL);
      curl_close($cURL);
      */
      foreach($what as $getvar$What[] = "{".$getvar."}";
      $data str_replace($What$with$data);
      foreach(
      $global_what as $getvar$Global_what[] = "{".$getvar."}";
      $data str_replace($Global_what$global_with$data);
      print 
      $data;

      Comment

      Working...
      X