
BelowZero
Members-
Posts
89 -
Joined
-
Last visited
Never
Profile Information
-
Gender
Not Telling
BelowZero's Achievements

Member (2/5)
0
Reputation
-
Thanks PFMaBiSmAd. I will start validating the form first and see if that helps. I'll also need the program to check if the setup page has already been submitted. Thanks for your thoughts.
-
Actually, there is no log out procedure. It's a web-based program where the user can login and make updates to their database. They will need to update several times a day so I didn't want the session to expire thus making them log back in all the time. In testing, it all works fine until I close my browser or shut the computer down. The next time I try to connect to the database, the creds are gone. Do you think I need to create a specific log out procedure?
-
I posed this question earlier and thought it was fixed, but it's not so I'm posting it again. I'm creating a file to hold mysql login creds based on the users input. They enter their username/password and the program creates a file to hold the creds for future logins. It all appears to work fine for awhile. The file is storing the correct information and the user can login with no problems. The problem is that once a user logs out, the file is somehow getting overwritten so that the creds are blank. The next time the user tries to login, they can't connect since their creds are gone. I'm using file_put_contents to write to the file initially and the user is then redirected to a page with no processing. From there they can link to a page where connection is made to the database. None of the variables ever get used again anywhere in the program aside for connection to the database. Here's the code to write to the file... //--Variables from Setup Page--\\ $server = $_POST["server"]; $username = $_POST["username"]; $password = $_POST["password"]; //--Creates a file to store Login Information--\\ $data = <<<DATA <?php \$server = "$server"; \$username = "$username"; \$password = "$password"; ?> DATA; file_put_contents("databasedata.php", $data); Can anyone give me an idea why "databasedata.php" would get overwritten upon logout? Or point me in some direction to look for the problem? Thanks!
-
Yes, that did it! Thanks.
-
IF (mysql_num_rows($result) == 0) returns: Fatal error: Can't use function return value in write context in...
-
I'm trying to update my database so that if someone enters an e-mail address that doesn't exist, the program updates the database with the new address. I've tested everything and $result returns the correct data every time (0 or 1) but if the address doesn't exist, nothing gets updated. I know I'm missing something, just not sure what it is... { $result = mysql_query(" SELECT * FROM PlayerInfo WHERE Player_Email = '$playeremail'"); IF($result) { IF (mysql_num_rows($result) = 0) { //Insert into database: new e-mail address... } } I've also tested the insert into statement and it works, so that's not the issure. Any help appreciated. Thanks.
-
Oh...I was under the impression that I could create a zip file and add files to it, but not folders containing more files. Guess that was wrong. Thanks.
-
How does one go about making files and folders available for download? I have written a program that I need others to download. The program contains many php files and several different folders (one for images, one for javascript, etc.). Is there a way to create a zip file that maintains the folders' directory structure? Or another way to approach this? My goal is, once they click the download button they won't have to recreate any folders before they upload the program to their site. Sounds elementary to me, but I've googled all day and haven't found an answer... Thanks.
-
Problem solved. Had to use compatibility view in IE9 to make it look right. Arrggghhh...
-
oops, I was playing with the stylesheet, but it made no difference. I changed the stylesheet so that they were exactly the same and get the same result. Furthermore, I tried it under yet another domain name and am getting a third look. All 3 exactly the same. All 3 different looks. Strange stuff, but I'd like to figure out why.
-
I wrote a program using my usual domain. I purchased a new domain name on the same company's servers and copied all the files to the new domain. Now my table styling and a couple other things look completely different. No changes made in any of the code and it looks different no matter what browser I'm testing. Can somebody offer any explanation that might explain this?? Thanks. www.tonalproductions.net/teetimes/publicteetimes.php (How it should look) www.teetimemaker.com/teetimes/publicteetimes.php (New domain)
-
No, it wasn't redirecting to the same page, but to a page where lots of processing was happening. Obviously I'll have to redirect to a generic page and link them to another page from there. Thanks for your help!
-
Well, that seemed to solve the problem. Everything is working as it should now. Any ideas why the redirection would cause a second execution? I still need to send the user somewhere... Thanks samshel!
-
I'm using this code to create and populate a database. It gets a bit involved as it is creating a series of times for every day in the year. The database gets created and populated just fine, however I have 2 quirks I can't figure out. First, I am creating a separate file to store connection creds to the database. The file gets created and holds the correct information, but as I am using the program, somehow the file is getting overwritten with blank spaces, making it impossible to connect to the database. 2nd, the program sends me an e-mail when the database is created. Problem is I'm getting 2 e-mails about 20 minutes apart. 1 with all the correct information and 1 blank. I'm thinking maybe these problems are related??? Like the program is trying to run itself twice or is getting called twice. Once the program runs, it never gets called again in any other part of the program code. Any ideas? Thanks. <?php $coursename = $_POST["coursename"]; $websiteurl = $_POST["websiteurl"]; $email = $_POST["email"]; $otime = $_POST["opentime"]; $ctime = $_POST["closetime"]; $interval = $_POST["interval"]; $year = $_POST["year"]; $server = $_POST["server"]; $username = $_POST["username"]; $password = $_POST["password"]; $userpassword = $_POST["userpassword"]; //--Creates a file to store Login Information--\\ $data = <<<DATA <?php \$server = "$server"; \$username = "$username"; \$password = "$password"; ?> DATA; file_put_contents("databasedata.php", $data); //--Connect to the Server--\\ mysql_connect("$server", "$username", "$password"); //--Create the Database--\\ mysql_query("CREATE DATABASE IF NOT EXISTS TeeTimes"); mysql_select_db("TeeTimes"); //--Create the Tables--\\ mysql_query("CREATE TABLE IF NOT EXISTS CourseInfo ( Course_ID int NOT NULL AUTO_INCREMENT, PRIMARY KEY(Course_ID), CourseName varchar(40) NOT NULL default '', HomePage varchar(50)NOT NULL default '', Email varchar(50) NOT NULL default '', Password varchar(20) NOT NULL default '' )"); mysql_query("CREATE TABLE IF NOT EXISTS Daysheets$year ( Sheet_ID int NOT NULL AUTO_INCREMENT, PRIMARY KEY(Sheet_ID), Date date NOT NULL, Time time NOT NULL, Player1 varchar(30) NOT NULL default '', Cart1 varchar(3) NOT NULL default '', Player2 varchar(30) NOT NULL default '', Cart2 varchar(3) NOT NULL default '', Player3 varchar(30) NOT NULL default '', Cart3 varchar(3) NOT NULL default '', Player4 varchar(30) NOT NULL default '', Cart4 varchar(3) NOT NULL default '', Player5 varchar(30) NOT NULL default '', Cart5 varchar(3) NOT NULL default '', Men smallint(4) NOT NULL default 0, Women smallint(4) NOT NULL default 0, Guest smallint(4) NOT NULL default 0, Event varchar(3) NOT NULL default '', EventName varchar(30) NOT NULL default '' )"); //***To Populate the Database with Dates and Times***\\ mysql_query(" INSERT INTO CourseInfo (CourseName,HomePage,Email,Password) VALUES('$coursename','$websiteurl','$email','$userpassword')"); $rows = mysql_query("SELECT * FROM Daysheets$year"); if ($rows[Date]=="") { $firstday = "$year:01:01 $otime:00:00"; $firstdate = strtotime($firstday); $firsttime = "$year:01:01 $otime:00:00"; $opentime = strtotime($firsttime); $lasttime = "$year:01:01 $ctime:00:00"; $closetime = strtotime($lasttime); $time = date("g:i",$opentime); $i=1; //***To Account For Leap Years***\\ if ($year == 2012 || $year == 2016 || $year == 2020 || $year == 2024) {$n=366;} else {$n=365;} while ($i <= $n) { $newday = date("Y-m-d",$opentime); mysql_query(" INSERT INTO Daysheets$year (Date,Time) VALUES('$newday','$time')"); while ($opentime < $closetime) { $newtime = strtotime("+$interval minute", $opentime); $nexttime = date("Y-m-d g:i a",$newtime); $nextd = date("Y-m-d",$newtime); $nextt = date("g:i",$newtime); mysql_query(" INSERT INTO Daysheets$year (Date,Time) VALUES('$nextd','$nextt')"); $opentime = strtotime($nexttime); } $opentime = strtotime($firsttime); $newday = strtotime("+$i day", $opentime); $nextday = date("Y-m-d g:i a",$newday); $opentime = strtotime($nextday); $closetime = strtotime($lasttime); $newday = strtotime("+$i day", $closetime); $nextday = date("Y-m-d g:i a",$newday); $closetime = strtotime($nextday); $i++; } } mysql_close(); //--Send Information for Safekeeping--\\ $to = "[email protected]"; $subject = "Tee Time Maker User Info"; $message = "Course Name:' '$coursename \n Website: ' '$websiteurl \n E-Mail: ' '$email \n Password: ' '$userpassword"; mail($to, $subject, $message, "From: $coursename <$email>"); //--Redirect user to the newly created site--\\ header("Location: /teetimes/adminteetimes.php"); ?>
-
No, it only gets called once. I'm currently checking the code to make sure.