Jump to content

anthonydamasco

Members
  • Posts

    92
  • Joined

  • Last visited

    Never

Everything posted by anthonydamasco

  1. Alright so I should create 2 columns, one called time that I submit "time()" into and one called expire that I submit a date via form too. can you give me an example of what a simple script would look like with the two columns "time" and "expire", and lets say I wanted to set the time for 90 days after.
  2. Hello there, I've been googling this for a while, and I can't seem to ask the right question or find any answers, either way, I'm not getting anywhere. The company I work for is a staffing agency, and they want a job search list, now I have to develop a database and an admin panel for our staff so they can add jobs to a "Job search" for employees. I pretty much can handle everything but 1 task. Setting an expiration date. If the job starts 1 month after It's posted, I want the to be a field on the admin panel where our staff could select "Sept. 9th 2006" and the job expires and removes itself for either the database or from the search. I have some ideas on how this could work, for example perhaps I could set a field called Expiration and make it 0 or 1, and when the search it only brings up the results that have "expiration == 1" and then have a script that sets it so 1 with = 0 on a certain date or after a certain time. If anyone could point me in the right direction as to the best solution I would appreciate it.
  3. worx gr8!!!!!!!!!!!!!!!!!!!!1 thank you, you cleared alot up for me!
  4. everything seems to work, but this is the error that i get when using your script Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /usr/home/www2/web/log.php on line 25 LINE 25 [code=php:0]  if(mysql_num_rows($result) == 1) [/code]
  5. The problem I am having is a little complex, well to me at least. I developed a very simple - register - login script using what little php knowlage I have and The more i test it, the more holes I find. My session variables dont work, and it lets anyone who acesses Login_success.php without checking for login name and a valid password, Now I read alot about sessions so I think I'm having trouble setting session variables, but I'm not sure what to do, and on top of that, my md5 hash is messing up! This is my login script "log.php" [code=php:0] <?php /* Check User Script */ session_start();  // Start Session error_reporting(E_ALL); ini_set('display_errors','on');  // connect to database $conn = mysql_connect("localhost","www2","accuoffice"); //select the database $db = mysql_select_db("accu") or die( "Unable to select database"); $username=""; $password=""; $username = $_POST['username']; => if (isset($_POST['username'])) {   $username = $_POST['username']; } else {   die ('You did not provided a username !!'); // Conver to simple variables $password = $_POST['password']; // Convert password to md5 hash $password = md5($password); $sql = "SELECT * FROM staff WHERE username='$username' AND password='$password' AND activated='1')"; mysql_query($sql); $login_check = mysql_num_rows($sql); mysql_close(); if($login_check == 0){     while($row = mysql_fetch_array($sql)){     foreach( $row AS $key => $val ) {       $row[$key] = stripslashes( $val ); }      }         // Register some session variables!         session_register('firstname');         $_SESSION['firstname'] = $firstname;         session_register('lastname');         $_SESSION['lastname'] = $lastname;         session_register('email');         $_SESSION['email'] = $email;         session_register('special_user');         $_SESSION['user_level'] = $user_level;                 mysql_query("UPDATE staff SET last_login=now() WHERE userid='$userid'");                 header("Location: login_success.php");     } } else {     echo "You could not be logged in! Either the username and password do not match or you have not validated your membership!<br />     Please try again!<br />"; } ?> [/code]
  6. I just tried to goto "login_success.php" from another PC and it goes right through
  7. The problem I am having is a little complex, well to me at least. I developed a very simple - register - login script using what little php knowlage I have and The more i test it, the more holes I find. My session variables dont work, and it lets anyone who acesses Login_success.php without checking for login name and a valid password, what do i have to change to fix this? This is my login script [code=php:0] <?php /* Check User Script */ session_start();  // Start Session $conn = mysql_connect("localhost","www2","****"); $db = mysql_select_db("accu") or die( "Unable to select database"); $username=""; $password=""; // Conver to simple variables $username = $_POST['username']; $password = $_POST['password']; // Convert password to md5 hash $password = md5($password); $sql = "SELECT * FROM staff WHERE username='$username' AND password='$password' AND activated='1')"; mysql_query($sql); $login_check = mysql_num_rows($sql); mysql_close(); if($login_check = 0){     while($row = mysql_fetch_array($sql)){     foreach( $row AS $$key => $val ){         $$key = stripslashes( $val );     }         session_register('firstname');         $_SESSION['firstname'] = $firstname;         session_register('lastname');         $_SESSION['lastname'] = $lastname;         session_register('email');         $_SESSION['email'] = $email;         session_register('user_level');         $_SESSION['user_level'] = $user_level;                 mysql_query("UPDATE staff SET last_login=now() WHERE userid='$userid'");                 header("Location: login_success.php");     } } else {     echo "You could not be logged in! Either the username and password do not match or you have not validated your membership!<br />     Please try again!<br />"; } ?> [/code] [hr] and here is my login success script: [code=php:0] <?php session_start(); echo "Welcome ". $_SESSION['firstname'] ." ". $_SESSION['lastname'] ."!     You have made it to the members area!<br /><br />"; echo "Your user level is ". $_SESSION['user_level']." which enables     you access to the following areas: <br />"; if($_SESSION['user_level'] == 0){     echo "- Forums<br />- Chat Room<br />"; } if($_SESSION['user_level'] == 1){     echo "- Forums<br />- Chat Room<br />- Moderator Area<br />"; } if($_SESSION['user_level'] == 2){     echo "- Forums<br />- Chat Room<br />- Moderator Area - Rapid response form search<br />"; } if($_SESSION['user_level'] == 3){     echo "- Forums<br />- Chat Room<br />- Moderator Area staff management<br />"; } if($_SESSION['user_level'] == 4){     echo "- Forums<br />- Chat Room<br />- Moderator Area admin tools!<br />"; } echo "<br /><a href=logout.php>Logout</a>"; ?> [/code]
  8. Well this is what I got so far, and It doesnt work, what am I doing wrong? [code=php:0] $search = "$month, $day, $year"]; $result = mysql_query("SELECT * FROM joborder WHERE date LIKE '%$search%'"); while($r=mysql_fetch_array($result)) {     $companyname=$r["companyname"];   $posdes=$r["positiondescription"];   $firstname=$r["firstname"];   $date=$r["date"];   $email=$r["email"];   $id=$r["orderid"];   $local=$r["nearestlocation"]; if (!$result){   echo "please revise your search"   }else{    echo "<table width=\"600\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">   <tr>     <td>&nbsp;</td>     <td>&nbsp;</td>     <td>&nbsp;</td>     <td>&nbsp;</td>   </tr>   <tr>     <td>&nbsp;</td>     <td><div align=\"center\"><a href=\"rrform.php?id=$id\">Click here to view this form</a></div></td>     <td>&nbsp;</td>     <td>&nbsp;</td>   </tr>   <tr>     <td width=\"44\">&nbsp;</td>     <td width=\"369\">$companyname</td>     <td width=\"82\"><img src=\"images/order.jpg\" width=\"67\" height=\"23\"></td>     <td width=\"105\">$id</td>   </tr>   <tr>     <td>&nbsp;</td>     <td>$firstname</td>     <td><strong>Date</strong></td>     <td><b>$date</b></td>   </tr>   <tr>     <td>&nbsp;</td>     <td><a href=\"$email\">$email</a></td>     <td>&nbsp;</td>     <td>$local</td>   </tr>   <tr>     <td>&nbsp;</td>     <td>&nbsp;</td>     <td>&nbsp;</td>     <td>&nbsp;</td>   </tr>   <tr>     <td>&nbsp;</td>     <td colspan=\"3\"><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">       <tr>         <td>$posdes</td>         <td>&nbsp;</td>       </tr>       <tr>         <td width=\"72%\">&nbsp;</td>         <td width=\"28%\">&nbsp;</td>       </tr>     </table></td>   </tr> </table>"; } ?> [/code]
  9. If PHP Search engine couldn't find anything, I want it to say something like "revise your search" this is the code i got [code=php:0] $search=$_POST["search"]; $result = mysql_query("SELECT * FROM joborder WHERE companyname LIKE '%$search%'"); while($r=mysql_fetch_array($result)) {     $companyname=$r["companyname"];   $posdes=$r["positiondescription"];   $firstname=$r["firstname"];   $date=$r["date"];   $email=$r["email"];   $id=$r["orderid"];   $local=$r["nearestlocation"];     echo " $companyname"; } ?> [/code] I dont even know how to start to do this
  10. Hey, I want to search using PHP and Mysql but I know I'm doing this wrong [code=php:0] $search=$_POST["search"]; $result = mysql_query("SELECT * FROM joborder WHERE companyname LIKE '%$search%'"); while($r=mysql_fetch_array($result)) {     $companyname=$r["companyname"];   $posdes=$r["positiondescription"];   $firstname=$r["firstname"];   $date=$r["date"];   $email=$r["email"];   $id=$r["orderid"];     echo "<table width="534" border="0" cellspacing="0" cellpadding="0">   <tr>     <td width="135">Company Name: </td>     <td width="131">$companyname</td>     <td width="134">Contact Name: </td>     <td width="134">$firstname</td>   </tr>   <tr>     <td>Email: </td>     <td>$email</td>     <td>Date:</td>     <td>$date</td>   </tr>   <tr>     <td colspan="4">Order ID Number : $id</td>   </tr>   <tr>     <td colspan="4">Position Description : </td>   </tr> </table>"; } ?> [/code] I want my variables displayed in that table, what do I have to fix?
  11. I'm basicly trying to get this script to work My MySQL table is called 'joborder' and the field is 'checkedby' by default 'checkedby' is set to post "no one" Basicly I want an if then statment to do this If 'checkedby' == value "No one" Then echo ' ' Else include "checkid.html" but I dont know the correct way to do it. [code=php:0]   <?php $checkedby = $my_row['checkedby'];   if($checkedby == 'no one') {   echo ''; }else{   include_once("checkid.html"); }      ?> [/code] but i know im doing something wrong.
  12. ok it works now how to i get http://www2.accustaffing.com/rrform.php?id=1 into a table? let me rephrase that, I need to be able to show this content in differant cells of a HTML table
  13. My Cols orderid - key usedbefore nearestlocation companyname firstname lastname department phone fax address addresstwo city state country zip positiontype positionclassification positiontitle employeesneeded timeneeded startdate workinghours workAddress workaddresstwo workcity workstate workzip positiondescription skillsrequired educationrequired additionalrequirements
  14. well I'll show you what i got so far [code=php:0] <?php //connect $conn = mysql_connect("localhost","www2","***") or die ("cannot connect"); $db = mysql_select_db("accu") or die( "Unable to select database"); if (get_magic_quotes_gpc()){ $orderid = mysql_real_escape_string(stripslashes($_REQUEST['id'])); } else { $orderid = mysql_real_escape_string($_REQUEST['id']); } $query = "SELECT * FROM joborder WHERE id='" . $orderid . "'"; //now send the query to the DB $result = mysql_query($query); //now read the results, i'm assuming your only looking for one row, so $my_row = mysql_fetch_array($result, MYSQL_ASSOC) or die ( mysql_error() ); print_r($my_row); error_reporting(E_ALL); ini_set('display_errors','on'); ?> [/code] This is what someone else told me to use, but it doesnt work i get this error, "Unknown column 'id' in 'where clause'"
  15. Alright here is my issue, I'm very new to php, but I've learned alot, I know how to post to mysql database and manage it, but i dont know how to pull information. I need to pull information from 1 row out of a database and put it into a printable table, can someone show me code examples of how this could be done? this is what i have so far [code=php:0] <?php //connect $conn = mysql_connect("localhost","www2","*******") or die ("cannot connect"); $db = mysql_select_db("accu") or die( "Unable to select database"); if (get_magic_quotes_gpc()){ $orderid = mysql_real_escape_string(stripslashes($_REQUEST['id'])); } else { $orderid = mysql_real_escape_string($_REQUEST['id']); } ?> [/code]
  16. I cannot get the activation to work, anyone have any ideas? Always says "Cannot be activated" [code=php:0] <?php // connect to database $conn = mysql_connect("localhost","www2","accuoffice"); //select the database $db = mysql_select_db("accu") or die( "Unable to select database"); // Create variables from URL. $userid = $_REQUEST['id']; $code = $_REQUEST['code']; //insert the values $sql = "UPDATE users SET activated='1' WHERE userid='$userid' AND password='$code'"; $double_sql = "SELECT * FROM users WHERE userid='$userid' AND password='$code' AND activated='1'"; mysql_query($sql); mysql_query($Double_sql); $doublecheck = mysql_num_rows($sql_doublecheck); mysql_close(); if($doublecheck == 0){     echo "<strong><font color=red>Your account could not be activated!</font></strong>"; } elseif ($doublecheck > 0) {     echo "<strong>Your account has been activated!</strong> You may login below!<br />";     include 'login.html'; } ?> [/code]
×
×
  • 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.