NameSilo

Using PHP within Javascript

SpaceshipSpaceship
SpaceshipSpaceship
SpaceshipSpaceship
Watch

noswad

Established Member
Impact
1
Hi.

Is it possible to use PHP sessions within Javascript?

This is my code:

The PHP session would create a unique link ID.

PHP:
<script type="text/javascript" language="javascript" src="http://www.tkqlhce.com/placeholder-305771?SID=<?php session_start(); echo $_SESSION[user_name]; ?>&target=_top&text=%3Clink%3EClick+here+to+Join%3C%2Flink%3E&mouseover=N"></script>

Thanks for reading.
 
Last edited:
0
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
not directly, PHP is serverside, JS is client side. so all the output would be in the html/js code when it got the client.

but on the serverside you can mix the 2, but would suggest spliting the php code from the output (makes it easier in the long run. something like ..
PHP:
<?
session_start();
$sid = $_SESSION[user_name]; 
?>
<script type="text/javascript" language="javascript" src="http://www.tkqlhce.com/placeholder-305771?SID=<?=$sid?>&target=_top&text=%3Clink%3EClick+here+to+Join%3C%2Flink%3E&mouseover=N"></script>

noswad said:
Hi.

Is it possible to use PHP sessions within Javascript?

This is my code:

The PHP session would create a unique link ID.

PHP:
<script type="text/javascript" language="javascript" src="http://www.tkqlhce.com/placeholder-305771?SID=<?php session_start(); echo $_SESSION[user_name]; ?>&target=_top&text=%3Clink%3EClick+here+to+Join%3C%2Flink%3E&mouseover=N"></script>

Thanks for reading.
 
0
Close
Thanks for your help powerspike :hehe:
 
0
Close
Appraise.net

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

Switch between accounts
You can now stay logged in to more than one NamePros account in the same browser. Click your avatar, then "Accounts in this browser", to...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back