Forums

PHP

This topic is locked

Convert asp to php

Posted 15 Aug 2002 06:51:21
1
has voted
15 Aug 2002 06:51:21 Johnny Lee posted:
Hi,

Can someone convert this piece of asp code to php for me? Thank you.

<%
While ((Repeat1__numRows <> 0) AND (NOT rsQuest.EOF))
%>
<INPUT type="radio" name="ANS_ID" value="<%=(rsQuest.Fields.Item("ANS_ID".Value)%>">
<I><%=(rsQuest.Fields.Item("ANSWERS".Value)%></I>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
rsQuest.MoveNext()
Wend
%>

I think it is very similar to this, but I don't know the exact code.
Thank you.

Replies

Replied 15 Aug 2002 10:17:28
15 Aug 2002 10:17:28 Aurel Sorin Cirstoiu replied:
Hello,

You can use this tool:

asp2php.naken.cc/download.php

-----------------------
Cirstoiu Aurel Sorin
InterAKT Support
www.interakt.ro
-----------------------
Replied 18 Aug 2002 15:10:29
18 Aug 2002 15:10:29 Tim Green replied:
That was a lazy answer, and I wouldn't recommend to anyone the use of an automatic ASP->PHP converter like this. Especially as they do not have the ability to work with PHP Class Objects.

The literaly conversion of the code you posted, is similar to standard generated code, but the translation to PHP is this :-

<?php
while (($Repeat1__numRows <> 0) AND (!$rsQuest->EOF()) {
?>
<input type="radio" name="ANS_ID" value="<?php echo $rsQuest->Fields("ANS_ID"; ?>">
<I><? echo $rsQuest->Fields("ANSWERS"; ?></I>
<?php
$Repeat1__index=$Repeat1__index+1;
$Repeat1__numRows=$Repeat1__numRows-1;
$rsQuest->MoveNext();
}
?>


I hope it helps.

Tim Green

Extension & PHP TalkZone Manager
<font size=1>-------------------------------------------
<i>Please read the Forum FAQ before posting
a question to this TalkZone.</i>
-------------------------------------------
www.UDzone.com : A dynamic Dreamweaver,
Ultradev and Fireworks site for developers
by developers.
-------------------------------------------</font id=size1>
Replied 06 Apr 2006 09:41:15
06 Apr 2006 09:41:15 Ben Cordasco replied:
Is there a way to perform this asp code in php?

I used one of those quick and dirty converters but the result gives errors galore.

&lt;%
Function CreateLink()
Set Application("Serv" = Server.CreateObject("IRCXpro.Services"
Application("Serv".LogonSettings "localhost", 7100, "admin", "password"
End Function%&gt;
&lt;html&gt;
&lt;P&gt;There are &lt;%=Application("Serv".VisibleCount%&gt; users online&lt;br&gt;
&lt;/html&gt;

Edited by - bcordasc on 06 Apr 2006 09:42:04
Replied 06 Apr 2006 14:50:58
06 Apr 2006 14:50:58 Roddy Dairion replied:
If you cud explain what you're trying to do with this then may b i could explain how to do it in php. <img src=../images/dmxzone/forum/icon_smile_big.gif border=0 align=middle>
Replied 06 Apr 2006 19:48:40
06 Apr 2006 19:48:40 Ben Cordasco replied:
Well, the short story is that if I put the .asp version on my server it will tell me how many people are on the IRCx server program that I'm running.

The problem is that I want to display this information on my web site which is currently in .php.
Replied 07 Apr 2006 12:41:34
07 Apr 2006 12:41:34 Roddy Dairion replied:
You can count the number of user present online but for the number of user present in on your irc server thats another story. For php you need an ircg extension.
Simplest way to count number of user present on your irc server is to set a session and count the number of session

session_start();

/**
* Calculate the number of users online by
* counting the number of session files. Returns the
* number of users on success, or -1 on failure.
*/
function getUsersOnline() {
$count = 0;

$handle = opendir(session_save_path());
if ($handle == false) return -1;

while (($file = readdir($handle)) != false) {
if (ereg("^sess", $file)) $count++;
}
closedir($handle);

return $count;
}

echo "users online = " . getUsersOnline();

assuming that you have the ircg extension then check this documentation www.php.net/manual/en/function.ircg-list.php
Replied 07 Apr 2006 23:28:18
07 Apr 2006 23:28:18 Ben Cordasco replied:
Cool! I didn't know such a command existed with php. I think this will accomplish what I need. <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>
Replied 08 Apr 2006 00:01:23
08 Apr 2006 00:01:23 Ben Cordasco replied:
Hmmm.

It seems that php has given this extension away to some other company? Just my luck.

The new company seems to have the extension for download but the installation documention is pretty lacking. I'm not even sure it's the same thing?

Reply to this topic