Jump to content

Calgaryalberta

Members
  • Posts

    39
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Calgaryalberta's Achievements

Member

Member (2/5)

0

Reputation

  1. I have a calendar installed on my website, the way it currently works is you hover your mouse over a data and all the events for that date appear. What I would like it to do is allow someone to click on the date, and the information for that date appears in a pop-up window. Now Im not sure how to do this. Is it possible to make pop-up windows in php, or do I have to embed some sort of java-script within the php scripting, or how would that work, my code is below if anyone would like to take a look at it. <?php $host="***"; // Host name $username="***"; // Mysql username $password="***"; // Mysql password $db_name="***"; // Database name $tbl_name="***"; // Table name // Connect to server and select databse. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $currMonth = isset($_GET['month']) ? $_GET['month'] : date('n'); $currYear = isset($_GET['year']) ? $_GET['year'] : date('Y'); # Sample "events" table # +----+---------------------+------------+ # | id | title | event_date | # +----+---------------------+------------+ # | 1 | County show | 2008-04-25 | # | 2 | Pop concert | 2008-05-01 | # | 3 | Jazz Fest | 2008-04-27 | # | 4 | Dentist appointment | 2008-04-25 | # +----+---------------------+------------+ /**** * get this months events and store in array */ $sql = "SELECT DAY(event_date) as day, GROUP_CONCAT(title SEPARATOR '\n') as titles FROM events WHERE MONTH(event_date)=$currMonth AND YEAR(event_date) = $currYear GROUP BY day"; $res = mysql_query($sql); while (list($d, $t) = mysql_fetch_row($res)) { $events[$d] = $t; } $today = (($currYear == date('Y')) && ($currMonth == date('n'))) ? date('j') : 0; $prevMonth = $currMonth==1 ? 12 : $currMonth-1; $nextMonth = $currMonth==12? 1 : $currMonth+1; $prevYear = $currMonth==1 ? $currYear-1 : $currYear; $nextYear = $currMonth==12? $currYear+1 : $currYear; $day1 = mktime(0,0,0,$currMonth,1,$currYear); $dim = date('t', $day1); $dayN = mktime(0,0,0,$currMonth,$dim,$currYear); $dow1 = (date('w',$day1)+6) % 7; $dowN = (date('w',$dayN)+6) % 7; $calHead = date('F Y',$day1); echo <<<EOT <table border="0" cellspacing="1" style="border: 1pt solid silver"> <tr> <td class="hd"><a class="nul" href="$_SERVER[php_SELF]?year=$prevYear&month=$prevMonth"><<</a></td> <td colspan="5" class="hd">$calHead</td> <td class="hd"><a class="nul" href="$_SERVER[php_SELF]?year=$nextYear&month=$nextMonth">>></a></td> </tr> <tr> <th class="wd">Monday</th> <th class="wd">Tuesday</th> <th class="wd">Wednesday</th> <th class="wd">Thursday</th> <th class="wd">Friday</th> <th class="we">Saturday</th> <th class="we">Sunday</th> </tr> <tr> EOT; for ($d=0;$d<$dow1;$d++) echo "<td class=\"hd\"> </td>"; $c = $dow1; for ($d=1; $d<=$dim; $d++, $c++) { if ($c%7==0) echo "</tr><tr>"; $cl = ($c%7==5) || ($c%7==6) ? 'we' : 'wd'; $st = ($d == $today) ? "style='border: 1pt solid #FF0000'" : ''; echo "<td class=\"$cl\" $st>\n"; /******* * is there an event on this day */ if (isset($events[$d])) echo "<span title='{$events[$d]}' style='font-weight: 600; color: red'>$d</span>"; else echo "$d" ; echo "</td>\n"; } while ($c++ % 7 != 0) echo '<td class=\"hd\"> </td>'; echo "</tr></table>\n"; ?>
  2. I have not looked online yet, but what I was wondering if anyone had a quick script for was: I want to have text moving across a page from right to left - one end to the other: Text = "Please Visit this website at http:// , Please Visit this website at http://, Please visit this website" and each statement will have another website listed. If anyone has a quick script for this they could share with me that'd be great - Im also going to google it right now! - Thanks!
  3. Oh and on my html page, I do have one form looking for emailhandle.php and the other form looking for loginhandle.php But on the login, when clicking the submit button it is looking for emailhandle.php
  4. I have two html forms on my page. One is for users to enter their email address in the top left corner and hit 'submit' and it adds them to our mailing list. The other form is within a table, and is a login. Instead of having the login use loginhandle.php and the email for use emailhandle.php is it possible just to have one php handle form, for both of these scripts? Right now I have two seperate handle.php for each form. The problem is, when I try and and use the email form it works fine using emailhandle.php, but when I try and use the login and click 'submit' it is looking for emailhandle.php, when it should be looking for loginhandle.php. I will be glad to post the main_page.htm upon request but it is pretty long, for now I have posted the emailhandle.php and the loginhandle.php - Any tips would be great emailhandle.php <?php $con = mysql_connect("****","****","****") or die('Could not connect: ' . mysql_error()); mysql_select_db("login", $con); $sql="INSERT INTO subscribe (email, forename, surname, user) VALUES ('".$_POST['email']."','".$_POST['forename']."','".$_POST['surname']."','".$_POST['mltype']."')"; $query = mysql_query($sql,$con) or die('Error: ' . mysql_error()); if ($query) { echo "You Have Now Been Added To Our Mailing List";mysql_close($con); } else { echo "Not added."; } ?> loginhandle.php <?php $host="****"; // Host name $username="****"; // Mysql username $password="****"; // Mysql password $db_name="****"; // Database name $tbl_name="****"; // Table name // Connect to server and select databse. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); // username and password sent from signup form $myusername=$_POST['myusername']; $mypassword=$_POST['mypassword']; $sql="SELECT * FROM $tbl_name WHERE username='$myusername' and password='$mypassword'"; $result=mysql_query($sql); // Mysql_num_row is counting table row $count=@mysql_num_rows($result); // If result matched $myusername and $mypassword, table row must be 1 row if($count==1){ // Register $myusername, $mypassword and redirect to file "members/login_successful.php" session_register("myusername"); session_register("mypassword"); header("location:members/login_successful.php"); } else { echo "Wrong Username or Password"; } ?>
  5. Yesterday I posted a topic I thought was solved, but it looks as if its not. I have a login script I wrote labeled index.htm, and the checklogin.php will be below the index.htm (checklogin.php) handles the form from index.htm. When trying to login it returns "Wrong username/password" the username/password is not wrong, and the script looks fine to me, any suggestions on how I can fix this? (The username/pw do exist in the db) index.htm <table cellSpacing="3" cellPadding="0" width="100%"> <table width="300" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC"> <tr> <form name="form1" method="post" action="checklogin.php"> <td> <table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF"> <tr> <td colspan="3"><strong>Member Login </strong></td> </tr> <tr> <td width="78">Username</td> <td width="6">:</td> <td width="294"><input name="myusername1" type="text" id="myusername1" size="20"></td> </tr> <tr> <td>Password</td> <td>:</td> <td><input name="mypassword1" type="password" id="mypassword1" size="20"></td> </tr> <tr> <td> </td> <td> </td> <td><input type="submit" name="submit" value="Login"></td> </tr> </table> </td> </form> </tr> </table> </table> checklogin.php <?php $host="****"; // Host name $username="****"; // Mysql username $password="****"; // Mysql password $db_name="****"; // Database name $tbl_name="****"; // Table name // Connect to server and select databse. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); // username and password sent from signup form $myusername = $_POST['myusername1']; $mypassword = $_POST['mypassword1']; $sql = "SELECT * FROM $tbl_name WHERE mysername = '$myusername' AND mypassword = '$mypassword'"; $result = @mysql_query($sql); // Mysql_num_row is counting table row $count = @mysql_num_rows($result); // If result matched $myusername and $mypassword, table row must be 1 row if($count == 1) { // Register $myusername, $mypassword and redirect to file "login_success.php" session_register("myusername1"); session_register("mypassword1"); header("location:login_success.php"); } else { echo "Wrong Username or Password"; } ?> Theres no parse errors or anything, its just returning a "Wrong Username/Password" when the username/password are correct, any tips?
  6. Tried the code above, seemed to work, except it didn't work. lol, the parse errors are gone, but with RedArrows code - the form submitted, but it said, 'Unknown column 'username' in Where Clause' Problem is, the field is true, in the database - the name of the column in the database is the same as it is on the script . So not sure where the 'Unknown Column 'Username' in Where Clause' is coming from.
  7. For the last script posted, and I added a @mysql_num_row($result); All parse errors are gone, but now it is saying "Wrong Username/Password" Problem is the username and password is right, I can't figure it out...Here is the new script <?php $host="****"; // Host name $username="****"; // Mysql username $password="****"; // Mysql password $db_name="***"; // Database name $tbl_name="****"; // Table name // Connect to server and select databse. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); // username and password sent from signup form $myusername = $_POST['myusername1']; $mypassword = $_POST['mypassword1']; $sql = "SELECT * FROM $tbl_name WHERE username = '$myusername' AND password = '$mypassword'"; $result = @mysql_query($sql); // Mysql_num_row is counting table row $count = @mysql_num_rows($result); // If result matched $myusername and $mypassword, table row must be 1 row if($count == 1) { // Register $myusername, $mypassword and redirect to file "login_success.php" session_register("myusername1"); session_register("mypassword1"); header("location:login_success.php"); } else { echo "Wrong Username or Password"; } ?>
  8. Hey, I have a simple login script, and Im getting a Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in d:\hosting\member\aiim\login\checklogin.php on line 254 Line 254 is this: $count=mysql_num_rows($result); Here is the entire script, I dont see anything wrong with it - Any Suggestions? <?php $host="****"; // Host name $username="***"; // Mysql username $password="*****"; // Mysql password $db_name="****"; // Database name $tbl_name="****"; // Table name // Connect to server and select databse. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); // username and password sent from signup form $myusername=$_POST['myusername1']; $mypassword=$_POST['mypassword1']; $sql="SELECT * FROM $tbl_name WHERE username='$myusername' and password='$mypassword'"; $result=mysql_query($sql); // Mysql_num_row is counting table row $count=mysql_num_rows($result); // If result matched $myusername and $mypassword, table row must be 1 row if($count==1){ // Register $myusername, $mypassword and redirect to file "login_success.php" session_register("myusername1"); session_register("mypassword1"); header("location:login_success.php"); } else { echo "Wrong Username or Password"; } ?>
  9. Alright! Thanks, Im going to give that a shot! Ill post here if anything goes wrong! Thanks again.
  10. Yep the login variable is set at 1 I believe, Ill have to confirm it. But yeah I do believe it is set at 1. So this will work to determine if they are logged in. Thank you very much!! What about a script to add on to this, that checks if they are allowed access to that page or not? Or is that more complex? If you know of any easier way to do this, let me know Im open to suggestions. I just figured it would be allot easier to try and get a script to check weather or not they were allowed access to that page as opposed to creating the page over again for 4 different access levels.
  11. I was just curious I have 4 different levels for members on my site. But I have pages that all 4 levels of members can get access too, then I have pages where only members with access levels 3 and 4 can get access too. I was just wondering if anyone knew of a code I could put in the header of each page that checks their if their logged in, and only allows them access to pages that corresponds with their access level. I know its something to do with session_start(), but if anyone knows of any websites that could help me with this, or has any suggestions for a code snippet I could put it, that would be much appreciated! - Thanks
  12. Hello, Im developing a script and this is my first attempt at trying something like this. I have two fields (Text boxes) that users can type 3 letter codes in. The three letter codes represent airports. One text box is for departures, the other is for arrivals. When a user types in these three letter codes into each box, and hits 'search' I want the script to search for any flights that match the 3 letter codes of what the user typed, if no records are found, then the form will just return a "No Records Found For That Search" Now Im wondering if anyone could recommend any real good tutorials for developing a search function to do that? Thanks,
  13. Alright yeah I did put that into my SQL, and it changed the value to 270, but I tried using my join script again, and the email just emailed the address I put in and assigned the number 2 didn't start at 270
  14. Thats what I thought the gentlemen above meant with his post, change the default column in my phpmyadmin db to 270? Maybe I misunderstood. - How do I do it with PHPMyAdmin, I have my table open right now...?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.