我正在iDev联盟paypal IPN上做一些自定义工作,我正在尝试为退款项目设置一个补丁.我的数据库工作正常,但我似乎无法获得IF捕获权.
关于我应该改变它的任何建议?
if($_REQUEST["payment_status"] == "refunded"||$testing==1)
{
$email = $_REQUEST["payer_email"];
$sid = $_REQUEST["subscr_id"];
$tid = $_REQUEST["txn_id"];
if (!$tid)
{
$tid='xxx';
}
if ($testing==1)
{
echo "testing on";
$sid = "I-E5E34E0DTMUS";
}
$query = "SELECT * FROM idevaff_sales WHERE tid1='$tid'";
$result = mysql_query($query);
if (!$result)
{
//echo $query; exit;
mail('***@gmail.com',"1",$query);
}
$arr = mysql_fetch_array($result);
$aid = $arr['id'];
$query = "SELECT * FROM idevaff_affiliates WHERE tid1='$tid'";
$result = mysql_query($query);
if ($result)
{
//echo $query;
mail('***@gmail.com',"2","$query");
}
$arr = mysql_fetch_array($result);
$email = $arr['email']; …Run Code Online (Sandbox Code Playgroud) 右键单击C#中DataGridView的空白部分(单击不包含任何行的网格的一部分)时,上下文菜单仍会显示其基于行的选项.如果点击落在一行上,我怎么才能显示上下文菜单?
这是我得到的:
private void f_context_select_row(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Right)
{
var hti = jobs_datagrid.HitTest(e.X, e.Y);
if (hti.RowIndex >= 0)
{
jobs_datagrid.ClearSelection();
jobs_datagrid.Rows[hti.RowIndex].Selected = true;
}
else
{
//what can I do here to collapse the context menu?
}
}
}
Run Code Online (Sandbox Code Playgroud)
我以编程方式构建Datagrid和上下文菜单,如下所示:
//on right click select row
jobs_datagrid.MouseDown += new MouseEventHandler(f_context_select_row);
//generate context menu
ContextMenuStrip m = new ContextMenuStrip();
ToolStripMenuItem context_datagrid_run = new ToolStripMenuItem("Run All Selected Campaigns");
ToolStripMenuItem context_datagrid_edit = new ToolStripMenuItem("Edit This Campaign");
ToolStripMenuItem context_datagrid_delete = …Run Code Online (Sandbox Code Playgroud) 我有一个Windows APP正在开发的情况,其中DownloadFile抛出"无法找到路径的一部分"异常.
我用来将远程zip文件保存到我的硬盘驱动器的方法如下所示:
private void f_begin_download(string remoteURL)
{
string directoryName = System.IO.Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
//MessageBox.Show(directoryName);
filePath = directoryName + "\\tmp\\";
filePath = f_make_directory(filePath);
Uri remoteURI = new Uri(remoteURL);
System.Net.WebClient downloader = new System.Net.WebClient();
downloader.DownloadFileCompleted += new System.ComponentModel.AsyncCompletedEventHandler(f_downloader_DownloadFileCompleted);
try
{
downloader.DownloadFile(remoteURI, filePath);
}
catch (Exception ex)
{
MessageBox.Show(remoteURI.ToString());
MessageBox.Show(filePath);
MessageBox.Show(ex.ToString());
}
}
Run Code Online (Sandbox Code Playgroud)
此方法实际上在我的应用程序目录中创建了/ tmp /文件夹.它也成功创建了文件夹:
public static string f_make_directory(string path)
{
try
{
System.IO.DirectoryInfo newFolder = new System.IO.DirectoryInfo(path);
if (!newFolder.Exists)
{
newFolder.Create();
}
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
return path;
} …Run Code Online (Sandbox Code Playgroud) 我需要一个替换字符串一次功能,并相信preg_match可能是我最好的选择.
我正在使用它,但由于使用的动态性,有时这个函数表现得很奇怪:
function str_replace_once($remove , $replace , $string)
{
$pos = strpos($string, $remove);
if ($pos === false)
{
// Nothing found
return $string;
}
return substr_replace($string, $replace, $pos, strlen($remove));
}
Run Code Online (Sandbox Code Playgroud)
现在我采用这种方法,但已经遇到下面列出的错误....我正在使用此函数解析所有类型的html字符串,因此很难给出导致错误的值.截至目前,我对以下80%的使用显示此错误.
function str_replace_once($remove , $replace , $string)
{
$remove = str_replace('/','\/',$remove);
$return = preg_replace("/$remove/", $replace, $string, 1);
return $return;
}
Run Code Online (Sandbox Code Playgroud)
错误:
警告:preg_replace()[function.preg-replace]:编译失败:在偏移量0处不重复
有人可以改进解决方案吗?
我有一个看起来像这样的列表
List<custom> this_list = new List<custom>();
this_list.Add(new custom()
{
key = male,
value = 50
});
this_list.Add(new custom()
{
key = female,
value = 90
});
this_list.Add(new custom()
{
key = male,
value = 5
});
Run Code Online (Sandbox Code Playgroud)
我怎样才能评估这个清单,以便确定有55名男性和90名女性?另外,假设我的密钥集非常大,手动定义男性或女性或其他密钥效率低下.如何创建包含合计总计和唯一键的新列表?
感谢您的帮助和关注!
我有这个问题.我想检测是否没有会话变量并创建一个,但如果一个已存在且为空,我想不管它.
如果没有检测到,我说我有这个来创建我的会话变量:
if (!$_SESSION['second_prefix']){$_SESSION['second_prefix'] = "";}
Run Code Online (Sandbox Code Playgroud)
我应该如何更改此不执行任何操作是否$_SESSION['second_prefix']存在但故意空白?
哈德森
我有一个看起来像这样的问题:
我的文本字符串如下:
<div>
content
<div>
<div>
content
<div>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
如果你注意到我错过了一些div,当我在其他地方使用这些内容时,这可能会破坏我的主题.
解决这类问题的最佳方法是什么?这就是我自己拥有的,但往往不够好.此函数试图通过不修复它来解决问题,而是将其装入以防止破坏的html破坏我的其他html的可能性.
function ($string)
{
$div_open = substr_count($string, "<div");
$div_close = substr_count($string, "</div>");
while ($div_close<$div_open)
{
$string = "$string</div>";
$div_close = substr_count($string, "</div>");
if ($i>1000){echo 'pop 3'; exit;}else{$i++;}
}
while ($div_close>$div_open)
{
$string = "<div>$string";
$div_open = substr_count($string, "<div");
if ($i>1000){echo 'pop 4 '; exit;}else{$i++;}
}
return $string;
}
Run Code Online (Sandbox Code Playgroud)
有没有更好的办法?
php ×4
c# ×3
datagridview ×1
html-parsing ×1
paypal ×1
paypal-ipn ×1
regex ×1
session ×1
string ×1