-
Posts
337 -
Joined
-
Last visited
Posts posted by Clinton
-
-
Here's the complete code:
<? session_start(); if(!isset($_REQUEST['logmeout'])){ echo "<center>Are you sure you want to logout?</center><br />"; echo "<center><a href=logout.php?logmeout=true>Yes</a> | <a href=javascript:history.back()>No</a>"; } else { session_destroy(); if(!session_is_registered('first')){ echo "<center><font color=red><strong>You are now logged out!</strong></font></center><br />"; echo "<center><strong>Login:</strong></center><br />"; include './index.php'; } } ?>
-
This code is located in a test/required/blah.php
When it finishes reading the script how do I tell it to go to the login page at test/index.php?
include './index.php';
-
Ok. Didn't know that. Thank you.
-
Thanks for the help folks.
The only reason I'm using request is because the individual was mailed a link to basically verify their address. The only way to do pass the information via link is REQUEST. It's the only time that I use it.
-
Here's the code that I am using to basically verifiy someone's information and change stuff in the database. There is a double verification part that selects * from the database. How can I extract that information, and put it into variables? (In my DB I have first, middle, and last. How do I extract that and put into first = $first format?)
$id = $_REQUEST['id']; $code = $_REQUEST['code']; $sql = mysql_query("UPDATE usert SET activated='1' WHERE id='$id' AND password='$code'"); $sql_doublecheck = mysql_query("SELECT * FROM usert WHERE id='$id' AND password='$code' AND activated='1'"); $doublecheck = mysql_num_rows($sql_doublecheck); if($doublecheck == 0){ echo "<strong><font color=red>Your account could not be verified! Please contact the Administrator.</font></strong>"; } elseif ($doublecheck > 0) { echo "<strong>Your e-mail address has been verified!</strong> Your will be contact shortly by the administrator for account activation.<br />";
-
Anybody?
-
I've read in a couple of places how putting the session ID into the database and then recalling it on each page and bouncing it with... something?... is one of the safest ways to maintain a connection. Does anybody know what I'm talking about or know how this might work? I've googled it for 30 minutes and can't figure it out.
-
In one table I have probably about 45 columns and right now about 60 rows of information. The bulk of that information contains dates. I want to create a CRON job that will take today's date and if it's a year past the date on file it will send out an e-mail. Now, how is the best way to go about this? In my table I have id, name, date1, date2, date3, date4, etc... so in one column it could show up to 40 dates being out of sync at one time. But I'm not sure how to do this. Is this just as simple as a WHILE statement and picking out the outdated dates? It's probably not as hard as I'm making it out to be there's just a crap load of information and i'm not sure how to handle it. Thanks.
This code below is to show how much data I'm working with.
html> <head> <title>Salt Lake City Training Report</title> <STYLE TYPE="text/css"> <!-- td{font-family: Arial; font-size: 8pt;} ---> </STYLE> </head> <body bgcolor="#FFFFFF"> <font size="2"><a href="training.php"> Return to Training </a></font><p> <table border="1" width="8000px"> <font size="1"> <tr><td>Name:</td> <td><center>Date of Birth:</td> <td><center>CDL License Expire:</td> <td><center>CDL Medical Evaluation:</td> <td><center>Confined Space:</td> <td><center>Drivers License:</td> <td><center>HazMat Medical Evaluation:</td> <td><center>KUCC Contractor Orientation:</td> <td><center>KUCC EMS Level II:</td> <td><center>KUCC MOC:</td> <td><center>KUCC Personal EH & S Plan:</td> <td><center>KUCC Hazard Recognition Concentrator:</td> <td><center>KUCC Hazard Recognition Mine & Copperton:</td> <td><center>KUCC Hazard Recognition UPP:</td> <td><center>KUCC Hazard Recognition Precious Metals:</td> <td><center>KUCC Hazard Recognition Smelter:</td> <td><center>KUCC Hazard Recognition Tailings:</td> <td><center>KUCC Working at Heights:</td> <td><center>KUCC Pit License:</td> <td><center>MSHA Part 46:</td> <td><center>MSHA Part 48:</td> <td><center>MVR Check:</td> <td><center>OSHA 30 Hour:</td> <td><center>Respirator Fit Test:</td> <td><center>Respirator Medical Evaluation:</td> <td><center>Substance Abuse Prevention Program EE Ackgt:</td> <td><center>Substance Abuse Screen NIDA 9-Panel:</td> <td><center>Substance Abuse Screen DOT 5-panel:</td> <td><center>Substance Abuse Screen DOT Alcohol:</td> <td><center>NAIS Task Training Company Orientation:</td> <td><center>NAIS Task Training Employee Handbook:</td> <td><center>NAIS Task Training Ar Pb Cd Exp Prgm:</td> <td><center>NAIS Task Training Vacuum Truck:</td> <td><center>NAIS Task Training Hydro-Blaster:</td> <td><center>NAIS Task Training Explosives:</td> <td><center>NAIS Task Training Aerial Work Platform:</td> <td><center>NAIS Task Training Lift Truck:</td> <td><center>NAIS Task Training Hazwoper:</td> <td><center>Hazard Training FMC Corp:</td> <td><center>Hazard Training Solvay Chemicals:</td> <td><center>Hazard Training Barrick Goldstrike:</td> <td><center>Hazard Training UITC:</td> <td><center>Hazard Training Newmont:</td> <td><center>Hazard Training General Chemical:</td> <td><center>Hazwoper 40 Hour:</td> <td><center>Hazwoper 24 Hour:</td> <td><center>First Aid / CPR:</td> </tr> <? while ($row=mysql_fetch_assoc($result)){ extract($row); if ($dob=='0000-00-00'){ $dob = " "; } else{ $dob = date('n/j/Y',strtotime($dob)); } if ($cdl=='0000-00-00') { $cdl = " "; } else{ $cdl = date('n/j/Y',strtotime($cdl)); } if ($cdlmedical=='0000-00-00') { $cdlmedical = " "; } else{ $cdlmedical = date('n/j/Y',strtotime($cdlmedical)); } if ($confinedspace=='0000-00-00') { $confinedspace = " "; } else{ $confinedspace = date('n/j/Y',strtotime($confinedspace)); } if ($driverslicense=='0000-00-00') { $driverslicense = " "; } else{ $driverslicense = date('n/j/Y',strtotime($driverslicense)); } if ($hazmatmedical=='0000-00-00') { $hazmatmedical = " "; } else{ $hazmatmedical = date('n/j/Y',strtotime($hazmatmedical)); } if ($kucccontractor=='0000-00-00') { $kucccontractor = " "; } else{ $kucccontractor = date('n/j/Y',strtotime($kucccontractor)); } if ($kuccems2=='0000-00-00') { $kuccems2 = " "; } else{ $kuccems2 = date('n/j/Y',strtotime($kuccems2)); } if ($kuccmoc=='0000-00-00') { $kuccmoc = " "; } else{ $kuccmoc = date('n/j/Y',strtotime($kuccmoc)); } if ($kuccehsplan=='0000-00-00') { $kuccehsplan = " "; } else{ $kuccehsplan = date('n/j/Y',strtotime($kuccehsplan)); } if ($kuccconcentrator=='0000-00-00') { $kuccconcentrator = " "; } else{ $kuccconcentrator = date('n/j/Y',strtotime($kuccconcentrator)); } if ($kuccmine=='0000-00-00') { $kuccmine = " "; } else{ $kuccmine = date('n/j/Y',strtotime($kuccmine)); } if ($kuccupp=='0000-00-00') { $kuccupp = " "; } else{ $kuccupp = date('n/j/Y',strtotime($kuccupp)); } if ($kuccpmetals=='0000-00-00') { $kuccpmetals = " "; } else{ $kuccpmetals = date('n/j/Y',strtotime($kuccpmetals)); } if ($kuccsmelter=='0000-00-00') { $kuccsmelter = " "; } else{ $kuccsmelter = date('n/j/Y',strtotime($kuccsmelter)); } if ($kucctailings=='0000-00-00') { $kucctailings = " "; } else{ $kucctailings = date('n/j/Y',strtotime($kucctailings)); } if ($kuccheights=='0000-00-00') { $kuccheights = " "; } else{ $kuccheights = date('n/j/Y',strtotime($kuccheights)); } if ($kuccpit=='0000-00-00') { $kuccpit = " "; } else{ $kuccpit = date('n/j/Y',strtotime($kuccpit)); } if ($msha46=='0000-00-00') { $msha46 = " "; } else{ $msha46 = date('n/j/Y',strtotime($msha46)); } if ($msha48=='0000-00-00') { $msha48 = " "; } else{ $msha48 = date('n/j/Y',strtotime($msha48)); } if ($mvrcheck=='0000-00-00') { $mvrcheck = " "; } else{ $mvrcheck = date('n/j/Y',strtotime($mvrcheck)); } if ($osha30=='0000-00-00') { $osha30 = " "; } else{ $osha30 = date('n/j/Y',strtotime($osha30)); } if ($respiratorfit=='0000-00-00') { $respiratorfit = " "; } else{ $respiratorfit = date('n/j/Y',strtotime($respiratorfit)); } if ($respiratormedical=='0000-00-00') { $respiratormedical = " "; } else{ $respiratormedical = date('n/j/Y',strtotime($respiratormedical)); } if ($substanceeea=='0000-00-00') { $substanceeea = " "; } else{ $substanceeea = date('n/j/Y',strtotime($substanceeea)); } if ($substance9=='0000-00-00') { $substance9 = " "; } else{ $substance9 = date('n/j/Y',strtotime($substance9)); } if ($substance5=='0000-00-00') { $substance5 = " "; } else{ $substance5 = date('n/j/Y',strtotime($substance5)); } if ($substancealcohol=='0000-00-00') { $substancealcohol = " "; } else{ $substancealcohol = date('n/j/Y',strtotime($substancealcohol)); } if ($naisorientation=='0000-00-00') { $naisorientation = " "; } else{ $naisorientation = date('n/j/Y',strtotime($naisorientation)); } if ($naishandbook=='0000-00-00') { $naishandbook = " "; } else{ $naishandbook = date('n/j/Y',strtotime($naishandbook)); } if ($naisarpbcd=='0000-00-00') { $naisarpbcd = " "; } else{ $naisarpbcd = date('n/j/Y',strtotime($naisarpbcd)); } if ($naisvacuum=='0000-00-00') { $naisvacuum = " "; } else{ $naisvacuum = date('n/j/Y',strtotime($naisvacuum)); } if ($naishydro=='0000-00-00') { $naishydro = " "; } else{ $naishydro = date('n/j/Y',strtotime($naishydro)); } if ($naisexplosives=='0000-00-00') { $naisexplosives = " "; } else{ $naisexplosives = date('n/j/Y',strtotime($naisexplosives)); } if ($naisplatform=='0000-00-00') { $naisplatform = " "; } else{ $naisplatform = date('n/j/Y',strtotime($naisplatform)); } if ($naislifttruck=='0000-00-00') { $naislifttruck = " "; } else{ $naislifttruck = date('n/j/Y',strtotime($naislifttruck)); } if ($naishazwoper=='0000-00-00') { $naishazwoper = " "; } else{ $naishazwoper = date('n/j/Y',strtotime($naishazwoper)); } if ($fmchaz=='0000-00-00') { $fmchaz = " "; } else{ $fmchaz = date('n/j/Y',strtotime($fmchaz)); } if ($solvayhaz=='0000-00-00') { $solvayhaz = " "; } else{ $solvayhaz = date('n/j/Y',strtotime($solvayhaz)); } if ($barrickhaz=='0000-00-00') { $barrickhaz = " "; } else{ $barrickhaz = date('n/j/Y',strtotime($barrickhaz)); } if ($uitchaz=='0000-00-00') { $uitchaz = " "; } else{ $uitchaz = date('n/j/Y',strtotime($uitchaz)); } if ($newmonthaz=='0000-00-00') { $newmonthaz = " "; } else{ $newmonthaz = date('n/j/Y',strtotime($newmonthaz)); } if ($genchemhaz=='0000-00-00') { $genchemhaz = " "; } else{ $genchemhaz = date('n/j/Y',strtotime($genchemhaz)); } if ($hazwoper40=='0000-00-00') { $hazwoper40 = " "; } else{ $hazwoper40 = date('n/j/Y',strtotime($hazwoper40)); } if ($hazwoper24=='0000-00-00') { $hazwoper24 = " "; } else{ $hazwoper24 = date('n/j/Y',strtotime($hazwoper24)); } if ($firstaidcpr=='0000-00-00') { $firstaidcpr = " "; } else{ $firstaidcpr = date('n/j/Y',strtotime($firstaidcpr)); } /* ##################### */ /* END CDL Check */ /* ##################### */ echo <<<END <tr> <td> $lname, $fname $mname.</td> <td><center> $dob </td> <td><center> $cdl </td> <td><center> $cdlmedical </td> <td><center> $confinedspace </td> <td><center> $driverslicense </td> <td><center> $hazmatmedical </td> <td><center> $kucccontractor </td> <td><center> $kuccems2 </td> <td><center> $kuccmoc </td> <td><center> $kuccehsplan </td> <td><center> $kuccconcentrator </td> <td><center> $kuccmine </td> <td><center> $kuccupp </td> <td><center> $kuccpmetals </td> <td><center> $kuccsmelter </td> <td><center> $kucctailings </td> <td><center> $kuccheights </td> <td><center> $kuccpit </td> <td><center> $msha46 </td> <td><center> $msha48 </td> <td><center> $mvrcheck </td> <td><center> $osha30 </td> <td><center> $respiratorfit </td> <td><center> $respiratormedical </td> <td><center> $substanceeea </td> <td><center> $substance9 </td> <td><center> $substance5 </td> <td><center> $substancealcohol </td> <td><center> $naisorientation </td> <td><center> $naishandbook </td> <td><center> $naisarpbcd </td> <td><center> $naisvacuum </td> <td><center> $naishydro </td> <td><center> $naisexplosives </td> <td><center> $naisplatform </td> <td><center> $naislifttruck </td> <td><center> $naishazwoper </td> <td><center> $fmchaz </td> <td><center> $solvayhaz </td> <td><center> $barrickhaz </td> <td><center> $uitchaz </td> <td><center> $newmonthaz </td> <td><center> $genchemhaz </td> <td><center> $hazwoper40 </td> <td><center> $hazwoper24 </td> <td><center> $firstaidcpr </td> </tr> END; } ?> </table> </font> </body> </html>
-
LoL. A bunch of die hards. That's good. Couldn't do it without ya'll.
-
I'll be storing information about explosives so I'll want the SSL.
Thanks for the link. I'll be looking into that more in depth.
-
OK. So I am trying to figure out the best way to go about adding a login script to my site. I want a login script that allows me different levels of access. I took the famous sde Login & Session example and kind of changed it around to add such levels of access, as shown below. But I'm now kind of concerned about security. As a result I found this script: http://www.roscripts.com/PHP_login_script-143.html and while it does have a admin vs. member feature from what I gather it doesn't have the flexibility that something like below does. So really, what do I do? What options do I have?
This brings me about to my final question. If I'm using an SSL Certificate on my website and use the following script below will that suffice?
Any help would be greatly appreciated. Thanks.
<? // connect to database include("inc/connect.php"); // include auth and nav include("inc/auth.php"); include("inc/nav.php"); ?> <? $rn=("SELECT Status FROM users WHERE username='" . $_SESSION['username']."'"); $rz=mysql_query($rn); while($row=mysql_fetch_array($rz)) { if($row["Status"]=="0"){ echo ("<br>Have a great day! <a href='logout.php'>Close</a>"); }elseif($row["Status"]=="1"){ ?> <title> Salt Lake City - Explosive Division </title> <head> </head> <body> <center> <p> Welcome to the. Here you will find a list of current personnel, a calendar, current inventory (minus powder at this time), and Direct Billed Hotels. If you have any suggestions please let us know <a href="mailto:">here</a> and when you are ready to navigate click your right mouse button. Oh, always remember to JUST BLAST IT! </center> </body> <? }else{ ?> <title> Salt Lake City </title> <head> </head> <body> <center> <p> Welcome to the Salt Lake City= Here you will find a list of current personnel, a calendar, current inventory (minus powder at this time), and Direct Billed Hotels. If you have any suggestions please let us know <a href="mailto:">here</a> and when you are ready to navigate click your right mouse button. Oh, always remember to JUST BLAST IT!<p> </center> <center><font color=orange><h2>////////////////////////////// WARNING: G14 CLASSIFIED. ADMINISTRATOR ACCESS ONLY! \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\</font></h2></center> Pending Registrations:<p> <? $q1= "SELECT * FROM users WHERE Status='0'"; $q1rz=mysql_query($q1) or die(mysql_error()); while($row1 = mysql_fetch_array($q1rz)){ ?> <form action="updateregistration.php" method="post"> <table border="0"> <tr><td>First Name:</td><td> <input type="text" name="First" maxlength="60" value="<? echo $row1['First']; ?>"> </td></tr> <tr><td>Middle Initial:</td><td> <input type="text" name="MI" maxlength="60" value="<? echo $row1['MI']; ?>"> <tr><td>Last Name:</td><td> <input type="text" name="Last" maxlength="60" value="<? echo $row1['Last']; ?>"> <tr><td>E-mail:</td><td> <input type="text" name="Email" maxlength="60" value="<? echo $row1['Email']; ?>"> <tr><td>Home Phone:</td><td> <input type="text" name="Phone" maxlength="60" value="<? echo $row1['Phone']; ?>"> <tr><td>Cell Phone:</td><td> <input type="text" name="CellPhone" maxlength="60" value="<? echo $row1['CellPhone']; ?>"> </td></tr> <tr><td>Username:</td><td> <input type="text" name="username" maxlength="200" value="<? echo $row1['username']; ?>"> </td></tr> <tr><td>Status:</td><td> <select name="Status" size="1"> <option value="0">Pending/Suspended</option> <option value="1">User</option> <option value="2">Administrator</option> <option value="187">Delete Account!</option> </select> </td></tr> <tr><th colspan=2><input type="submit" name="submit" value="Approve!"><input type="hidden" name="ID" maxlength="10" value="<? echo $row1['ID']; ?>"></th></tr> </table> </form> <p> <? } ?> <p>Current Users:<p> <? $q2= "SELECT * FROM users WHERE Status>'0'"; $q2rz=mysql_query($q2) or die(mysql_error()); while($row2 = mysql_fetch_array($q2rz)){ ?> <form action="updateregistration.php" method="post"> <table border="0"> <tr><td><? echo $row2['First']; ?><input type="hidden" name="First" maxlength="60" value="<? echo $row2['First']; ?>"> <input type="hidden" name="MI" maxlength="60" value="<? echo $row2['MI']; ?>"> <? echo $row2['Last']; ?>'s<input type="hidden" name="Last" maxlength="60" value="<? echo $row2['Last']; ?>"> <input type="hidden" name="Email" maxlength="60" value="<? echo $row2['Email']; ?>"> <input type="hidden" name="Phone" maxlength="60" value="<? echo $row2['Phone']; ?>"> <input type="hidden" name="CellPhone" maxlength="60" value="<? echo $row2['CellPhone']; ?>"> <input type="hidden" name="username" maxlength="200" value="<? echo $row2['username']; ?>"> <td>Status:</td><td> <select name="Status" size="1"> <option value="<? echo $row2['Status']; ?>"><? if($row2['Status']=="0"){ echo ("Pending/Suspended");}elseif($row2['Status']=="1"){ echo ("User");}else{ echo ("Administrator");} ?></option> <option value="0">Pending/Suspended</option> <option value="1">User</option> <option value="2">Administrator</option> <option value="187">Delete Account!</option> </select> <td><th colspan=2><input type="submit" name="submit" value="Update"><input type="hidden" name="ID" maxlength="10" value="<? echo $row2['ID']; ?>"></th></tr> </table> </form> </body> <? }}} ?>
-
Thanks a million. That was another great learning experience for me and it works like a charm.
-
Are you taking the form from the DigitalDripped website or are you DigitalDripped?
-
Ok, I appreciate the help. I've been figuring out this stuff pretty well but this one is tricking me up.
-
You now, I thought it might have been an else / if problem I just didn't know how to figure it out. I see what you are saying here but I've got about 48 columns I'm going to need when all is said and done. :-| Would it functionally be better to do something like this?
<?php while ($row=mysql_fetch_assoc($result)){ extract($row); echo ?> <tr> <td> <?$lname $fname $mname;?> </td> <td> <? if ($dob=='0000-00-00') echo " "; else echo date('n/j/Y',strtotime($dob)); ?> </td> <td> <? if ($cdl=='0000-00-00') echo " "; else echo date('n/j/Y',strtotime($cdl)); ?> </td> </tr> <? } ?>
Or does it not matter because it will essentially run together?
-
I was adding to them. I posted another post because I'm having a trouble with the format. It's not kicking over. I've dissected the thing 14 different times and I can't figure it out.
-
I have the code below but the output Date of Birth and CDL Dates are running together in the Date of Birth Box. I've tore it apart in my designer program but I can't figure it out. Any ideas?
<tr> <td>Name:</td> <td>Date of Birth:</td> <td>CDL License Expire:</td> </tr> <?php while ($row=mysql_fetch_assoc($result)){ extract($row); echo"<tr> <td>$lname $fname $mname</td> <td>"; if ($dob=='0000-00-00') echo " "; else echo date('n/j/Y',strtotime($dob)); "</td> <td>"; if ($cdl=='0000-00-00') echo " "; else echo date('n/j/Y',strtotime($cdl)); "</td> </tr>"; } ?>
-
Never mind. Got it. :-) Thanks a million folks.
-
Oh the power of a semicolon. Your English teacher would be proud. :-) What about this one?
Parse error: syntax error, unexpected '{', expecting ')' in trainingreport.php on line 31
-
That makes sense. I gave it a shot, however, and I"m getting an error:
Parse error: syntax error, unexpected T_IF, expecting ',' or ';' in /trainingreport.php on line 31
<?php while ($row=mysql_fetch_assoc($result)){ extract($row); echo"<tr> <td>$lname $fname $mname</td> <td>" if ($dob=='0000-00-00') echo " "; else echo date('n/j/Y',strtotime({$dob})); "</td> <td>$cdl</td> </tr>"; } ?>
-
If I use the extract(row) function how do I change the following to recognize that?
<? if ($row{'dob'}=='0000-00-00') echo " "; else echo date('n/j/Y',strtotime($row{'dob'})); ?>
-
Thanks grace about the extract row. That's a useful tool I wish I would have known about a while ago! :-)
What do you mean revraz? Here's what I got, how is that not being utilized correctly?
<html> <head> <title>Salt Lake City Training Report</title> </head> <body bgcolor="#FFFFFF"> <font size="2"> <table border="1"> <tr> <td>Name:</td> <td>Date of Birth:</td> <td>CDL License Expire:</td> </tr> <?php while ($row=mysql_fetch_assoc($result)){ extract($row); echo"<tr> <td>$lname $fname $mname</td> </tr>"; } ?> </table> </font> </body> </html>
-
Not sure why my information is not parsing. I'm pretty sure it has something to do with the coded line below but I'm not sure what.
Any help would be appreciated. Thanks.
$dbhandle = mysql_connect($hostname, $username, $password)
or die("Unable to connect to MySQL");
$selected = mysql_select_db("clintona_SLC",$dbhandle)
or die("Can not open SLC Database");
$result = mysql_query("SELECT * FROM training ORDER BY lname");
?>
<html>
<head>
<title>Salt Lake City Training Report</title>
</head>
<body bgcolor="#FFFFFF">
<table border="1">
<tr>
<td><b><u>Name:</b></u></td> <td><b><u>Date of Birth:</b></u></td> <td><b><u>License Expiration:</b></u></td>
<? while ($row = mysql_fetch_array($result)) { ?>
<td><? (".$row{'lname'}.' '.$row{'fname'}.' '.$row{'mname'}."); ?></td>
<? } ?>
</body>
</html>
-
That did it. It took out the space and now it works. Thanks a million.
[SOLVED] Includes
in PHP Coding Help
Posted
Sorry, I believe you already said that. :-|
Here's the code. But it keeps taking me back, looping, to the Yes / No part. It doesn't follow through.