NameSilo

Using PHP within Javascript

Namecheap AuctionsNamecheap Auctions
SpaceshipSpaceship
Spacemail by SpaceshipSpacemail by Spaceship
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
•••
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
•••
Thanks for your help powerspike :hehe:
 
0
•••
DomainEasy: flexible LTO options. Close more domain deals with financing.

We're social

Escrow.com
Spaceship
Escrowly
CryptoExchange.com
Domain Recover

NamePros updates

New in Parking: updated way to act on many domains or inquiries at once
Your domain list and inquiry list now have a bar above and below the list. Check the items you want, then choose an action in the bar...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back