xbase
New Members-
Posts
8 -
Joined
-
Last visited
Never
Profile Information
-
Gender
Not Telling
xbase's Achievements
Newbie (1/5)
0
Reputation
-
Here is my db class: $conn = new database_conn(); $dbh = $conn->db; here is my class to create the top nav: class top_nav { var $i; var $l; function build() { global $hostname; global $dbh; $l = chr($this->i); $valid = $dbh->getOne("SELECT * FROM md_models WHERE alias REGEXP '^($l)'"); // Print valid letters if ($valid!=0) { $letter = '<td width=20 align=center> <a href="index.php?cmd=find&l='.$l.'" style="color: black; text-decoration: none; font-weight: bold">'.$l.'</a> </td>'; } else { $letter = '<td width=20 align=center style="color: #CCCCCC; font-weight: bold">'.$l.'</td>'; } return $letter; } } how come this is not working and I get an invalid object for $valid = $dbh->getOne. I use PHP 4.4.3 (not my choice). Any ideas?
-
here is the connection: /* Database Connection | Pear::DB API --------------------------------------------------------------*/ $dsn = "mysql://$user:$pass@$host/$db_name"; $db = DB::connect($dsn); if (DB::isError($db)) { die ($db->getMessage()); } here is the code: /** * Creates the header for the directory * * @param string $hostname * @param string $view * @param string $i * @return string */ function top_nav($hostname,$view, $i) { $l = chr($i); // Connect to the database so that $s = "SELECT * FROM md_models WHERE alias REGEXP '^($l)'"; $q = $db->query($s); if (DB::isError($result)) { die ($result->getMessage()); } $r = $q->fetchRow(); $v = $db->getOne($s); // Print valid letters if ($v!=0) { $letter = '<td width=20 align=center> <a href="index.CODE?cmd=find&l='.$l.'&view='.$view.'" style="color: black; text-decoration: none; font-weight: bold">'.$l.'</a> </td>'; } else { $letter = '<td width=20 align=center style="color: #CCCCCC; font-weight: bold">'.$l.'</td>'; } return $letter; } This is the error: Fatal error: Call to a member function on a non-object in /data1/members.scoreland/docs/cgi/secured/modeldir/lib/functions/functions.misc_utilities.CODE on line 77 Here is line 77: $q = $db->query($s); Does anyone have any clue what is causing the issue, its starting to annoy me.
-
Ok i'm reading from a file that likes look so: GATE The Gate voodoo://chat.fearlab.net=GATE 0 250 0 GEN POTTER harry potter net voodoo://chat.fearlab.net=POTTER 0 30 0 GEN SYCOSI Syc0sis voodoo://chat.fearlab.net=SYCOSI 1 30 0 GEN HANG H a N g O uT voodoo://chat.fearlab.net=HANG 0 30 0 GEN GUYZ Syc0 Guyz voodoo://chat.fearlab.net=GUYZ 0 30 0 MEN SOUTH Southern Comfort Music Room voodoo://chat.fearlab.net=SOUTH 0 30 0 MUS its tab delimeted which isnt a problem, but when I do the for each statement , how can I make it sore by lets say $array[3] but throughout the entire file? Here is my coding: [code=php:0] <? function row_color($k){ $bg1 = "#909090"; // color one $bg2 = "#c0c0c0"; // color two if ( $k%2 ) { return $bg1; } else { return $bg2; } } $readfile = file("../../voodoo/rooms.txt"); // create a loop that will read all elements of the array and print out // each field of the tab-delimited text file echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"2\" width=\"650\" align=\"center\"> <tr> <td width=\"30\" class=\"header\">Number </td> <td width=\"300\" class=\"header\">Room Name</td> <td width=\"20\" class=\"header\">Users</td> </tr>"; for ($k=0; $k<=count($readfile)-1; $k++) { $fields = split("\t",$readfile[$k]); echo " <tr> <td width=\"30\" class=\"info\" bgcolor=".row_color($k).">$k</td> <td width=\"300\" class=\"info\" bgcolor=".row_color($k)."><a href=$fields[2]>$fields[1]</a></td> <td width=\"20\" class=\"info\" bgcolor=".row_color($k).">$fields[3]</td> </tr> "; } echo " <tr> <td colspan=3 class=\"footer\" align=right>Total Rooms: $k</td> </tr> </table>"; ?> [/code]
-
I noticed that you are using a windows server, please note I have found a lot of severe issues regarding the use of php with IIS
-
I am using cookies to store the login variables, but for some reason they are not logging the user in: [a href=\"http://www.syc0logy.com\" target=\"_blank\"]http://www.syc0logy.com[/a] [code] <?php include('lib/conf/config.php'); include('lib/functions.php'); // user logout if($login==2){ setcookie("username", "", time()-60*60, "/", ".syc0logy.com",0); setcookie("password", "", time()-60*60, "/", ".syc0logy.com",0); $userid=0; $username=""; $password=""; $userid=0; } // user login if ($login==1) { $pass = encryption($username,$password); $sql = "SELECT * FROM users"; $result = mysql_query($sql); while($row = mysql_fetch_array($result)) { if($username==$row['username'] && $pass==$row['password'] && $login!=2){ $userid = $row['userid']; $usegroup = $row['usegroup']; } else{ $username = ""; $pass = ""; } $un = $row['username']; $pw = $row['password']; } //set cookies if($login==1 && $userid>0){ setcookie("username", "$username", time()+60*60, "/", ".syc0logy.com" ); setcookie("password", "$password", time()+60*60, "/", ".syc0logy.com" ); } } ?> <html> <head> <title>Syc0tests - Powered By: XBASE Online</title> <link rel="stylesheet" type="text/css" href="lib/css/style.css"> </head> <body> <table border="0" width="100%" id="table1"> <tr> <td align=center> <table border=0 cellspacing=0 cellpadding=0 align=center width=760> <tr> <td> <p class=contest_small align=right>v1.2.5 <center> <img border="0" src="/images/top.jpg" width="760" height="285"></td></tr></table></td> </tr> </table> <br> <table border=0 cellspacing=4 cellpadding=5 align=center width=760> <tr> <td colspan=2 width=760> <? if($userid > 0){ ?> <!-- begin user status --> <div class=welcome> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td class=contest_small align=right> Welcome <?=$username?> [ <a href=index.php?op=login=2>logout</a> ] </td> </tr> </table> <? } else { ?> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td class=contest_small align=right> <form action="index.php" method="post"> <input type="hidden" name="login" value="1"> login: <input type=text name="username" size=10 value="" class=contest style="background-color:#2A2922; border:1px solid #C0C0C0"> password: <input type=password name="password" size=10 class=contest style="background-color:#2A2922; border:1px solid #C0C0C0"> <input type=submit value="login" class=submit> <? // Error if bad login if($login == 1 && $userid == 0) { echo "<br>Incorrect login information! Forgot Password? <a href=\"?op=forgotpasswd\">Click Here</a><br>"; } else { echo "<br>Don't have an account? Then <a href=\"?op=register\">Register Now!</a>"; } ?> </form> </td></tr> </table> <? } ?> </td> </tr> <tr> <td valign=top class=contest width=260> <div id="mainmenu"> <b>MAIN MENU</b><br><br> - <a href="?op=home">home</a><br> - <a href="?op=blogs">blogs</a><br> - <a href="?op=credits">credits</a><br> - <a href="?op=sponsers">sponsors</a><br> - <a href="?op=contact_us">contact us</a><br> <p> </p> <?php if ($userid>0) { echo "<b>USER MENU</b><br><br>"; echo "- <a href=?op=register>profile</a><br>"; echo "- <a href=?op=blogs>blogs</a><br>"; echo "- <a href=?op=pm>private messages</a><br>"; echo "- <a href=?op=home&login=2>logout</a><br>"; } else { } ?> <p> </p> </div> </td> <td class=contest valign=top align=left width=500> <div id="leftcol"> <?php if(isset($op)) { if($op == 'home') { $op = "home"; } include($op.".php"); } else { include("home.php"); } ?> </div> </td> </tr> </table> </div> </body> </html> [/code]
-
ok this is what i am working on [a href=\"http://www.nmlco.com/secure/\" target=\"_blank\"]http://www.nmlco.com/secure/[/a]. I am still having trouble printing any of the session data. please if you can help me at all either reply or message me or pm me. here is my new index.php [code] <? // INCLUDE SESSION FILE require('includes/sessions.php'); // SET THE CONFIGURATION include('includes/config.php'); ?> <html> <head> <title><? echo $conf['name'],' - ',$app['name']; ?></title> <link rel="stylesheet" type="text/css" href="includes/styles/main.css"> </head> <body> <?php if(isset($step)) { if($step == '1') // Gets from the variable $step the section number { $step = "1"; } include("includes/part/section".$step.".php"); // Include the file associated with the variable $step } else { include("includes/part/section1.php"); } ?> </body> </html> [/code] HERE is my sessions.php file [code] // START THE SESSION session_start(); // SET VARIABLES extract($_POST); foreach($_POST as $k => $v) if ($k != 'submit') if (!isset($_SESSION[$k])) $_SESSION[$k] = $v; [/code] Here is my section1.php file [code] if ($step > 0) { $var = $step + 1; } else { $step = '1'; $var = $step + 1; } echo "<form action=\"?step=$var&sid=$PHPSESSID\" method=\"post\"> <table border=\"0\" cellspacing=\"2\" cellpadding=\"2\" width=\"600\" align=\"center\"> <tr> <td colspan=\"3\" id=\"header\">SECTION 1 - TYPE OF MORTGAGE AND TERMS OF LOAN</td> </tr> <tr> <td id=\"field\" width=200 valign=\"middle\">Mortgage Type</td> <td width=5></td> <td id=\"input\"> <select name=\"morgage_type\"> <option value=\"\">Select A Mortgage Type <option value=\"VA\">VA <option value=\"FHA\">FHA <option value=\"Conventional\">Conventional <option value=\"USDA/Rural Housing Service\">USDA/Rural Housing Service <option value=\"Other\">Other </SELECT> </td> </tr> <tr> <td id=\"field\" width=200 valign=\"middle\">Loan Amount</td> <td width=5></td> <td id=\"input\"><input type=\"text\" value=\"\" size=\"15\" name=\"loan_amount\"></td> </tr> <tr> <td id=\"field\" width=200 valign=\"middle\">Loan Term</td> <td width=5></td> <td id=\"input\"> <select name=\"loan_term\"> <option value=\"\">Select A Loan Term <option value=\"5 Year\">5 Year <option value=\"10 Year\">10 Year <option value=\"15 Year\">15 Year <option value=\"20 Year\">20 Year <option value=\"25 Year\">25 Year <option value=\"30 Year\">30 Year </SELECT></td> </tr> <tr> <td id=\"field\" width=200 valign=\"middle\">Amortization Type</td> <td width=5></td> <td id=\"input\"> <select name=\"amortization_type\"> <option value=\"\">Select Amortization Type <option value=\"Fixed Rate\">Fixed Rate <option value=\"GPM\">GPM <option value=\"ARM\">ARM <option value=\"Other\">Other </SELECT> </td> </tr> <tr> <td id=\"input\" align=\"center\" colspan=\"3\"> <input type=\"submit\" value=\"Submit\"></td> </tr> </table>"; [/code]
-
Can you please explain what I am doing wrong? Every tutorial I see doesnt cover what I am doing it seems. [code] <? // START THE SESSION session_start(); // SET THE CONFIGURATION require('includes/config.php'); // SET VARIABLES $morgage_type = $_POST['$morgage_type']; $loan_amount = $_POST['$loan_amount']; $loan_type = $_POST['$loan_type']; $amortization_type = $_POST['$amortization_type']; $subject_address = $_POST['$subject_address']; $subject_county = $_POST['$subject_county']; $subject_units = $_POST['$subject_units']; $subject_description = $_POST['$subject_description']; $subject_title = $_POST['$subject_title']; $subject_title_manner = $_POST['$subject_title_manner']; $subject_pay_source = $_POST['$subject_pay_source']; $amortization_type = $_POST['$amortization_type']; $lot_aquired = $_POST['$lot_aquired']; $lot_cost = $_POST['$lot_cost']; $lot_liens = $_POST['$lot_liens']; $lot_value = $_POST['$lot_value']; $lot_improve = $_POST['$lot_improve']; $refi_aquired = $_POST['$refi_aquired']; $refi_cost = $_POST['$refi_cost']; $refi_liens = $_POST['$refi_liens']; $refi_purose = $_POST['$refi_purose']; $refi_desc_improve = $_POST['$refi_desc_improve']; $refi_cost = $_POST['$refi_cost']; // REGISTER SESSIONS session_register ($morgage_type); session_register ($loan_amount); session_register ($loan_type); session_register ($amortization_type); session_register ($subject_address); session_register ($subject_county); session_register ($subject_units); session_register ($subject_description); session_register ($subject_title); session_register ($subject_title_manner); session_register ($subject_pay_source); session_register ($amortization_type); session_register ($lot_aquired); session_register ($lot_cost); session_register ($lot_liens); session_register ($lot_value); session_register ($lot_improve); session_register ($refi_aquired); session_register ($refi_cost); session_register ($refi_liens); session_register ($refi_purpose); session_register ($refi_desc_improve); session_register ($refi_cost); ?> <html> <head> <title><? echo $conf['name'],' - ',$app['name']; ?></title> <link rel="stylesheet" type="text/css" href="includes/styles/main.css"> </head> <body> <?php if ($step == '2') { echo "<form action=\"?step=3&sid=$PHPSESSID\" method=\"post\"> <table border=\"0\" cellspacing=\"2\" cellpadding=\"2\" width=\"600\" align=\"center\"> <tr> <td colspan=\"3\" id=\"header\">SECTION 2 - PROPERTY INFORMATION AND PURPOSE OF LOAN</td> </tr> <tr> <td id=\"field\" width=200 valign=\"middle\"> Subject Property Address<br> </td> <td width=5></td> <td id=\"input\"><input type=\"text\" value=\"\" name=\"subject_address\" size=\"80\"> </td> </tr> <tr> <td id=\"field\" width=200 valign=\"middle\"> County<br> </td> <td width=5></td> <td id=\"input\"><input type=\"text\" value=\"\" name=\"subject_county\" size=\"30\"> </td> </tr> <tr> <td id=\"field\" width=200 valign=\"middle\"> Number of Units<br> </td> <td width=5></td> <td id=\"input\"><input type=\"text\" value=\"\" name=\"subject_units\" size=\"10\"> </td> </tr> <tr> <td id=\"field\" width=200 valign=\"middle\"> Property Description<br> </td> <td width=5></td> <td id=\"input\"><input type=\"text\" value=\"\" name=\"subject_description\" size=\"80\"> </td> </tr> <tr> <td id=\"field\" width=200 valign=\"middle\"> Name(s) to be on title<br> </td> <td width=5></td> <td id=\"input\"><input type=\"text\" value=\"\" name=\"subject_title\" size=\"50\"> </td> </tr> <tr> <td id=\"field\" width=200 valign=\"middle\"> Manner in which title will be held<br> </td> <td width=5></td> <td id=\"input\"><input type=\"text\" value=\"\" name=\"subject_title_manner\" size=\"10\"> </td> </tr> <tr> <td id=\"field\" width=200 valign=\"middle\"> Source of Down Payment<br> </td> <td width=5></td> <td id=\"input\"><input type=\"text\" value=\"\" name=\"subject_pay_source\" size=\"80\"> </td> </tr> <tr> <td id=\"field\" width=200 valign=\"middle\"> Estate will be held in?<br> </td> <td width=5></td> <td id=\"input\"> <select name=\"amortization_type\"> <option value=\"\">Select Hold Type <option value=\"Fee Simple\">Fee Simple <option value=\"Lease Hold\">Lease Hold </SELECT> </td> </tr> <tr> <td id=\"input\" valign=\"middle\" colspan=\"3\" align=\"center\"> NOTE: Please only complete this section if consturction or construction-permanent loan<br> </td> </tr> <tr> <td id=\"field\" width=200 valign=\"middle\"> Year Lot Aquired<br> </td> <td width=5></td> <td id=\"input\"><input type=\"text\" value=\"\" name=\"lot_aquired\" size=\"5\"> </td> </tr> <tr> <td id=\"field\" width=200 valign=\"middle\"> Origional Cost<br> </td> <td width=5></td> <td id=\"input\"><input type=\"text\" value=\"\" name=\"lot_cost\" size=\"10\"> </td> </tr> <tr> <td id=\"field\" width=200 valign=\"middle\"> Amount of Existing Liens<br> </td> <td width=5></td> <td id=\"input\"><input type=\"text\" value=\"\" name=\"lot_liens\" size=\"10\"> </td> </tr> <tr> <td id=\"field\" width=200 valign=\"middle\"> A. Present Value of lot<br> </td> <td width=5></td> <td id=\"input\"><input type=\"text\" value=\"\" name=\"lot_value\" size=\"10\"> </td> </tr> <tr> <td id=\"field\" width=200 valign=\"middle\"> B. Cost of Improvements<br> </td> <td width=5></td> <td id=\"input\"><input type=\"text\" value=\"\" name=\"lot_improve\" size=\"10\"> </td> </tr> <tr> <td id=\"field\" width=200 valign=\"middle\"> Total (A + B)<br> </td> <td width=5></td> <td id=\"input\"><input type=\"text\" value=\"\" name=\"lot_aquired\" size=\"10\"> </td> </tr><tr> <td id=\"input\" valign=\"middle\" colspan=\"3\" align=\"center\"> NOTE: Please only complete this section if this is a refiance loan </td> </tr> <tr> <td id=\"field\" width=200 valign=\"middle\"> Year Lot Aquired<br> </td> <td width=5></td> <td id=\"input\"><input type=\"text\" value=\"\" name=\"refi_aquired\" size=\"5\"> </td> </tr> <tr> <td id=\"field\" width=200 valign=\"middle\"> Origional Cost<br> </td> <td width=5></td> <td id=\"input\"><input type=\"text\" value=\"\" name=\"refi_cost\" size=\"10\"> </td> </tr> <tr> <td id=\"field\" width=200 valign=\"middle\"> Amount of Existing Liens<br> </td> <td width=5></td> <td id=\"input\"><input type=\"text\" value=\"\" name=\"refi_liens\" size=\"10\"> </td> </tr> <tr> <td id=\"field\" width=200 valign=\"middle\"> Purpose of Refinance<br> </td> <td width=5></td> <td id=\"input\"><input type=\"text\" value=\"\" name=\"refi_purose\" size=\"10\"> </td> </tr> <tr> <td id=\"field\" width=200 valign=\"middle\"> Description of Improvements<br> </td> <td width=5></td> <td id=\"input\"><textarea value=\"\" name=\"refi_desc_improve\" rows=\"2\" cols=\"40\"></textarea> </td> </tr> <tr> <td id=\"field\" width=200 valign=\"middle\"> Cost of Improvements<br> </td> <td width=5></td> <td id=\"input\"><input type=\"text\" value=\"\" name=\"refi_cost\" size=\"10\"> </td> </tr> <tr> <td id=\"input\" align=\"center\" colspan=\"3\"> <input type=\"submit\" value=\"Submit\"></td> </tr> </table>"; } if ($step == '3') { echo $lot_cost; } else if ($step < 2) { echo "<form action=\"?step=2&sid=$PHPSESSID\" method=\"post\"> <table border=\"0\" cellspacing=\"2\" cellpadding=\"2\" width=\"600\" align=\"center\"> <tr> <td colspan=\"3\" id=\"header\">SECTION 1 - TYPE OF MORTGAGE AND TERMS OF LOAN</td> </tr> <tr> <td id=\"field\" width=200 valign=\"middle\">Mortgage Type</td> <td width=5></td> <td id=\"input\"> <select name=\"morgage_type\"> <option value=\"\">Select A Mortgage Type <option value=\"VA\">VA <option value=\"FHA\">FHA <option value=\"Conventional\">Conventional <option value=\"USDA/Rural Housing Service\">USDA/Rural Housing Service <option value=\"Other\">Other </SELECT> </td> </tr> <tr> <td id=\"field\" width=200 valign=\"middle\">Loan Amount</td> <td width=5></td> <td id=\"input\"><input type=\"text\" value=\"\" size=\"15\" name=\"loan_amount\"></td> </tr> <tr> <td id=\"field\" width=200 valign=\"middle\">Loan Term</td> <td width=5></td> <td id=\"input\"> <select name=\"loan_term\"> <option value=\"\">Select A Loan Term <option value=\"5 Year\">5 Year <option value=\"10 Year\">10 Year <option value=\"15 Year\">15 Year <option value=\"20 Year\">20 Year <option value=\"25 Year\">25 Year <option value=\"30 Year\">30 Year </SELECT></td> </tr> <tr> <td id=\"field\" width=200 valign=\"middle\">Amortization Type</td> <td width=5></td> <td id=\"input\"> <select name=\"amortization_type\"> <option value=\"\">Select Amortization Type <option value=\"Fixed Rate\">Fixed Rate <option value=\"GPM\">GPM <option value=\"ARM\">ARM <option value=\"Other\">Other </SELECT> </td> </tr> <tr> <td id=\"input\" align=\"center\" colspan=\"3\"> <input type=\"submit\" value=\"Submit\"></td> </tr> </table>"; } ?> </form> </body> </html>[/code]