Results 1 to 5 of 5

Thread: some code help

  1. #1
    Join Date
    Jul 2003

    some code help

    i want to make a script that does the following

    some one puts a code in there pages like this

    <SCRIPT language="JavaScript" src=""></SCRIPT>

    which would load a java script with that userid inside it
    like ('','_blank','top=1,left=1,width=550,height=300,buttons=1,scrollbars=1,location=1,menubar=1,resizable=1,status=1,directories=1,tool bar=1'),win2.blur(),window.focus();

    so the php script will echo out the java script and add userid inside it

    any one knows how to do this ?

    the end reselt the user with this code
    <SCRIPT language="JavaScript" src=""></SCRIPT>
    in there page will be converted to
    <SCRIPT language="JavaScript" src="my java script inside the script.php with userid inside it"></SCRIPT>
    most important that the userid changes for each member

  2. #2
    Join Date
    Aug 2002
    That's kind of an off approach.

    What you want to do is define your page with a link that 'onclick' calls your window open script.

    you can't do this with javascript alone. You'll need a technology like PHP.

    1. Build an HTML page and replace userid with %USERID% - ni our example it will be template.htm

    2. Build a PHP page that has available the user's id, in a SESSION variable, or POST - anything you like. If it were stored in a SESSION array it would look like this:

    session_name( 'somename' );
    $fp = str_replace( '%USERID%', $_SESSION['userid'], implode( '', file( 'template.html' ) );
    echo $fp;
    this way, the php file reads the unparsed template, replaces %USERID% with the actual user id, and then echoes the result.

    circlical - hosting software development
    forums * blog

  3. #3
    Join Date
    Jul 2003
    how would the php script know what is userid is ?
    this code will change like
    <SCRIPT language="JavaScript" src=""></SCRIPT>

    <SCRIPT language="JavaScript" src=""></SCRIPT>

    the php script must think the and then use it in the templete.html

  4. #4
    Join Date
    Jul 2003
    up up up and away

  5. #5
    Join Date
    Jul 2003
    any one home ?
    is there any other site which has more programers ?
    its a simple idear
    a code in one page that calls a php script
    <SCRIPT language="JavaScript" src=""></SCRIPT>

    and this php script in turn gets the userid from the code "id=" and then prints a java code with that same userid

    like (' id=userid','_blank','top=1,left=1,width=550,height=300'),win2

    and because the php script was called between <script> and </script> it will be like the original code was

    <SCRIPT language="JavaScript"> (' id=userid','_blank','top=1,left=1,width=550,height=300'),win2

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts