Jump to content

Aesop

Members
  • Posts

    10
  • Joined

  • Last visited

    Never

Contact Methods

  • AIM
    gutpuppet420
  • MSN
    evilmidgets@hotmail.com
  • ICQ
    44565841
  • Yahoo
    psuedosacred2002

Profile Information

  • Gender
    Male
  • Location
    Portland Oregon

Aesop's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Sorry for the ambiguity on this.  I just got it working but heres the point of my question; This is part of a sessions based membership system I'm doing, and this is on a page that only shows records relevant to the current user thats logged in.  This member can see his leads that were generated 2 different ways;  one being contacted through the site directly and the other is from an email capturing tool that records email addresses of people sending a page to a friend.    Here is the snippet I'm using; [CODE] $pull = "SELECT m.uid, m.umail, l.lid, l.uid, l.lemail, l.lactive, l.lname, l.linactive, l.lfriendmail FROM tblUsers m, tblLeads l WHERE m.uid = l.uid AND m.umail = '$_SESSION[member]' ORDER BY l.lactive ASC"; $pulled = mysql_query($pull); $numactive = mysql_num_rows($pulled); echo "<p class=titlebar>$numactive Active Leads</p>"; while ($dt=mysql_fetch_array($pulled)) { $leadname = $dt['lname']; $friend = $dt['lfriendmail'];   $sentby = $dt['lfriendsender'];   $sentto = $dt['lemail']; $id = $dt['lid']; if (($numactive != '0') && ($friend == '0')){ echo "<ul>"; echo "<li><img src=../images/search.gif width=22 height=22 border=0 alt=><a href=leadprofile.php?id=$id>Assigned Lead: $leadname</a></li>"; echo "</ul>"; } if (($numactive != '0') && ($friend != '0')) { echo "<ul>"; echo "<li><img src=../images/search.gif width=22 height=22 border=0 alt=><a href=leadprofile.php?id=$id>Friend Referral: $sentby</a></li>"; echo "</ul>"; } } } [/CODE] Thanks for the follow up though :)
  2. Hi there, Not sure if this can be done, but I was wondering if one mysql query can produce 2 result sets (if thats the correct terminology).  For example; [code] $q = "SELECT col1, col2, col3, col4 FROM table"; $result = mysql_query($q); //throw it in a while loop to generate the sets of results   while ($row=mysql_fetch_array) {   $item1 = $row['col1'];   $item2 = $row['col2'];   $item3 = $row['col3'];   $item4 = $row['col4'];     //first set of results that will always show up     if (($item1 != '0') && ($item2 == '1')) {       echo "$item3<br />";     //second set of results that should also show up     } elseif  (($item1 != '0') && ($item2 != '1')) {       echo "$item4<br />";       }   } [/code] That snippet will only produce the first result set but I actually need both.  Any suggestions?
  3. turns out the upass field in the database was only storing 30 characters instead of the 32 needed for the md5 hash.  Like I said.... glaringly obvious
  4. Hi there, So I got a login validation script that uses md5 and stripslashes for security.  I have commented in the script where I have echo'd back to debug and I'm at a loss as to why this isnt working.  The actual validation of the username and password from the form against the database fails over and over.  I'm sure it's something glaringly obvious lol...  [code]<?php include "../includes/config.php"; //db connection set here //assign the form data to variables $user = $_POST['user']; //this is their email address $pass = $_POST['password']; //this is their password in plain text still //error check the form data if (!eregi ("^[[:alnum:]][a-z0-9_.-]*@[a-z0-9.-]+\.[a-z]{2,6}$", stripslashes(trim($user)))) // **this works {   header("location:index.php?err=1"); } elseif (!preg_match ("/[^\s]+/",$pass)) {   // it contains 0 or more whitespace chars ONLY so...   // set it to empty   $pass = "";   // or display an error header("location:index.php?err=2");    } else { //encrypt the password $pHash = md5($pass); // **echo $pHash worked fine** //check the form data against the database $q = "SELECT uid, umail, upass FROM tblUsers WHERE umail= '$user' AND upass= '$pHash'"; $result = mysql_query($q); //**echo $result turned up fine.  form variables passed and md5 worked** $nt = mysql_fetch_array($result); $memberid = $nt['uid']; $member = $nt['umail']; $memberpass = $nt['upass']; if (($user != $member) && ($pHash != $memberpass)) { header("location:index.php?err=3"); //** I KEEP GETTING THIS ERROR! } else { //they passed the database check, assign session variables for the person logging in $user = $_SESSION['user']; $active = $_SESSION['logged_in']; //update their records $now = date("F j, Y, g:i a"); $passed = "UPDATE tblUsers SET udate = $now WHERE uid = $memberid"; //finally we get to pass them on! header("location:main.php"); } } ?>[/code]
  5. Hi there, Ok picture this;  in one mysql table we have 4 names aka our brokers.  *table "brokers" ------------------------------------------- bid | bname | ------------------------------------------- 1  | joe 2  | john 3  | mary 4  | joann ------------------------------------------- On the website we have a contact form in which we treat anyone who contacts us as a lead.  I have a seperate table for storing those leads and the date they contacted us.  Now what I would like to do is setup some kind of query and php conditional statement that auto-assigns each new lead to the broker who is next in line based off of which broker received the last lead.  So if mary got the last one, then joann would be next.  This is the basic overview of the table structure I have; table "leads" ------------------------------------------- lid | lname |  bid (the join) | ldate ------------------------------------------- 1  | elvis presley | 3 | 2006-12-01 08:15:00 2  | paris hilton | 4 | 2006-12-01 09:24:45 3  | barney rubble | 1 | 2006-12-04 21:14:45 4  | carmen electra | 2 | 2006-12-05 16:20:00 ------------------------------------------- Is this doable or am I going to be manually assigning them?
  6. Hi there, So I have some records in my db table that get a time stamp in a format that looks like [b]July 10, 2006, 10:29 am[/b] upon form submission.  Every day I have a cron job lined up that will query the table, specifically the fields with the timestamp, and is supposed to update them if they are found to be 30 days older than the time stamp.  Below is the snippet that does the work.  For some reason, it won't update the record and it spits out no errors either.  Pretty much nothing happens.  Could it be the format I'm using to do the timestamp? [code=php:0] $timestamp = "SELECT tstamp FROM tblnewaccount"; $result = mysql_query($timestamp) or die ("Query failed"); if (strtotime("+30 days", $timestamp) > date('U')) {    //update the user account if they have gone past 30 days $q = "UPDATE tblnewaccount SET status = 'expired'"; [/code]
  7. [quote author=jvrothjr link=topic=100597.msg397241#msg397241 date=1152909371] its all in the " ' single and doule quote [/quote] Yes it is.  And the escaping slashes.  But it's really eluding me...
  8. Yea, the actual java is being involved. However, this echo is in conjunction with repeating rows.  so this echo gets repeated x number of times i specify in my database query. 
  9. Hello, Having a tricky problem with this snippet.  Here is the original source, not echoed yet; [code]<a href="#" onmouseover="popup('<img src=$folder\$fullsized>')" onmouseout="popout()"><img src=$folder\$thumbnail></a><br />[/code] Ok, here it is attempted to be echoed; [code=php:0]echo "<a href=\"stuff.php\" onmouseover=\"popup('<img src=\"$folder\$fullsized\">')\" onmouseout=\"popout()\">'<img src=\"$folder\$thumbnail\">'</a><br />";[/code] on the page it spits out [i]')" onmouseout="popout()">' [/i] followed by the 2nd image Any suggestions?  :-\
  10. Hello! This is my first real attempt at writing php to work with mysql and I am a DW user. Now when i test this page on apache, the form accepts all the data input, press submit, and I recieve no errors on screen. I check the db, and theres nothing there. Below I will supply the form and then the php file thats used for action: the form: <form name="updatebldg" method="post" action="bldgupdate.php"> <table width="105%" border="1" bordercolor="#FFFFFF" bgcolor="#FFFFFF"> <tr> <td colspan="5" bordercolor="#990000" bgcolor="#FFFFFF"><div align="center"><strong>Update Building Record </strong></div></td> </tr> <tr> <td width="18%" bordercolor="#990000" bgcolor="#FFF7E6"><div align="right">TMK:</div></td> <td width="31%" bordercolor="#CCCCCC" bgcolor="#FFF7E6"><div align="left"> <input name="tmk" type="text" value="" size="20" maxlength="20"> </div></td> <td width="2%" bgcolor="#FFFFFF"> </td> <td width="24%" bordercolor="#990000" bgcolor="#FFF7E6"><div align="right">Owner:</div></td> <td width="25%" bordercolor="#CCCCCC" bgcolor="#FFF7E6"><div align="left"> <input name="owner" type="text" id="owner" value="" size="20" maxlength="10"> </div></td> </tr> <tr> <td bordercolor="#990000" bgcolor="#FFF7E6"><div align="right">Address:</div></td> <td width="31%" bordercolor="#CCCCCC" bgcolor="#FFF7E6"><div align="left"> <input name="address" type="text" id="strnum4" size="20" maxlength="8"> </div></td> <td bgcolor="#FFFFFF"> </td> <td bordercolor="#990000" bgcolor="#FFF7E6"><div align="right">Land Area: </div></td> <td width="25%" bordercolor="#CCCCCC" bgcolor="#FFF7E6"><div align="left"> <input name="landarea" type="text" id="landarea" value="" size="20" maxlength="10"> </div></td> </tr> <tr> <td bordercolor="#990000" bgcolor="#FFF7E6"><div align="right">Property:</div></td> <td width="31%" bordercolor="#CCCCCC" bgcolor="#FFF7E6"><div align="left"> <input name="propname" type="text" id="propname" size="20" maxlength="20"> </div></td> <td bgcolor="#FFFFFF"> </td> <td bordercolor="#990000" bgcolor="#FFF7E6"><div align="right">Living Area: </div></td> <td width="25%" bordercolor="#CCCCCC" bgcolor="#FFF7E6"><div align="left"> <input name="bldgarea" type="text" id="bldgarea" value="" size="20" maxlength="10"> </div></td> </tr> <tr> <td bordercolor="#990000" bgcolor="#FFF7E6"><div align="right">Neighborhood:</div></td> <td width="31%" bordercolor="#CCCCCC" bgcolor="#FFF7E6"><div align="left"> <input name="neighborhood" type="text" id="neigh6" size="20" maxlength="20"> </div></td> <td bgcolor="#FFFFFF"> </td> <td bordercolor="#990000" bgcolor="#FFF7E6"><div align="right">Assessed Land Value: </div></td> <td width="25%" bordercolor="#CCCCCC" bgcolor="#FFF7E6"><div align="left"> <input name="landvalue" type="text" id="landvalue" value="" size="20" maxlength="10"> </div></td> </tr> <tr> <td bordercolor="#990000" bgcolor="#FFF7E6"><div align="right">City:</div></td> <td width="31%" bordercolor="#CCCCCC" bgcolor="#FFF7E6"><div align="left"> <input name="city" type="text" id="city" size="20" maxlength="20"> </div></td> <td bgcolor="#FFFFFF"> </td> <td bordercolor="#990000" bgcolor="#FFF7E6"><div align="right">Assessed Building Value:</div></td> <td width="25%" bordercolor="#CCCCCC" bgcolor="#FFF7E6"><div align="left"> <input name="bldgvalue" type="text" id="bldgvalue" value="" size="20" maxlength="10"> </div></td> </tr> <tr> <td bordercolor="#990000" bgcolor="#FFF7E6"><div align="right">Zip Code: </div></td> <td width="31%" bordercolor="#CCCCCC" bgcolor="#FFF7E6"><div align="left"> <input name="zip" type="text" id="zip" size="20" maxlength="20"> </div></td> <td bgcolor="#FFFFFF"> </td> <td bordercolor="#990000" bgcolor="#FFF7E6"><div align="right">Number of Bldgs on Prop. </div></td> <td width="25%" bordercolor="#CCCCCC" bgcolor="#FFF7E6"><div align="left"> <input name="bldgsonprop" type="text" id="bldgsonprop" value="" size="20" maxlength="10"> </div></td> </tr> <tr> <td bordercolor="#990000" bgcolor="#FFF7E6"><div align="right">Tenure:</div></td> <td bordercolor="#CCCCCC" bgcolor="#FFF7E6"><div align="left"> <input name="tenure" type="text" value="" size="20" maxlength="10"> </div></td> <td bgcolor="#FFFFFF"> </td> <td bordercolor="#990000" bgcolor="#FFF7E6"><div align="right">Pitt:</div></td> <td width="25%" bordercolor="#CCCCCC" bgcolor="#FFF7E6"><div align="left"> <input name="pitt" type="text" id="pitt2" size="20" maxlength="20"> </div></td> </tr> <tr> <td bordercolor="#990000" bgcolor="#FFF7E6"><div align="right">Zoning:</div></td> <td bordercolor="#CCCCCC" bgcolor="#FFF7E6"><div align="left"> <input name="zoning" type="text" id="zoning2" size="20" maxlength="20"> </div></td> <td bgcolor="#FFFFFF"> </td> <td bordercolor="#FF0000" bgcolor="#FFF7E6"><div align="right"><strong>UPDATED DATE: </strong></div></td> <td bordercolor="#FF0000"><div align="left"> <input name="date" type="text" id="zoning3" size="20" maxlength="20"> </div></td> </tr> <tr> <td height="15" colspan="5"><div align="center"><input type="Submit" value="Update Record"></div></td> </tr> </table> </form> Now for the php file that supplies the action: [!--PHP-Head--][div class=\'phptop\']PHP[/div][div class=\'phpmain\'][!--PHP-EHead--]<html> <body> [span style=\"color:#0000BB\"]<?php mysql_connect [/span][span style=\"color:#007700\"]([/span][span style=\"color:#DD0000\"]\"localhost\"[/span][span style=\"color:#007700\"], [/span][span style=\"color:#DD0000\"]\"*****\"[/span][span style=\"color:#007700\"], [/span][span style=\"color:#DD0000\"]\"*****\"[/span][span style=\"color:#007700\"]); [/span][span style=\"color:#0000BB\"]mysql_select_db [/span][span style=\"color:#007700\"]([/span][span style=\"color:#DD0000\"]\"chaneybrooks\"[/span][span style=\"color:#007700\"]); [/span][span style=\"color:#0000BB\"]mysql_query [/span][span style=\"color:#007700\"]([/span][span style=\"color:#DD0000\"]\"INSERT INTO bldgs (tmk, owner, address, landarea, propname, bldgarea, neighborhood, landvalue, city, bldgvalue, zip, bldgsonprop, pitt, tenure, zoning, date) VALUES (\'{$_POST[\'tmk\']}\', \'{$_POST[\'owner\']}\', \'{$_POST[\'address\']}\', \'{$_POST[\'landarea\']}\', \'{$_POST[\'propname\']}\', \'{$_POST[\'bldgarea\']}\', \'{$_POST[\'neighborhood\']}\', \'{$_POST[\'landvalue\']}\', \'{$_POST[\'city\']}\', \'{$_POST[\'bldgvalue\']}\', \'{$_POST[\'zip\']}\', \'{$_POST[\'bldgsonprop\']}\', \'{$_POST[\'pitt\']}\', \'{$_POST[\'tenure\']}\', \'{$_POST[\'zoning\']}\', \'{$_POST[\'date\']}\'\"[/span][span style=\"color:#007700\"]); print ([/span][span style=\"color:#DD0000\"]\"Building record updated.\"[/span][span style=\"color:#007700\"]); [/span][span style=\"color:#0000BB\"]?> [/span]</body> </html> [/span][!--PHP-Foot--][/div][!--PHP-EFoot--]
×
×
  • 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.