提交表格的商店? [关闭]

问题描述:

we have just implemented an form on our intranet that allows anyone in IT (close to 100 people) the ability to tweet out to our users using a particular twitter account. Is there a way to store on the server or elsewhere who loaded the page at a particular time, or, even better, who filled in and submitted the form?

<div style="float: right; width: 450px; padding:20px;">
Use the box below to send out a tweet unrelated to the system status updates further down.<br />
<form name="MaffTwitterText" target="invisibleForm2" id="MaffTwitterText" action="./TweetText.php" method="post">
<textarea name="tweetMafftext" id="textarea" style="width:100%; height: 80px;" maxlength="140" placeholder="Enter your tweet here"></textarea>
<button type="submit" >
Click once only to send tweet
</button><br><iframe name="invisibleForm2" id="invisibleForm2" width="100px" height="25px" frameborder="0" scrolling="no"></iframe>
</form>
</div>

EDIT: revisiting this, What I was trying to achieve was to get a hidden variable within the form that contained the user's name (anonymous is disabled in IIS), looking back this was very badly worded as I didn't know what I was doing.

我们刚刚在我们的Intranet上实现了一个表单,允许IT(接近100人)的任何人发布推文 使用特定的Twitter帐户给我们的用户。 有没有办法存储在服务器上或在特定时间加载页面的其他地方,或者更好的是,谁填写并提交了表单? p>

 &lt; div  style =“float:right; width:450px; padding:20px;”&gt; 
使用下面的框发送与系统状态更新无关的推文。&lt; br /&gt; 
&lt; form name =“  MaffTwitterText“target =”invisibleForm2“id =”MaffTwitterText“action =”./ TweetText.php“method =”post“&gt; 
&lt; textarea name =”tweetMafftext“id =”textarea“style =”width:100%; 身高:80px;“  maxlength =“140”占位符=“在此输入您的推文”&gt;&lt; / textarea&gt; 
&lt; button type =“submit”&gt; 
只点击一次以发送推文
&lt; / button&gt;&lt; br&gt;&lt;  iframe name =“invisibleForm2”id =“invisibleForm2”width =“100px”height =“25px”frameborder =“0”scrolling =“no”&gt;&lt; / iframe&gt; 
&lt; / form&gt; 
&lt; / div&gt;  
  code>  pre> 
 
 

编辑:重新审视这个,我想要实现的是在包含用户名的表单中获取隐藏变量(在IIS中禁用匿名), 回顾这个措辞非常糟糕,因为我不知道自己在做什么。 p> div>

If you are referring to getting the IP address of the user, just use the function from https://*.com/questions/1437771/how-can-i-get-the-clients-ip-address-in-a-php-webservice:

public static function get_remote_ip() {
    if(isset($_SERVER['REMOTE_ADDR']) && !empty($_SERVER['REMOTE_ADDR'])) {
        return $_SERVER['REMOTE_ADDR'];
    } 

    if(isset($_SERVER['HTTP_X_FORWARDED_FOR']) && !empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
        return $_SERVER['HTTP_X_FORWARDED_FOR'];
    }

    return null;
}

Then just send that as a hidden variable and store it somewhere such as a mysqli database or a file including the tweet with it.