PHP - Methods For Session Sharing Across Different Domains On The Same Server?
I'm looking for a secure way to share session data across two different domains (not subdomains) on the same server.
I've looked at passing the session id through a GET var to the other domain. It works but it looks to open the possibility of session hijacking and I don't really like having the session id in the URL string. Any way to make this secure? The other option I'm looking at is using cURL to load a script on the other domain that sets a cookie with the session id. When the person loads the other domain, check for the cookie, get the session id, connect to session then delete the cookie. Can anyone see anything wrong with this? Thanks. Similar TutorialsI have recently changed server and setting things up are a right pain, after 2 days im need of some help. I have my site split into sub domains so lets say; www.domain.com one.domain.com two.domain.com three.domain.com They are to separate parts of my site which used to make it easier the manage each part, so one sub domain handles accounts and logins etc.. whilst another handles products and so on. the problem im having is all my login scripts and are on say 'one.domain.com', i can log in fine but when i visit any other domain im logged out, i can't seem to sort it out. i have tried setting my session cookie path and session cookie domain by painstakingly adding Code: [Select] ini_set('session.save_path', '/var/www/vhosts/website.co.uk/httpdocs/tmp'); ini_set('session.cookie_domain', '.website.co.uk'); to every page, but it makes no difference, im also getting the occasional error Code: [Select] Warning: session_start() [function.session-start]: open(/tmp/sess_d387ha6eqvj53f135q0fh4d733, O_RDWR) failed: Permission denied I have contacted my server provider by after endless messages they are no longer helping but rather keep saying 'leave it with us' then 'we fixed it' although they didnt. It doesn't help im so limited in what i have access to, i cant access the php.ini so everything has to be done via php So i would really appreciate any help getting this session problem sorted out. Thank you. Suppose I have two versions of the same website; one American and one Canadian. This site has members with profiles etc. The way my site is written, I think that if someone were to login to their account on, say, the American site, then a session variable would indicate that a user is logged in on the client machine. Now if they visit the "profile" page, for example, or some other members-only page ON THE CANADIAN SITE, and start manipulating data etc., then this would affect the databases for the Canadian site, and everything would get screwed up (actually, I think mysql would just start spitting out errors, but that's not good either). Does anyone have some simple way to deal this this kind of thing? I don't really know exactly how session variables work. Say I have two domains, somepage.com and somepage.ca on the same server/DNS. If a page on somepage.com sets a session variable called $_SESSION['somevar'], and a page on somepage.ca also sets a variable called $_SESSION['somevar'], are the two variables somehow distinct because they are on different domains? Like, if somepage.com sets the variable, then somepage.ca check if the variable is set, what will happen? What if I wanted to set up the two pages in subfolders, like somepage.com/us and somepage.com/ca, how would I deal with distinguish session variables for the two sites? Is one approach (i.e. distinct domains vs subfolders) better than the other? Thanks, Good Day, I'm using the following example script from http://php.net/manual/en/function.session-set-save-handler.php which I have placed in session-handler.php and is included at the top of my index.php file. I have multiple domain names for the same website, so naturally when a person logs into the site, I would like the session to be active across all the domains instead of them having to login again if say they go from mysite.com to mysite2.com. session-handler.php <?php function open($save_path, $session_name) { global $sess_save_path; $sess_save_path = $save_path; return(true); } function close() { return(true); } function read($id) { global $sess_save_path; $sess_file = "$sess_save_path/sess_$id"; return (string) @file_get_contents($sess_file); } function write($id, $sess_data) { global $sess_save_path; $sess_file = "$sess_save_path/sess_$id"; if ($fp = @fopen($sess_file, "w")) { $return = fwrite($fp, $sess_data); fclose($fp); return $return; } else { return(false); } } function destroy($id) { global $sess_save_path; $sess_file = "$sess_save_path/sess_$id"; return(@unlink($sess_file)); } function gc($maxlifetime) { global $sess_save_path; foreach (glob("$sess_save_path/sess_*") as $filename) { if (filemtime($filename) + $maxlifetime < time()) { @unlink($filename); } } return true; } session_set_save_handler("open", "close", "read", "write", "destroy", "gc"); session_start(); ?> The script above doesn't appear to be throwing any errors, and I can login like normal but it doesn't seem to be saving the sessions at all. So I still have to login to each separate domain. Any ideas? Thanks, Ace hi guys i need a script i can use on a website that redirect all domains to a specific URL+domain
so here is the goal to achieve:
i want to redirect DOMAIN1.com DOMAIN2.org DOMAIN3.com .... to my main domain MyredirectDomainurl.com and on MyredirectDomainurl.com i need to run a script that will FORWARD DOMAIN1.com ===> https://www.afternic.com/domain/DOMAIN1.COM DOMAIN2.ORG ===> https://www.afternic.com/domain/DOMAIN2.ORG DOMAIN3.com ===> https://www.afternic.com/domain/DOMAIN3.com
thanks for your help Hal
Edited January 1 by kahymo typo I have a website uploaded onto Host Gator hosting and the sessions are carried over to the other pages ok. When using the same website in XAMPP it does not carry over the session to the next page and need to login again. If i log in it puts the following after the URL - ?sid=3b71942d410d84c45f9f4433561c325a The when i go to another link it loses the sid and i'll need to manualy past it into the next URL to get it working unless i log in again on the new page. This is only happening with XAMPP but working fine in the Host Gator hosting environment. Please help! My login is integrated with the phpbb3 login. This is the code at the beginning of every page - Code: [Select] <?php ob_start(); define('IN_PHPBB', true); $phpbb_root_path = './phpbb3/'; $phpEx = substr(strrchr(__FILE__, '.'), 1); include($phpbb_root_path . 'common.' . $phpEx); // Start session management $user->session_begin(); $auth->acl($user->data); $user->setup(); ?> Hi all, I have the following code to check whether the client has javascript enabled in their browser: page.php: Code: [Select] <?php session_start(); if(isset($_SESSION['gocheck'])) {$gocheck = $_SESSION['gocheck'];} else {$gocheck = 'no';} //echo $gocheck; if($gocheck=='no'){header ("Location: ./gocheck.php"); exit;} //----Execution only reaches this line if gocheck.php has been run and Javascript is enabled.-------- unset($_SESSION['gocheck']); //rest of page ?> gocheck.php: Code: [Select] <?php session_start(); $_SESSION['gocheck'] = 'yes'; echo" <!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"> <html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\"> <head> <script type=\"text/javascript\" language=\"JavaScript\"> window.location.replace('page.php'); </script> </head> <body> This website requires Javascript to be enabled in your browser. <br /> Please enable Javascript and try again. </body> </html> "; ?> So what should happen is the user is always redirected from page.php to gocheck.php, which sets the session variable $gocheck to 'yes' and directs back to page.php via Javascript. Because $gocheck is then equal to 'yes', page.php shouldn't direct back again tio gocheck.php. This worked fine on my PC (using WAMP), but when I upload the files to the webhost, it seems to get stuck in an infinite redirect loop between page.php and gocheck.php. Also, if I echo $gocheck in page.php, it returns 'no', so it seems as if for some reason the session variable $gocheck is not being set properly by gocheck.php. Could somebody please shed some light on this? Is there an error in my code? Is there something I need to change in php.ini on the webhost's server? Thanks! P.S. WAMP on my PC uses PHP v.5.3.0, but the webhost uses PHP v.5.2.12 - don't think this can be the problem though. I need to know if this is even possible. I have found conflicting information on this online. Anyway, here is what I want to do. I have two websites that reside on the same dedicated server. Both have different IP's. www.mywebsite1.com and www.mywebsite2.com. I need a user that logs in at www.mywebsite1.com to be able to pass the $_SESSION from www.mywebsite1.com to www.mywebsite2.com. Any help on this would be cool. Thanks in advance. Ryan
I am trying to install a script on my OpenSuse Webserver, and I managed to resolve most of the errors except of one: The value for session.save_path (/tmp) is not writable for the web server. Make sure that PHP can actually save session variables.
That seems to be the problem.
session.save_path: writeable You need set permission for your var directory.
well - i guess that the default ownership may be incorrect on the session folder: Example; php on some Linux-Server defaults to apache user. If using nginx or other need to switch the folder ownership. Also as a note you have to change the user/group setting in www.conf.
chown -R root:nginx /var/lib/php/7.0/ sed -i 's/apache/nginx/g' /etc/php-fpm-7.0.d/www.conf service php-fpm-7.0 restart
But wait: what about the security - is it save to make the session.save_path writeable!? my server-admin says that this is a big big hole and makes the server unsecure. love to hear from you yours dil_bert by the way: years ago i have had this issue on the server. but the question is - is this a securitiy risk!? I need to know this. Look forward to hear from you Edited March 21, 2020 by dil_bertWell the title may seem a bit confusing, but heres an example: Code: [Select] <?php class User{ public $uid; public $username; protected $password; protected $email; public $usergroup; public $profile; public function __construct($id){ // constructor code inside } public function getemail(){ return $this->email; } public function getusergroup(){ return $this->usergroup; } public function getprofile(){ $this->profile = new UserProfile($this->uid); } } class UserProfile(){ protected $avatar; protected $bio; protected $gender; protected $favcolor; public function __construct($id){ // constructor code inside } public function formatavatar(){ // avatar formatting code inside } public function formatusername(){ // format username? } } ?> As you can see, the User class(an outer class) has a property called Profile, which can be instantiated as a UserProfile object(an inner class). The two objects have distinct functionalities, but there are times when the UserProfile object needs to access property and methods from the user object. I know its easy for outer class to access methods from inner class by using the single arrow access operator twice, but how about the other way around? Lets say from the above example the userprofile can format the username displayed to the screen by adding a sun to the left of the username if the usergroup is admin, a moon if the usergroup is mod, and nothing if its just a member. The usergroup property is stored in the outer class, and can be accessed with this $user->getusergroup() method only. I know I can always do the hard way by passing a user object to the method's argument, but is there an easier way for the inner class UserProfile to access properties/methods for outerclass User? If so, how can I achieve that? I'm running a site where people can post confessions, there's an option to share confession to twitter but it doesn't work properly.
When you click on twitter icon there is a window opening, you need to log in to twitter and then you have your tweet you want to share which looks like this:
Confessions.ie - Irish Anonymous Confessions Confession: I did it! http://www.confessio...e.php?page=view
problem is that url, "http://www.confessio...e.php?page=view" - it doesn't correspond to actual post, then when clicked it shows "-1" and that's it.
normal post url's would be something like this:
http://www.confessio...w&confession=18
http://www.confessio...w&confession=15
http://www.confessio...w&confession=12
Website is: confessions dot ie
and here's the code that I think contains error somewhe
<?php $confId = $_GET['confession']; $viewIp = $_SERVER['REMOTE_ADDR']; // Get the Full Page URL $pageURL = (isset($_SERVER['HTTPS']) ? "https" : "http")."//".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; $count = 0; $hasViewed = ''; $msgBox = ''; // Get the File Uploads Folder from the Site Settings $uploadsDir = $set['uploadPath']; // Check if Moderation is On $moderated = $set['moderation']; // Check if Profanity Filter is On $filterProfanity = $set['useFilter']; $chkViews = mysqli_query($mysqli,"SELECT 'X' FROM views WHERE confessId = ".$confId." AND viewIp = '".$viewIp."' LIMIT 1"); $hasView = mysqli_num_rows($chkViews); if ($hasView == 0) { $hasViewed = '0'; } $viewDate = date("Y-m-d H:i:s"); if ($hasViewed == '0') { $stmt = $mysqli->prepare(" INSERT INTO views( confessId, viewIp, viewDate ) VALUES ( ?, ?, ? ) "); $stmt->bind_param('sss', $confId, $viewIp, $viewDate ); $stmt->execute(); } // Add New Comment if (isset($_POST['submit']) && $_POST['submit'] == 'addComment') { // Validation if($_POST['commentText'] == "") { $msgBox = alertBox($commentsReq, "<i class='fa fa-times-circle'></i>", "danger"); } else if($_POST['answer'] == "") { $msgBox = alertBox($captchaCodeReq, "<i class='fa fa-times-circle'></i>", "danger"); } else if ($_POST['hole'] != '') { $msgBox = alertBox($commentsErrorMsg, "<i class='fa fa-times-circle'></i>", "danger"); $_POST['firstName'] = $_POST['commentText'] = $_POST['answer'] = ''; } else { $commentText = htmlentities($_POST['commentText']); $usersId = $mysqli->real_escape_string($_POST['usersId']); if ($_POST['firstName'] == '') { $firstName = null; } else { $firstName = $mysqli->real_escape_string($_POST['firstName']); } $commentDate = date("Y-m-d H:i:s"); // Moderation Check if ($moderated == '1') { $isActive = '0'; } else { $isActive = '1'; } // Check if the poster is a logged in user if (isset($_SESSION['userId'])) { $user = $_SESSION['userId']; } else { $user = '0'; } if(strtolower($_POST['answer']) == $_SESSION['thecode']) { $stmt = $mysqli->prepare(" INSERT INTO comments( confessId, userId, firstName, comments, commentDate, isActive, commentIp ) VALUES ( ?, ?, ?, ?, ?, ?, ? ) "); $stmt->bind_param('sssssss', $confId, $user, $firstName, $commentText, $commentDate, $isActive, $viewIp ); $stmt->execute(); if ($moderated == '1') { $msgBox = alertBox($commentsSavedMsg1, "<i class='fa fa-check-square'></i>", "success"); } else { $msgBox = alertBox($commentsSavedMsg2, "<i class='fa fa-check-square'></i>", "success"); } // Clear the Form of values $_POST['firstName'] = $_POST['commentText'] = $_POST['answer'] = ''; $stmt->close(); } else { $msgBox = alertBox($captchaErrorMsg, "<i class='fa fa-warning'></i>", "warning"); } // If the confession is posted by a user if ($usersId != '0') { $uemail = "SELECT userEmail, recEmails FROM users WHERE userId = ".$usersId; $remail = mysqli_query($mysqli, $uemail) or die('-1' . mysqli_error()); $e = mysqli_fetch_assoc($remail); $userEmail = $e['userEmail']; $recEmails = $e['recEmails']; // If the users has opted in to receive notifications if ($recEmails == '1') { // Send out the email in HTML $installUrl = $set['installUrl']; $siteName = $set['siteName']; $siteEmail = $set['siteEmail']; $subject = $newCommentEmailSubject; $message = '<html><body>'; $message .= '<h3>'.$subject.'</h3>'; $message .= '<hr>'; $message .= '<p>'.nl2br($commentText).'</p>'; $message .= '<hr>'; $message .= '<p>'.$newCommentEmail1.' '.$pageURL.'</p>'; $message .= '<p>'.$subscribeEmail3.'<br>'.$siteName.'</p>'; $message .= '</body></html>'; $headers = "From: ".$siteName." <".$siteEmail.">\r\n"; $headers .= "Reply-To: ".$siteEmail."\r\n"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n"; mail($userEmail, $subject, $message, $headers); } } } } // Get Confession $select = "SELECT confessId, userId, (IFNULL(firstName, '')) AS firstName, confessText, DATE_FORMAT(postDate,'%b %d %Y %h:%i %p') AS postDate, hasImage, isActive, (SELECT COUNT(*) FROM views WHERE views.confessId = confessions.confessId ) as totalViews, (SELECT COUNT(*) FROM likes WHERE likes.confessId = confessions.confessId ) as totalLikes, (SELECT COUNT(*) FROM dislikes WHERE dislikes.confessId = confessions.confessId ) as totalDislikes FROM confessions WHERE confessId = ".$confId; $res = mysqli_query($mysqli, $select) or die('-1' . mysqli_error()); $row = mysqli_fetch_assoc($res); if ($row['totalViews'] == '1') { $viewText = $singleViewText; } else { $viewText = $multipleViewsText; } $shareURL = $set['installUrl'].'page.php?page=view&confession='.$row['confessId']; $googleURL = $set['installUrl']; // Get Comments $qry = "SELECT commentId, confessId, (IFNULL(firstName, '')) AS fName, comments, DATE_FORMAT(commentDate,'%b %d %Y %h:%i %p') AS commentDate, isActive FROM comments WHERE confessId = ".$confId." AND isActive = 1 ORDER BY commentId DESC"; $results = mysqli_query($mysqli, $qry) or die('-2'.mysqli_error()); include('includes/header.php'); ?> <section id="main-container"> <div class="container"> <?php if ($msgBox) { echo $msgBox; } ?> <div class="confessbox"> <div class="confession"> <?php if ($row['hasImage'] == '1') { // Get Image $sqlStmt = "SELECT uploadId, confessId, uploadUrl FROM uploads WHERE confessId = ".$confId; $sqlres = mysqli_query($mysqli, $sqlStmt) or die('-2'.mysqli_error()); $col = mysqli_fetch_assoc($sqlres); //Get File Extension $ext = substr(strrchr($col['uploadUrl'],'.'), 1); $imgExts = array('gif', 'GIF', 'jpg', 'JPG', 'jpeg', 'JPEG', 'png', 'PNG', 'tiff', 'TIFF', 'tif', 'TIF', 'bmp', 'BMP'); if (in_array($ext, $imgExts)) { echo '<p class="mb-20"><img alt="'.$confImageAlt.'" src="'.$uploadsDir.$col['uploadUrl'].'" class="img-responsive" /></p>'; } } ?> <p> <i class="fa fa-quote-left"></i> <?php if ($filterProfanity == '1') { echo nl2br(clean(filterwords($row['confessText']))); } else { echo nl2br(clean($row['confessText'])); } ?> <i class="fa fa-quote-right"></i> </p> <input type="hidden" id="confessId" name="confessId_<?php echo $count; ?>" value="<?php echo $row['confessId']; ?>" /> <div class="confession-footer"> <div class="likes"> <span class="label label-confess first liked"> <a href="" id="likeIt<?php echo $row['confessId']; ?>" class="likeIt_<?php echo $count; ?> text-success"> <i class="fa fa-smile-o"></i> <span id="likesVal_<?php echo $count; ?>"><?php echo $row['totalLikes']; ?></span> </a> </span> </div> <div class="dislikes"> <span class="label label-confess disliked"> <a href="" id="dislikeIt<?php echo $row['confessId']; ?>" class="dislike_<?php echo $count; ?> text-danger"> <span id="dislikesVal_<?php echo $count; ?>"><?php echo $row['totalDislikes']; ?></span> <i class="fa fa-frown-o"></i> </a> </span> </div> <span class="label label-confess"><?php echo timeago($row['postDate']); ?></span> <span class="label label-confess last"><?php echo $row['totalViews'].' '.$viewText; ?></span> <a href="https://twitter.com/intent/tweet?text=<?php echo $set['siteName']; ?>%20Confession:%20<?php echo ellipsis($row['confessText'],65); ?>%20&url=<?php echo $shareURL; ?>" class="btn btn-tw btn-sm" target="_blank" data-toggle="tooltip" data-placement="top" title="<?php echo $twitterShareTooltip; ?>"> <i class="fa fa-twitter"></i> </a> <a href="https://plus.google.com/share?url=<?php echo $googleURL; ?>" class="btn btn-gp btn-sm" target="_blank" data-toggle="tooltip" data-placement="top" title="<?php echo $googleShareTooltip; ?>"> <i class="fa fa-google-plus"></i> </a> <span class="label label-confess last hasVoted text-danger"><strong><?php echo $onlyVoteOnceText; ?></strong></span> <div class="comments"> <?php if ($row['firstName'] != '') { ?> <span class="label label-confess last"><?php echo $postedByText.' '.clean($row['firstName']); ?></span> <?php } else { ?> <span class="label label-confess last"><?php echo $postedByAnon; ?></span> <?php } ?> </div> </div> <div class="clearfix"></div> </div> </div> <?php if(mysqli_num_rows($results) > 0) { ?> <hr /> <div class="commentbox"> <?php while ($rows = mysqli_fetch_assoc($results)) { ?> <div class="comment"> <p> <?php if ($filterProfanity == '1') { echo nl2br(clean(filterwords($rows['comments']))); } else { echo nl2br(clean($rows['comments'])); } ?> </p> <?php if ($rows['fName'] != '') { ?> <span class="label label-comments"><?php echo clean($rows['fName']).' '.$commentedText.' '.timeago($rows['commentDate']); ?></span> <?php } else { ?> <span class="label label-comments"><?php echo $anonCommented.' '.timeago($rows['commentDate']); ?></span> <?php } ?> </div> <?php } ?> </div> <?php } ?> <hr /> <form action="" method="post" class="comment-form mt-30"> <div class="form-group"> <textarea class="form-control" name="commentText" id="commentText" rows="4" required="" placeholder="<?php echo $addCommentsField; ?>"><?php echo isset($_POST['commentText']) ? $_POST['commentText'] : ''; ?></textarea> </div> <div class="row"> <div class="col-md-4"> <div class="form-group"> <input type="text" class="form-control" name="firstName" placeholder="<?php echo $firstNamePlaceholder; ?>" value="<?php echo isset($_POST['firstName']) ? $_POST['firstName'] : ''; ?>"> </div> </div> <div class="col-md-4"></div> <div class="col-md-4"> <div class="row"> <div class="col-md-4"> <img src="includes/captcha.php" id="captcha" data-toggle="tooltip" data-placement="left" class="pull-right" title="<?php echo $captchaCodeTooltip; ?>" /> </div> <div class="col-md-8"> <div class="form-group"> <input type="text" class="form-control" name="answer" required="" maxlength="6" placeholder="<?php echo $captchaCodeTooltip; ?>"> </div> </div> </div> </div> </div> <div class="row"> <div class="col-md-8"> <p><?php echo $commentsQuip1; ?><strong><?php echo $isOn; ?></strong>. <?php echo $commentsQuip2; ?> <strong><?php echo $filtered; ?></strong>.</p> </div> <div class="col-md-4"> <input type="hidden" name="hole" id="hole" /> <input type="hidden" name="usersId" value="<?php echo $row['userId']; ?>" /> <button type="input" name="submit" value="addComment" class="btn btn-fessup btn-lg pull-right btn-icon"><i class="fa fa-check-square-o"></i> <?php echo $saveCommentsBtn; ?></button> </div> </div> </form> </div> </section> during lesson time we're developing php systems and our topic is virtual storage like dropbox, google drive etc. My teacher has now set the task to enable the ability to share files within the server but also restrict access within the server folder. I'm being taught MySQL however I've read a lot about PDO being better and decided to use this method to try and get a higher grade for my project although I'm having difficulty understanding how to go about it what i want to achieve is:
creating file sharing capability (i.e. students can share group projects)
restricting users (only those working on a particular document can view it)
don't worry this is not for my own benefit I'm just trying to get a grade here, I mainly just want advice on what I need I've read quite a bit but unfortunately I'm more of a visual learner.
Hello. I want to make a simple website, where I can upload a zip file and download it from a URL with just HTTP GET request. When I download the file, the file will then be deleted on the server. Can't find any examples. Maybe, I've searched wrong. Has somebody some written project links or some tips for me how can I achieve this?
Sorry, but I forget how to do this, mostly because I don't do it often. To keep things simple lets say I have 3 classes: Main, A, B class Main{ public $classA, $classB; public $shared; public function init(){ // Do some stuff return $this; } } class A{ public function aMethod(){ $me = $this->shared; // Same value as from B::bMethod() // Do some stuff return $this; } } class B{ public function bMethod(){ $me = $this->shared; // Same value as from A::aMethod() // Do some stuff return $this; } } $main = new Main(); $main->classA->aMethod(); $main->classB->bMethod(); I really want to be able to call the main class, then tell it what subclass to use and be able to use $this->shared in any class and it will be the same. If changed in any class the other classes should see the change as well. Does that make sense? Hi. How to implement twitter like real-time sharing system? So that is like, if my friend(following person) write a message, it also appear on my wall(page). 1. Is it hard? 2. What language used for it? PHP? 3. Is there any source about it? Thanks. This could be a silly question and it may not be very relevant here, forgive me if that is the case. When you have a domain like http://example.com and you then have a sub domain like http://something.example.com how is that achieved? Is it to do with the way the site is coded or structured? Hello all, it's been a while! Good to be back. I am having trouble with a script I'm trying to modify to seach for domains with specific extensions. Now, I have never done any domain checking before and I'm a little bewildered. The script uses an array and checks the input against each extension using the array. Each line looks similar to: Code: [Select] '.com' => array('whois.crsnic.net','No match for'), What does the whois.crsnic.net mean? I assume it's a register/database of domains? Hey All, What I am trying to do is link a whole bunch of our sites together to be seamless when users are on them, even though they are actually on different servers. For example, we have portal.ourdomain.com which runs our billing software, www.ourdomain.com which is our regular website, cp.ourdomain.com which is our control panel and mail.ourdomain.com which is our webmail login. We have a common header, which needs the session variables and such from the portal site. So we created a separate header file (on the portal site) that could be used by the other sites to read in. Now the separate file works by going to it directly portal.ourdomain.com/commonheader.php, however when included on the external pages, it doesn't get the number of items in the cart or the logged in state. I assume that this probably has to do with the sessions, but my question is, is there a way to process the file before it is included. I was hoping that it could read the file output, rather than generate it within the external site. Let me know if any one of you know of any ways to do what I am trying. If I am confusing you, just let me know what needs clarification. Thanks. Hello Everyone! I'm new to the forum and new to PHP. I'm curious about the limitations of PHP. I'm working a project that I'm not even sure is possible in PHP. The project is simple: I need a page that can track business reviews on external sites and report that activity to a database. Below is a simple mockup of the html. Code: [Select] <html> <head> <title>Boomerang Project</title> </head> <body> <h1>Like Our Work?</h1> <h2>Help Spread The Word.</h2> <p>Click on the links below to start writing a review about the service that we have provided you.</p> <h3>Complete 5 reviews recieve a gift certificate.</h3> <ul> <li><a href="" target="_blank">Yahoo</a></a></li> <li><a href="" target="_blank">Google</a></li> <li><a href="" target="_blank">Yelp</a></li> <li><a href="" target="_blank">Manta</a></li> <p>You have completed <!--Number-of-Reviews-Completed-->. <br /> <br /> <!--The form below doesn't appear until at least 5 reviews are confirmed to have been posted. At which point a script will reconfirm the postings and send 2 emails, one to business with client info and another email to client confirming the completion of the postings.--> <form> <fieldset> <label for="name">Name</label><input type="text" name="full-name" /><br /> <label for="address">Address</label><input type="text" name="address" /><br /> <label for="city">City</label><input type="text" name="city" /><br /> <label for="state">State</label><input type="text" name="state" /><br /> <label for="zipcode">Zip Code</label><input type="text" name="zipcode" /><br /> <label for="telephone">Telephone</label><input type="text" name="telephone" /><br /> <label for="email">Email</label><input type="text" name="emaile" /><br /> <input type="submit" /> </fieldset> </form> </body> </html> how would i go about doing this? lets say i want to use different domains i.e.: mysite.com mycoolsite.com but i want them to both use the same php script i.e.: myscript.com/site.php?domain=mysite.com each site will show different content depending on the domain $_GET variable... can anyone help me with this? Hello
I'm new in PHP but I need a help If it possible.
I want to Know which domain used my php script .
For example when some one run installer or run index.php an email send to me that contain the domain name.
Or some thing like this that I used for any php code.
so thanks
|