{"id":114,"date":"2014-03-25T14:53:10","date_gmt":"2014-03-25T13:53:10","guid":{"rendered":"http:\/\/www.riedmann.it\/blog\/?p=114"},"modified":"2014-03-25T14:53:10","modified_gmt":"2014-03-25T13:53:10","slug":"why-does-the-instr-function-in-kixtart-seems-to-not-work-correctly","status":"publish","type":"post","link":"https:\/\/blog.riedmann.it\/?p=114","title":{"rendered":"Why does the instr function in kixtart seems to not work correctly?"},"content":{"rendered":"<p>Today, I had a problem with a login script specially for Windows 8 users with a microsoft account.<\/p>\n<p>For these, the @userid macro of kixtart returns the full microsoft account, i.e. gregakselrod@outlook.com.<\/p>\n<p>Since I was interested in the part before the @, I wrote the following script part:<\/p>\n<blockquote><p>$len = instr( @userid, &#8220;@&#8221; )<br \/>\nif $len == 0<br \/>\n  $localuser = @userid<br \/>\nelse<br \/>\n  $localuser = substr( @userid, 1, $len &#8211; 1 )<br \/>\nendif<\/p><\/blockquote>\n<p>but it does not worked &#8211; $len was 0 all the time.<\/p>\n<p>It seems kixtart interprets the @ character even if quoted. This is the fixed script:<\/p>\n<blockquote><p>$len = instr( @userid, chr( 64 ) )<br \/>\nif $len == 0<br \/>\n  $localuser = @userid<br \/>\nelse<br \/>\n  $localuser = substr( @userid, 1, $len &#8211; 1 )<br \/>\nendif\n<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>Today, I had a problem with a login script specially for Windows 8 users with a microsoft account. For these, the @userid macro of kixtart returns the full microsoft account, i.e. gregakselrod@outlook.com. Since I was interested in the part before the @, I wrote the following script part: $len = instr( @userid, &#8220;@&#8221; ) if [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8,3],"tags":[],"class_list":["post-114","post","type-post","status-publish","format-standard","hentry","category-windows-managment-and-tools","category-windows-networking"],"_links":{"self":[{"href":"https:\/\/blog.riedmann.it\/index.php?rest_route=\/wp\/v2\/posts\/114","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.riedmann.it\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.riedmann.it\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.riedmann.it\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.riedmann.it\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=114"}],"version-history":[{"count":1,"href":"https:\/\/blog.riedmann.it\/index.php?rest_route=\/wp\/v2\/posts\/114\/revisions"}],"predecessor-version":[{"id":115,"href":"https:\/\/blog.riedmann.it\/index.php?rest_route=\/wp\/v2\/posts\/114\/revisions\/115"}],"wp:attachment":[{"href":"https:\/\/blog.riedmann.it\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=114"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.riedmann.it\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=114"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.riedmann.it\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=114"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}