Support » Plugins » Header Error In Plugin

  • Resolved Fahim Mahmood


    Hi there i am new to this WordPress Development…Here i am making a Plug in that will run a Script with some Parameters which can be set by User and that script will run in wp_footer apart from that i am saving user data in a simple text file which is created when the user submit the data and that file is saved with the login name of user and accomplished it i am successfully making a user submit the values and file is also been created but when i logout it is not making me logout and either when i try to login from other browser it also give me header errors here i will post the code below:

    plugin index.php:

    Plugin Name: Dhudora
    Version: 0.1
    Description: Advertisment Plugin
    Author: Fahim Mahmood Mir
    Author URI:
    Plugin URI:
    <!--<script type="text/javascript">
    function formValidator(forme)
    	var limit = document.getElementById('txtlimit').value;
    	var seck = document.getElementById('txtkey').value;
    	var interval = document.getElementById('txtinterval').value;
    add_action('admin_menu', 'basicPluginMenu');
    function basicPluginMenu() {
    $appName = 'Dhundora';
    $appID = 'basic-plugin';
    add_menu_page($appName, $appName, 'administrator', $appID, 'pluginAdminScreen');
    function pluginAdminScreen() {
    	  global $current_user;
           $userlog=  $current_user->user_login ;
    	echo '<h1> Welcome to Dhundora Advertising Script</h1>';
        This is the Plugin that will be helping the Dhundora to Successfully launch the Script In this Plugin of WordPress<br>
    <form id="forme" action="../wp-content/plugins/dhundora/process-file.php"  method="get">
    <br /><br />
    <span name="login-subheading">Secrect Key</span><br />
    <input  id="txtkey" name="userkey" type="text" style="width:300px" /><br />
    <br />
    <input type="hidden" id="txtuser" name="username" value ='<?php echo $userlog; ?>' /><br />
    <span name="login-subheading">Limit</span><br />
    <input id="txtlimit" name="userlimit" style="width:300px" type="text" />&nbsp;
    <br /><br />
    <span name="login-subheading">Interval</span><br />
    <input id="txtinterval" name="userinterval" type="text" style="width:300px" />&nbsp;<br /><br />
    <input id="login-submit" name="Continue" type="submit" value="Register" style="padding:8px"/>
    <div id="result">
    $data = array();
    $myFile = "../wp-content/plugins/dhundora/".$userlog.".txt";
    $fh = fopen($myFile, 'a+') or die("No Settings Saved");
    $i = -1;
    //Output a line of the file until the end is reached
    	  $i = $i+1;
      $data[$i] = fgets($fh);
    echo  '<br /><br />'.'<input type="text" readonly="readonly" value =  '.$data[0]. ' /><br />';
    echo  '<br /><br />'.'<input type="text" readonly="readonly" value =  '.$data[1]. ' /><br />';
    echo  '<br /><br />'.'<input type="text" readonly="readonly" value =  '.$data[2]. ' /><br />';

    and the form submittion file process-file.php

    /*$userlim =  $_GET['userlimit']."\n";
    $userint =  $_GET['userinterval']."\n";
    $userkey = $_GET['userkey']."\n";
    $myFile = $_GET['username'].".txt";
    $fh = fopen($myFile, 'w+') or die("can't open file");
    $stringData = $userkey = $_GET['userkey']."\n".$_GET['userlimit']."\n".$_GET['userinterval']."\n";
    fwrite($fh, $stringData);
    Your Settings are Saved <a href="javascript:void()" onclick="window.history.back();" > Go to Back</a><br>

    can anyone tell me why this thing giving header error ??

Viewing 1 replies (of 1 total)
  • Fahim Mahmood


    i Got it!!

    The Problem was really Tiny lol Just the Blank Spaces before php Tags Phewwwwww

    Never Leave a Blank Space before PHP Tags


Viewing 1 replies (of 1 total)
  • The topic ‘Header Error In Plugin’ is closed to new replies.