PHP - Sessions Between Websites I Own On Same Server.
Code: [Select]
if($login_count == 1) { while ($row = mysql_fetch_array($login_sql, MYSQL_ASSOC)) { $_SESSION['MembersID'] = $row['members_id']; session_register('MembersID'); }} this works fine and logs me in on my website with the script and displays the correct id with: Code: [Select] if(isset($_SESSION['MembersID'])){ $session_id = $_SESSION['MembersID']; echo'<li><a href="https://members.selmgec.co.uk/">Welcome, '.$session_id.'</a></li>'; } but how can i pass it onto another website i own, using the same database connection. Similar TutorialsI 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 Hi I operate (example) www.joebloggs.com which is using PHP sessions to handle Logins, etc etc. I also operate a separate site at www.joebloggs.com/NewSite which is entirely seperate from the site at www.joebloggs.com, even though there operating on the same Domain and Server. My problem is, when a user logs out of www.joebloggs.com (Using session_destroy), it also destroys any session information associated with www.joebloggs.com/NewSite. Is there any way to prevent this happening or am I going to have to rethink how I handle my sessions? Scouring the internet (Ive quoted below) I think somebody mentioned using session_name() but I fail to see how it would be implemented? Quote To avoid problems with sessions you should use the session_name('myapplication') [ session_name({UNIQUE_APP_ID}) ]. The problem you are mentioning can occur in more simple situations where there is an administration panel and a sign-in form for the users of the web site. If session_name is not used a signed-in user could have access to the admin. panel but this depends on the auth. scheme and mechanism you have implemented. I have a PHP web system that store in a windows server. In the system, there is a function for user to upload files to another server (Shared server in Unix). When i try to upload a file, it gives warning: Warning: move_uploaded_file(\\unixserver/sharedfolder/upload/test.txt) [function.move-uploaded-file]: failed to open stream: Permission denied in C:\wamp\www\upload\index.php on line 40 For your information, my username has been assigned in xxx's group that has access to read and write on that folder. Besides, i'm able to open,create and delete files on that folder's server manually (samba). The safe mode setting is off. Does anybody has any idea why this thing happen? I'm trying to make a simple website where people register to my website. When the user doesn't fill anything inside the boxes they get a message "Please fill all required fields" on the register.php page On my local host require_once works good. It shows up.
But when i upload the files to my sever the require_once does not show up on the register.php It just refreshes and i dont get the message "Please fill all required fields"
This is the code that works in local host but not in a live server <?php require_once 'messages.php'; ?>
Here is my full code
Register page: <html> <?php require_once 'messages.php'; ?> <br><br> <form action="register-clicked.php" method="POST"> Username:<br> <input type="text" name="usernamebox" placeholder="Enter Username Here"> <br><br> Email:<br> <input type="text" name="emailbox" placeholder="Enter email here"> <br><br> Password:<br> <input type="password" name="passwordbox" placeholder="Enter password here"> <br><br> Confirm Password:<br> <input type="password" name="passwordconfirmbox" placeholder="Re-enter password here"> <br><br> <input type="submit" name="submitbox" value="Press to submit"> <br><br> </form> </html>
Register clicked <?php session_start(); $data = $_POST; if( empty($data['usernamebox']) || empty($data['emailbox']) || empty($data['passwordbox']) || empty($data['passwordconfirmbox'])) { $_SESSION['messages'][] = 'Please fill all required fields'; header('Location: register.php'); exit; } if ($data['passwordbox'] !== $data['passwordconfirmbox']) { $_SESSION['messages'][] = 'Passwords do not match'; header('Location: register.php'); exit; } $dsn = 'mysql:dbname=mydatabase;host=localhost'; $dbUser='myuser'; $dbPassword= 'password'; try{ $connection = new PDO($dsn, $dbUser, $dbPassword); } catch (PDOException $exception){ $_SESSION['messages'][] = 'Connection failed: ' . $exception->getMessage(); header('Location: register.php'); exit; }
messages.php <?php session_start(); if (empty($_SESSION['messages'])){ return; } $messages = $_SESSION['messages']; unset($_SESSION['messages']); ?> <ul> <?php foreach ($messages as $message): ?> <li><?php echo $message; ?></li> <?php endforeach; ?> </ul> Edited Wednesday at 12:49 AM by bee65 Hi, I am not a PHP programmer. I took on a new client with a simple PHP site, without any databases. The site is up and running on the web. I would like to get it running on my local machine for further development. I have latest version of WAMP installed, running Apache version 2.2.11 and PHP version 5.3.0 I created a directory in the WAMP "www" project directory and it shows up there like it's supposed to when I browse to "localhost" Problem: The home page of website displays text but no, images, styles, footer, header, nav links, etc. Here is the code for the home page: <? define("NAV","home"); require_once('local/local.php'); ?> <!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"> <head> <title>TITLE</title> <meta name="keywords" content=""> <meta name="Description" content=""> <? include("common/dochead.php"); ?> </head> <body onLoad="<? include('common/preloads.php'); ?>"> <!-- ============================ main ============================= --> <div id="main-frame"><div id="main" class="noCollapse"> <? include("common/sign.php"); ?> <div id="right-frame"> <? include("common/navigation.php"); ?> <div id="content-frame"> <div id="content"> <h1>Welcome</h1> <p>This is the content area. This is the content area. This is the content area. </p> </div><!-- end content --> </div><!-- end content-frame --> </div><!-- end right-frame --> <div class="clearFloats"></div> </div><!-- end main --></div><!-- end main-frame --> <? include("common/footer.php"); ?> </body> </html> Any help would be greatly appreciated. I have spent many hours on this. Regards Hi folks, I'm curious if I can for example, save a file from my server and it will save to all other servers - obviously if they accepted the connection first. It's for a software I developed and is almost complete and know there will be frequent updates to it. Instead of users downloading upates, I want the update files from my server to somehow synchronize to their server automatically? Anything called this?? Thanks for info. Following a tutorial on udemy, i tried to learn the very basics of mvc structure. I built the same project on my local server and it worked without giving me any error. but when i tried it on live server. its not working as it should. not showing any error. I tried to figure out the problem and found that for every page loading, it stops at the same line in my main.php file. <?php require($view); ?> starting from the above line. it stops. i came here to share my problem but i am unable to upload my files here. if there is a way to upload and share my files, please guide. zip file size of the whole project is 31.6 kb This isn't exactly an application design question, but rather a system design one.
I am about to install an Inventory Control System inside this store I work in.
The store itself also owns a Linode VPS running Centos 6.4 which hosts our website.
This new Inventory System will come built in with a Microsoft SQL Server, and supposedly it is a SQL Anywhere database, but I'm not too sure what that means.
I need to make this database publicly accessible, but only via the Linode VPS. Surely, setting restrictions is easy enough to address that issue. That isn't my question.
My first idea is to put this server into the DMZ, easy. But it doesn't exactly sound safe. So my next idea was to put a middleman server in the DMZ, this way the Linode can send queries to that middleman server and it will send that data to the SQL Server and back. This is very vaguely described I know, but I don't want to get too much into details, but rather, understand how I can create that middleman server, and what could Install onto it that would allow me to securely process queries?
My first thought was to install a webservice, that accepts an XML/JSON request and returns an XML/JSON response.
Then, I realized directly afterwards that I don't have any experience setting up a webservice like that.
What kind of options are there out there? Ultimately, my question is, should I just put the Server in the DMZ or should I create the middleman, and if so, can someone point me in the right direction as to getting a webservice set up? Edited by Zane, 15 July 2014 - 11:28 PM. Here's a random example: macbundlebox.com/the-spring-bundle/ (I purposely excluded the http://www. so people won't think this is spam) Notice how there are 11 apps listed? So suppose someone buys the package, I'm assuming they get emailed a unique license/activation code to activate that particular software? Or they get a link to download the software? Or they email each customer a unique username/password to download that software. I am not a PHP guru but I am almost certain that this is done in php and works in one of 3 ways: - Either the app developers give a giant list of licenses that are assigned by the webmaster per purchase - A URL is pinged after each purchase which sends a license back and is directly emailed to the customer - A URL is pinged and the app developers send the license to the customer So my question is...seeing as how most of you are very knowledgeable in PHP, is there any client management/billing software that you know of that could accomplish the above, and be easily managed by a non-PHP guru (perhaps even be integrated into a CMS like Wordpress?)? If not, how much would it cost (give or take) to have it built? Is there a way I can scan one of my websites for directories and files if it is not on the same server? I can scan just fine on the same server but not if it is on another server/website. since it is not the same server I tried to give the full path: http://www.site.com but it would not work. can this even be done? Hi everybody
I am one stressed person right now.
I had been away for a while only to return recently and find out that none of my websites (with Hostpapa) had been working.
I sent the technical support team an email and they told me that my websites were not PHP 5.4 compatible.
They also said:
"As register_globals is deprecated in PHP 5.4 and because of this you are receiving errors on your website. You will have to update your website code and remove register global references. If this can not be done then in that case the last option would be to upgrade to VPS hosting."
Why have things just suddenly changed?
How can I fix this problem?
It's affected many of the sites on my host - and in some cases - the submission forms are not working in connection with my Aweber account.
Please help as this has shocked me quite badly - and needs resolving asap.
Thank you in advance
Okay so I am scraping websites for their descriptions keywords and titles. I noticed that a lot of websites use the same keywords and descriptions on every page.. so my idea is to scrape the index and find all the links in there and scrape them all then after they been scraped check all of the descriptions and if the descriptions match then pull some text unique to each page and use that. I can't seem to wrap my head around it.. how would I accomplish this? I scrape with curl then find keywords description and title then find all links on the site and scrape those. soo I was thinking making an array of the descriptions and then checking and inserting to the db but doesn't seem like it would work. Any ideas? Oh also.. how would I grab just text from each page that is different from every other page? lol very confusing does anyone have an example of new code that is used this day in age for combining js and PHP to produce dynamic content on a webpage? I have looked at this from w3schools: https://www.w3schools.com/php/php_ajax_database.asp but I believe that XMLHttpRequest is really old. If I rememeber my reading right, it was replaced by fetch() a long time ago. I think i understand everything that is on that tutorial page, but I would love to see a video tutorial on this subject. can anyone here point me to such a resource? Edited December 11, 2019 by ajetrumpetis it possible to collect data from another website and insert it into my db?, lets say for example: http://www.imdb.com/title/tt0285331/episodes#season-1 could i somehow get the Episode name eg: Quote Episode 1: 12:00 a.m.-1:00 a.m. and the description Quote Jack Bauer is called to his office because there's a threat on the life of a US Senator who's running for President; Jack also discovers that his daughter has skipped out her bedroom window. and place that into a table in my db? any help would be great. I have developed a form for my website that directs the user to a different site and per-populates the form on the other site with information I want. I would like to take it one step further and make the below script fill out the form on the other site and then submit the form. Currently it just fills out the form on the other site but does not submit it. Is there any way to do this? Code: [Select] <form action="http://www.privatedutyhomecare.org/sections/consumers/locator.php" method="POST"> <input name="state" size="25" type="hidden" value="MI" /> <input name="company" size="25" type="hidden" value="Affordable HomeCare" /> <button type="submit" class="imgpx"> <img src="assets/images/logos/npda.png" alt="submit" width="51" class="nothing" height="40" /> </button> </form> HI guys Im developing Health site using PHP and mysql. I want to create graphs from using data in the database on weekly basis. so please tell me what is the best method of creating graphs and charts in php thank in advance i have an array of website links i want to loop through each and get a certain html id foreach whats wrong with what i did here? Code: [Select] foreach($links as $page) { $phtml = file_get_html($page); // find all td tags with attribite align=center foreach($phtml->find('span[id=name]') as $name) echo $name->plaintext.'<br><br>'; } How is it possible for a website to know my physical location? Some websites I've seen will have ads such as; meet singles in "HOMETOWNGOESHERE" I'm guessing this kind of info is found from my Ip address? Has anyone ever done anything like this in php, I'm interested to know how this works. I have 2 websites currentweb.com copyweb.com (say) Using php can I update 2 databases and upload files in both these 2 websites ( for both these web sites I have user id and password exmaple I am uploading a file (Image), in currentweb.com can I upload it to copyweb.com at the same ( I have database and ftp password for this ) If Yes Please help with code I got a good one for you guys, I run 20 or so websites on my server all that have very similar coding structures. On all sites, I have a php script for a mysql table that logs visitors and I filter out bots(google, yahoo, etc, as many as I know of), but since many new ones are discovered weekly/monthly, I hate manually going through all sites and adding the new bot to the array of existing bots for detection. I know there are a few ways to do this, but I'd like to know the most efficient way of basically doing one function/task/opertation and it automatically updating all website's to know the new bots without manually modifying all 20 php files every time. The sites are all on the same server, but at different domains. a few ideas, which are prob not the best 1) have a universal text file that I could update that would be located in some file on one of my sites that just has a list of all bots and then each site would read from that text file to know what bots to filter. 2) have a huge php file to execute that has all connection info/passwords for every site and runs a php script to update the corresponding website's mysql table that would hold each bot as a row in the table. the script would just add a new row with the new bot info. so then ultimately when logging visitors, it would have to read the database each time 3) try to "include" a universal .php file that's located on one of my sites that has the array of all bots. But I've tried to include a file from another domain and I know that's a security error and won't include the file as a .php, but rather the file after it's been processed. There's gotta be a better solution. any ideas? |