Anyone know what could cause this error?

  1. 2 years ago

    Betty

    21 Aug 2015 http://why-walk.net/BlueSunday...

    I'm trying to get the new version of eTCG uploaded. And I'm practicing on a separate sub-directory so that I don't screw my trade post up. Everything went great, until I tried opening one of my trade post pages up. It says:
    No direct script access allowed

    http://www.why-walk.net/BlueSunday/tcgs/1up/main.php

    Hi Betty! Make sure you're using this code to include func.php:

    <?php define('VALID_INC', TRUE); include_once 'func.php'; ?>
  2. Betty

    21 Aug 2015 http://why-walk.net/BlueSunday...
    Edited 2 years ago by Betty

    I know I need the func.php file in there, but it won't allow me to put in there without that error. And I have the func.php file uploaded in the same directory as each tcg.

  3. Bloo

    21 Aug 2015 Administrator Answer kablooey.net

    Hi Betty! Make sure you're using this code to include func.php:

    <?php define('VALID_INC', TRUE); include_once 'func.php'; ?>
  4. Betty

    21 Aug 2015 http://why-walk.net/BlueSunday...

    Now I got this:
    Warning: require_once(etcg/config.php): failed to open stream: No such file or directory in /home/lkupouqr/public_html/BlueSunday/tcgs/1up/func.php on line 3

    Fatal error: require_once(): Failed opening required 'etcg/config.php' (include_path='.:/usr/local/lib/php') in /home/lkupouqr/public_html/BlueSunday/tcgs/1up/func.php on line 3

  5. Betty

    21 Aug 2015 http://why-walk.net/BlueSunday...

    No matter where I put that coding I get an error on the main page.

  6. Betty

    21 Aug 2015 http://why-walk.net/BlueSunday...

    Here's a new error:
    Fatal error: Call to undefined function cardcount() in /home/lkupouqr/public_html/BlueSunday/tcgs/1up/main.php on line 38

  7. Betty

    22 Aug 2015 http://why-walk.net/BlueSunday...

    And on the collecting deck:
    Fatal error: Call to undefined function show_collecting() in /home/lkupouqr/public_html/BlueSunday/tcgs/1up/collect.php on line 11

  8. Bloo

    22 Aug 2015 Administrator kablooey.net

    You shouldn't need to have func.php in each individual TCG directory. Just put one copy of func.php in the main directory for your tradepost site. It should be in the same directory as your "etcg" folder. The func.php script is trying to reference the "config.php" script within the "etcg" directory, but it can't find it because it's nested within all of those sub directories.

  9. Betty

    22 Aug 2015 http://why-walk.net/BlueSunday...

    I deleted the func.php out of the 1 Up directory, and it's still giving me that error.

    This is the coding for the main.php file in 1 Up:
    <?php include('header.php'); ?>

    <center>
    <h1>1 Up</h1>
    <?php include('menu.php'); ?>
    <br><br>

    <h1>Profile</h1>
    <center>
    <img src="cards/mc-Betty.png"> <img src="cards/betty-chip.png"><p>
    If you join, please say <i>Betty</i> referred you!<p>
    <a href="http://1up.press-pause.net/"><img src="cards/l12.png" border="0" target="_blank"></a><p>

    <p>

    <h2>Activity & Trade Logs</h2>
    <p>
    <center><a href="logact.php">Activity Log</a> |
    <a href="logtrade.php">Trade Log</a></center>
    <br>
    <a href="http://www.blue-sunday.info/Logs2/1up.txt" target="_blank">2013 Logs</a> |
    <a href="http://www.blue-sunday.info/Logs2/1upTrade.txt" target="_blank">2013 Trade Logs</a>
    <br>
    <a href="http://www.blue-sunday.info/Logs3/1Up.txt" target="_blank">2014 Logs</a> |
    <a href="http://www.blue-sunday.info/Logs3/1UpTrade.txt" target="_blank">2014 Trade Logs</a>

    <p>
    <h2>Stats</h2>
    <center>
    <b>Count</b>: <?php echo cardcount('1 Up'); ?> <br>
    <b>Worth</b>: <?php echo cardcount('1 Up','worth'); ?>
    <?php define('VALID_INC', TRUE); include_once 'func.php'; ?>

    </center>

    <?php include('footer.php'); ?>

  10. Bloo

    23 Aug 2015 Administrator kablooey.net
    Edited 2 years ago by Bloo

    The func.php include should be at the top of the page, before any other eTCG code snippets. I recommend just putting it in your header.php file, so you don't need to paste it into each page.

    If your header.php is located inside your 1UP directory, the func.php include code should look something like this:

    <?php define('VALID_INC', TRUE); include_once '../func.php'; ?>

    This tells PHP to look for the func.php file in the parent directory (ie. "/home/lkupouqr/public_html/BlueSunday/tcgs/").

    If you still have issues, would you mind attaching your header.php and footer.php?

  11. Betty

    23 Aug 2015 http://why-walk.net/BlueSunday...

    Header.php:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <?php define('VALID_INC', TRUE); include_once '../func.php'; ?>
    <html>
    <head>
    <title>Blue Sunday</title>
    <link rel="stylesheet" type="text/css" href="style.css">
    <script src="http://www.why-walk.net/BlueSunday/jquery-1.8.3.js"></script>
    <script src="http://www.why-walk.net/BlueSunday/cardsearch-1.0.js"></script>
    </head>

    <body>

    <div id="container">

    <div id="site">Blue Sunday
    <div id="tagline">Betty's trade post
    </div>
    </div>
    <div id="nav">
    <a href="http://www.why-walk.net/BlueSunday/index.php" class="nav">Home</a>
    <a href="http://www.why-walk.net/BlueSunday/trade.php" class="nav">Trade With Me</a>
    </div>

    <div id="container">

    <div class="content">
    <div style="position: relative;float:right; width: 5px; padding:10px;">
    <div id="sidebox">

    </div>

    </div>

    <div style="position: relative;float:left; width: 750px; padding:10px;">

    Footer
    Copyright © Orange Crush | Layout by: Douxriens.com | Background by: Portfelia.com

    Now putting it in the header gives:
    Warning: include_once(../func.php): failed to open stream: No such file or directory in /home/lkupouqr/public_html/BlueSunday/tcgs/1up/header.php on line 2

    Warning: include_once(): Failed opening '../func.php' for inclusion (include_path='.:/usr/local/lib/php') in /home/lkupouqr/public_html/BlueSunday/tcgs/1up/header.php on line 2

    But funny enough, if I use the old func.php file from the old etcg it works just fine. Pulls the cards from the new Admin dashboard and everything. But it's this new func.php file I'm having trouble with.

  12. Bloo

    23 Aug 2015 Administrator kablooey.net

    Where is your func.php uploaded, currently? It seems like the script is still just not seeing the file for some reason.

    Also, it might be easier to just move your header.php and footer.php into your main TCG directory ("/home/lkupouqr/public_html/BlueSunday/tcgs/"), since there doesn't seem to be any markup specific to 1up (from what I can see)? Doing that should put it in the same folder as your func.php, so you should remove the "../" from the include path if you try it.

  13. Betty

    23 Aug 2015 http://why-walk.net/BlueSunday...

    I deleted the func.php out of the 1 Up directory like you told me to. I have one copy in the main folder of BlueSunday outside of the etcg folder because the readme file says this:
    4. Upload your `func.php` to your trade post directory (NOT inside the admin panel directory).

    But the problem is, once I move header.php and footer.php to the main TCG directory, it screws the 1 Up tradepost up, so I do need header.php and footer.php in each directory of all my tradeposts.

    And I can't find a way to code it so I don't need header and footer in each directory.

  14. Bloo

    23 Aug 2015 Administrator kablooey.net

    Ok, I think I misunderstood how you had your files laid out before - try this.

    Your func.php, header.php, and footer.php should be located here: /home/lkupouqr/public_html/BlueSunday/

    Your "etcg" directory should be here: /home/lkupouqr/public_html/BlueSunday/etcg/

    In your "main.php" for 1up (/home/lkupouqr/public_html/BlueSunday/tcgs/1up/), you include your header and footer files like this:

    <?php include('../../header.php'); ?>
    
    <?php include('../../footer.php'); ?>

    The ../../ part tells PHP to go up TWO directories for the included file.

    Then you should just need this line at the top of your header.php:

    <?php define('VALID_INC', TRUE); include_once('func.php'); ?>

    You definitely should not need to have your header and footer files in each TCG directory! It kind of defeats the purpose of having header and footer files. XD Let me know if you still get errors and we'll work through it~

  15. Betty

    23 Aug 2015 http://why-walk.net/BlueSunday...

    YES!

    Now we got it!

    The only problem now is the trade form, got this jumble mumble at the top:
    if ( isset($_POST['tradesubmit']) ) { $database = new Database; $sanitize = new Sanitize; $name = $sanitize->for_db($_POST['name']); $email = $sanitize->for_db($_POST['email']); $website = $sanitize->for_db($_POST['website']); $tcg = intval($_POST['tcg']); $wants = $sanitize->for_db($_POST['wants']); $offer = $sanitize->for_db($_POST['offer']); $comments = $sanitize->for_db($_POST['comments']); $validcards = true; $wants = explode(',',$wants); foreach ( $wants as $card ) { if ( !preg_match("/[a-z0-9_-]/i", $card) ) { $validcards = false; } } $offer = explode(',',$offer); foreach ( $offer as $card ) { if ( !preg_match("/[a-z0-9_-]/i", $card) ) { $validcards = false; } } array_walk($wants, 'trim_value'); array_walk($offer, 'trim_value'); if ( $validcards === true ) { foreach ( $wants as $givingcard ) { unset($cardfound); $result = $database->query("SELECT * FROM `cards` WHERE `tcg`='$tcg' AND `priority`!='3' ORDER BY `priority`"); while ( $row = mysqli_fetch_array($result) ) { if ( !isset($cardfound) || $cardfound != true ) { $cards = explode(',',$row['cards']); array_walk($cards, 'trim_value'); $i = 0; foreach ( $cards as $card ) { if ( preg_match("/^$givingcard$/i", $card) && !isset($cardfound) ) { $foundcards[] = $card; $cardfound = true; } $i++; } } } } if ( isset($foundcards) ) { array_walk($foundcards, 'trim_value'); $foundcards = implode(',',$foundcards); } $wants = implode(',',$wants); if ( $foundcards === $wants ) { $cardsfound = true; } else { $cardsfound = false; } } if ( $name == '' || $email == ''|| $website == '' || $website == 'http://' || $tcg == ''|| $wants == ''|| $offer == '' ) { $error[] = 'Please fill out the form completely. All fields are mandatory except for the comments field.'; } else if ( !filter_var($email, FILTER_VALIDATE_EMAIL) ) { $error[] = 'The supplied email was invalid.'; } else if ( !filter_var($website, FILTER_VALIDATE_URL, FILTER_FLAG_SCHEME_REQUIRED) ) { $error[] = 'The supplied URL was invalid. Make sure you include http://.'; } else if ( $validcards === false ) { $error[] = "One or more cards is invalid. Check that you're separating card names with commas, and that cardnames are spelled out and formatted correctly (cardname00)."; } else if ( $cardsfound !== true ) { $error[] = "One or more cards that you requested were not found in my collection. Please check your spelling, and make sure you're requesting cards from categories marked as trading. If you're unsure, leave a note about it in the comments field."; } else { $wants = explode(',',$wants); foreach ( $wants as $givingcard ) { unset($cardfound); $result = $database->query("SELECT * FROM `cards` WHERE `tcg`='$tcg' AND `priority`!='3' ORDER BY `priority`"); $x = 0; while ( $row = mysqli_fetch_array($result) ) { if ( !isset($cardfound) || $cardfound != true ) { $cards = explode(',',$row['cards']); array_walk($cards, 'trim_value'); $i = 0; foreach ( $cards as $card ) { if ( preg_match('/^'.$givingcard.'$/i', $card) && !isset($cardfound) ) { if ( $removedcards[$x] == '' ) { $removedcards[$x] = $card; } else { $removedcards[$x] = ''.$removedcards[$x].', '.$card.''; } $removedcats[$x] = $row['category']; $cards[$i] = ''; $cardfound = true; } $i++; } $cards = array_filter($cards); sort($cards); $cards = implode(', ',$cards); $categid = $row['id']; $resultt = $database->query("UPDATE `cards` SET `cards`='$cards' WHERE `id`='$categid'"); if ( !$resultt ) { $error[] = "Error updating cards from category ".$row['category'].""; } } $x++; } } $offer = implode(', ',$offer); $wants = implode(', ',$wants); $giving = implode('; ',$removedcards); $givingcats = implode(', ',$removedcats); $today = date("Y-m-d"); $result = $database->query("INSERT INTO `trades` (`tcg`,`trader`,`email`,`giving`,`givingcat`,`receiving`,`receivingcat`,`type`,`date`) VALUE ('$tcg','$name','$email','$giving','$givingcats','$offer','','incoming','$today')"); if ( !result ) { $error[] = "Could not add the new trade. ".mysqli_error().""; } $youremail = $database->get_assoc("SELECT `value` FROM `settings` WHERE `setting` = 'email'"); $youremail = $youremail['value']; $etcgurl = $database->get_assoc("SELECT `value` FROM `settings` WHERE `setting` = 'etcgurl'"); $etcgurl = $etcgurl['value']; $tcgname = $database->get_assoc("SELECT `name` FROM `tcgs` WHERE `id`='$tcg'"); $tcgname = $tcgname['name']; $headers = "From: $name \r\n"; $headers.= "Reply-To: $email"; $message = "New Incoming Trade Request for $tcgname: \n\nName: $name \nEmail: $email \nWebsite: $website \nTCG: $tcgname \nCards Wanted: $wants \nCards Offered: $offer \nComments: $comments \n\nManage $tcgname Trades: ".$etcgurl."trades.php?id=$tcg"; if ( mail($youremail,"Trade Request: $tcgname",$message,$headers) ) { $success = true; } else { $error[] = "There was an error sending your form. Please try again, or send an email directly to $youremail."; } } } ?>

  16. Betty

    23 Aug 2015 http://why-walk.net/BlueSunday...

    trade.php file:
    trade.php file:
    <?php include('header.php'); ?>


    if ( isset($_POST['tradesubmit']) ) {

    $database = new Database;
    $sanitize = new Sanitize;

    $name = $sanitize->for_db($_POST['name']);
    $email = $sanitize->for_db($_POST['email']);
    $website = $sanitize->for_db($_POST['website']);
    $tcg = intval($_POST['tcg']);
    $wants = $sanitize->for_db($_POST['wants']);
    $offer = $sanitize->for_db($_POST['offer']);
    $comments = $sanitize->for_db($_POST['comments']);

    $validcards = true;

    $wants = explode(',',$wants);
    foreach ( $wants as $card ) {
    if ( !preg_match("/[a-z0-9_-]/i", $card) ) { $validcards = false; }
    }

    $offer = explode(',',$offer);
    foreach ( $offer as $card ) {
    if ( !preg_match("/[a-z0-9_-]/i", $card) ) { $validcards = false; }
    }

    array_walk($wants, 'trim_value');
    array_walk($offer, 'trim_value');

    if ( $validcards === true ) {

    foreach ( $wants as $givingcard ) {

    unset($cardfound);

    $result = $database->query("SELECT * FROM `cards` WHERE `tcg`='$tcg' AND `priority`!='3' ORDER BY `priority`");
    while ( $row = mysqli_fetch_array($result) ) {

    if ( !isset($cardfound) || $cardfound != true ) {

    $cards = explode(',',$row['cards']);
    array_walk($cards, 'trim_value');

    $i = 0;
    foreach ( $cards as $card ) {
    if ( preg_match("/^$givingcard$/i", $card) && !isset($cardfound) ) {
    $foundcards[] = $card;
    $cardfound = true;
    }
    $i++;
    }

    }

    }

    }


    if ( isset($foundcards) ) {
    array_walk($foundcards, 'trim_value');
    $foundcards = implode(',',$foundcards);
    }

    $wants = implode(',',$wants);

    if ( $foundcards === $wants ) { $cardsfound = true; } else { $cardsfound = false; }

    }

    if ( $name == '' || $email == ''|| $website == '' || $website == 'http://' || $tcg == ''|| $wants == ''|| $offer == '' ) { $error[] = 'Please fill out the form completely. All fields are mandatory except for the comments field.'; }
    else if ( !filter_var($email, FILTER_VALIDATE_EMAIL) ) { $error[] = 'The supplied email was invalid.'; }
    else if ( !filter_var($website, FILTER_VALIDATE_URL, FILTER_FLAG_SCHEME_REQUIRED) ) { $error[] = 'The supplied URL was invalid. Make sure you include <em>http://</em>.'; }
    else if ( $validcards === false ) { $error[] = "One or more cards is invalid. Check that you're separating card names with commas, and that cardnames are spelled out and formatted correctly (cardname00)."; }
    else if ( $cardsfound !== true ) { $error[] = "One or more cards that you requested were not found in my collection. Please check your spelling, and make sure you're requesting cards from categories marked as <em>trading</em>. If you're unsure, leave a note about it in the comments field."; }
    else {

    $wants = explode(',',$wants);

    foreach ( $wants as $givingcard ) {

    unset($cardfound);

    $result = $database->query("SELECT * FROM `cards` WHERE `tcg`='$tcg' AND `priority`!='3' ORDER BY `priority`");
    $x = 0;
    while ( $row = mysqli_fetch_array($result) ) {

    if ( !isset($cardfound) || $cardfound != true ) {

    $cards = explode(',',$row['cards']);
    array_walk($cards, 'trim_value');

    $i = 0;
    foreach ( $cards as $card ) {
    if ( preg_match('/^'.$givingcard.'$/i', $card) && !isset($cardfound) ) {
    if ( $removedcards[$x] == '' ) { $removedcards[$x] = $card; } else { $removedcards[$x] = ''.$removedcards[$x].', '.$card.''; }
    $removedcats[$x] = $row['category'];
    $cards[$i] = '';
    $cardfound = true;
    }
    $i++;
    }

    $cards = array_filter($cards);
    sort($cards);
    $cards = implode(', ',$cards);

    $categid = $row['id'];
    $resultt = $database->query("UPDATE `cards` SET `cards`='$cards' WHERE `id`='$categid'");
    if ( !$resultt ) { $error[] = "Error updating cards from category ".$row['category'].""; }

    }

    $x++;

    }

    }

    $offer = implode(', ',$offer);
    $wants = implode(', ',$wants);
    $giving = implode('; ',$removedcards);
    $givingcats = implode(', ',$removedcats);

    $today = date("Y-m-d");
    $result = $database->query("INSERT INTO `trades` (`tcg`,`trader`,`email`,`giving`,`givingcat`,`receiving`,`receivingcat`,`type`,`date`) VALUE ('$tcg','$name','$email','$giving','$givingcats','$offer','','incoming','$today')");
    if ( !result ) { $error[] = "Could not add the new trade. ".mysqli_error().""; }

    $youremail = $database->get_assoc("SELECT `value` FROM `settings` WHERE `setting` = 'email'");
    $youremail = $youremail['value'];
    $etcgurl = $database->get_assoc("SELECT `value` FROM `settings` WHERE `setting` = 'etcgurl'");
    $etcgurl = $etcgurl['value'];
    $tcgname = $database->get_assoc("SELECT `name` FROM `tcgs` WHERE `id`='$tcg'");
    $tcgname = $tcgname['name'];
    $headers = "From: $name \r\n";
    $headers.= "Reply-To: $email";
    $message = "New Incoming Trade Request for $tcgname: \n\nName: $name \nEmail: $email \nWebsite: $website \nTCG: $tcgname \nCards Wanted: $wants \nCards Offered: $offer \nComments: $comments \n\nManage $tcgname Trades: ".$etcgurl."trades.php?id=$tcg";

    if ( mail($youremail,"Trade Request: $tcgname",$message,$headers) ) { $success = true; } else { $error[] = "There was an error sending your form. Please try again, or send an email directly to <em>$youremail</em>."; }

    }
    }

    ?>

    <?php

    if ( $success ) { echo "<h1>Trade Me</h1><p><strong>Your form was submitted successfully!</strong> Any cards that you requested should have been moved to my pending cards section. I will get back to you as soon as possible, but please allow at least a week for a response to your trade request before resubmitting/withdrawing your offer. <em>Thank you!</em></p><p>&raquo; <a href=\"index.php\">Return to Index</a><br />&raquo; <a href=\"trade.php\">Return to Trade Form</a></p>"; }

    else {

    $database = new Database;
    $youremail = $database->get_assoc("SELECT `value` FROM `settings` WHERE `setting` = 'email'");
    $youremail = $youremail['value'];

    ?>

    <h1>Trade Me</h1>
    <div align="center"><ul>
    <li>Please allow at least <em>7 days</em> for a response to your trade request.</li>
    <li>If the form doesn't work, feel free to email me: <strong><?php echo str_replace('@','[at]',$youremail); ?></strong></li>
    <li><strong>Please spell out card names COMPLETELY.</strong> (ie. do NOT type cardname01/02; DO type cardname01, cardname02)</li>
    </ul></div>

    <br />

    <?php include 'tradeform.php'; } ?>
    <?php include('footer.php'); ?>

  17. Bloo

    24 Aug 2015 Administrator kablooey.net

    You just need to remove the closing PHP tag on the first line of trade.php, here:

    <?php include('header.php'); ?>

    So it should just be:

    <?php include('header.php');
  18. Betty

    24 Aug 2015 http://why-walk.net/BlueSunday...

    YES! Got it.

    Just so many little things that need to be changed to make it work this time around that worked with the earlier version of the script.

    Now, I can start working on it instead of tearing my hair out.

    Thank you so, so much!

  19. Betty

    24 Aug 2015 http://why-walk.net/BlueSunday...

    Just one more quick question.

    How do you get mastered decks to link with this new version?

    I really don't want to mess with anything in the func.php file on my own because I know I'll screw something up.

    You can see what I mean right here:
    http://www.why-walk.net/BlueSunday/tcgs/1up/mastered.php

    The mastered badge is there, but you can't click on it to be taken to the deck.

  20. Bloo

    27 Aug 2015 Administrator kablooey.net

    Could you attach your mastered.php? I'll try to set it up for you. ^^

  21. Newer ›

or Sign Up to reply!