Jump to content

jpmad4it

Members
  • Posts

    21
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

jpmad4it's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi all, I have a form that I need to create using data that is held in a MySQL database. I need to select the data, format it and output the form inputs in a smarty tag. Here is the data structure: name alias extra Class class options[Dancercise=Dancercise,Abs / Mega Abs Blast=Abs / Mega Abs Blast,exercise 3 = exercise 3, exercise 4 = exercise 4] Centre centre options[sports centre 1=Sports centre 1,Sports centre 2=Sports centre 2,Sports centre 3=Sports centre 3,Sports centre 4=Sports centre 4] Day day options[Monday=Monday,Tuesday=Tuesday,Wednesday=Wednesday,Thursday=Thursday,Friday=Friday, Saturday=Saturday,Sunday=Sunday] Start Time startime options[06:00=06:00,06:15=06:15,06:30=06:30,06:45=06:45,07:00=07:00,07:15=07:15,07:30=07:30,07:45=07:45,08:00=08:00,08:15=08:15,08:30=08:30,08:45=08:45,09:00=09:00,09:15=09:15,09:30=09:30,09:45=09:45,10:00=10:00,10:15=10:15,10:30=10:30,10:45=10:45,11:00=11:00,11:15=11:15,11:30=11:30,11:45=11:45,12:00=12:00,12:15=12:15,12:30=12:30,12:45=12:45,13:00=13:00,13:15=13:15,13:30=13:30,13:45=13:45,14:00=14:00,14:15=14:15,14:30=14:30,14:45=14:45,15:00=15:00,15:15=15:15,15:30=15:30,15:45=15:45,16:00=16:00,16:15=16:15,16:30=16:30,16:45=16:45,17:00=17:00,17:15=17:15,17:30=17:30,17:45=17:45,18:00=18:00,18:15=18:15,18:30=18:30,18:45=18:45,19:00=19:00,19:15=19:15,19:30=19:30,19:45=19:45,20:00=20:00,20:15=20:15,20:30=20:30,20:45=20:45,21:00=21:00,21:15=21:15,21:30=21:30,21:45=21:45,22:00=22:00,22:15=22:15,22:30=22:30] End Time endtime options[06:00=06:00,06:15=06:15,06:30=06:30,06:45=06:45,07:00=07:00,07:15=07:15,07:30=07:30,07:45=07:45,08:00=08:00,08:15=08:15,08:30=08:30,08:45=08:45,09:00=09:00,09:15=09:15,09:30=09:30,09:45=09:45,10:00=10:00,10:15=10:15,10:30=10:30,10:45=10:45,11:00=11:00,11:15=11:15,11:30=11:30,11:45=11:45,12:00=12:00,12:15=12:15,12:30=12:30,12:45=12:45,13:00=13:00,13:15=13:15,13:30=13:30,13:45=13:45,14:00=14:00,14:15=14:15,14:30=14:30,14:45=14:45,15:00=15:00,15:15=15:15,15:30=15:30,15:45=15:45,16:00=16:00,16:15=16:15,16:30=16:30,16:45=16:45,17:00=17:00,17:15=17:15,17:30=17:30,17:45=17:45,18:00=18:00,18:15=18:15,18:30=18:30,18:45=18:45,19:00=19:00,19:15=19:15,19:30=19:30,19:45=19:45,20:00=20:00,20:15=20:15,20:30=20:30,20:45=20:45,21:00=21:00,21:15=21:15,21:30=21:30,21:45=21:45,22:00=22:00,22:15=22:15,22:30=22:30] I have got so far with creating the form within my script: /** * PHP Database Connection * * Allows a CMS website to connect to the MYSQL * Database to return live data for Interactive * Search fields. * * Returns result as a smarty variable. * * */ $server = "mp.server.ip"; $u = "user"; $p = "pass"; $db = "db"; $field = "extra"; // Connect $connection = mysql_connect($server, $u, $p) or die("Couldn’t connect to SQL Server on $server"); // Select Database $selected = mysql_select_db($db, $connection) or die("Couldn’t open database $db"); // Field to select $query = "SELECT $field"; // Table and conditions should generally remain the same, barring chain ID. $query .= "FROM cms_module_listit2cloneinteractivesearch_fielddef"; $query .= "WHERE alias = 'class'"; // Execute the SQL Query $result = mysql_query($query); // Build select options from results $data = ''; while($row = mssql_fetch_array($result)) { $rowdata = $row['extra']; $data .= "<option value=\"$rowdata\">" . ucwords(strtolower($rowdata)) . "</option>"; //echo "<option value=\"$rowdata\">" . ucwords(strtolower($rowdata)) . "</option>"; } $smarty->assign('type', $data); //close the connection mysql_close($connection); This doesn't seem to do anything though. I don't know if there is an error somewhere in my script, or whether it is freaking out at the data that is contained in the "extra" field because I am not doing anything with it to get it into the options correctly. Can anyone help me figure this out? I am basically trying to create select drop-downs for all of the fields, and output the data in "extra" as the <option value=""> for each field. Any help will be greatly appreciated. Kind regards Jp
  2. ODBC and PHP go together well don't they? Or have I just assumed that over the years! JDBC is similar to ODBC. ODBC is open database connectivity. So I guess it works with a range of scripting languages. Nice definittion for JDBC: Java Database Connectivity. Java API that enables Java programs to execute SQL statements. This allows Java programs to interact with any SQL-compliant database. Since nearly all relational database management systems (DBMSs) support SQL, and because Java itself runs on most platforms, JDBC makes it possible to write a single database application that can run on different platforms and interact with different DBMSs. JDBC is similar to ODBC, but is designed specifically for Java programs, whereas ODBC is language-independent. JDBC was developed by JavaSoft, a subsidiary of Sun Microsystems. See ODBC. So it looks like it is designed for Java (as I thought).
  3. so JDBC and PHP are not really meant to be used together? Just java languages?
  4. We can use ODBC, but it involves adding new software to our mainframe, which will take quite a long time. Trust me, this is simple compared to other options lol. I know that JDBC connects to our mainframe via TCP/IP.....but after that I get confused with java clients, servers, platforms etc. I think that if we can use PHP, all that will happen is that we connect to JDBC using PHP, and then query our database to gather info -> and display it on the web. I just can't see it being that simple? I think there are more steps required when connecting PHP to JDBC, and I also need to know if there are limitations of using PHP with JDBC.
  5. i know!!! Its a nightmare! I found this image which may help:
  6. Hi there, At present, our I.T. department are exploring different methods of connecting to our IDMS database via the internet. We have realised that we could use an alternative to ODBC drivers to connect to our IDMS database. The alternative is JDBC Type 4 drivers. If we have to use ODBC drivers, it means we are going to have to set up a lot of new software on our mainframe which will be a lengthy process. If we use JDBC, we may be able to establish a connection with our IDMS database a lot sooner than if we were to use ODBC. It all depends upon the pros and cons of both ODBC and JDBC. So, can JDBC be connected to through PHP, ASP, etc.........or does it have to be connected to via JSP and Java? Will using JDBC limit which scripting technologies we can use? If connecting to JDBC via PHP, ASP etc is possible, is it a tricky process? Or is it relatively straight forward? What does it involve? Will using JDBC limit what kind of applications we can build? Or is it just as flexible as ODBC? We don't want rush ahead and implement the use of JDBC without checking with first. Even though it may be quicker to set up JDBC initially, there may be complications that pop-up further down the line that some of you may be aware of? Also, the way that we set up the connection to our database mentions these 3 possible routes: 1) TCP/IP connects to the Type 4 JDBC driver, which resides on the Java Platform. 2) Type 4 JDBC driver connects to a servlet, which connects to web server (these also reside on the Java Platform) 3) The web server then connects to an applet on the browser client. When it says any Java Platform, does this mean Windows, Linux etc? And then where it says it connects to an applet on the browser client, does that mean it connects to the internet browser? I am a little confused. Another route is as follows: 1) TCP/IP connects to the Type 4 JDBC driver, which resides on the Java Client. 2) The Type 4 JDBC driver then connects directly to the applet, which also resides on the Java Client. What is a Java Client? The final route is using JDBC type 3 drivers. It says that to use these drivers, we must have a JDBC Server which is located on the Java Platform. It connects this way: 1) TCP/IP connects to the JDBC server, which resides on the Java Platform. 2) The JDBC server connects to the Type 3 JDBC driver, which resides on the browser client. 3) The type 3 ODBC driver then connects to an applet on the browser client. I am so stumped by all this. Can anyone help clarify all this for me??? Any advice on this subject would be great. Thank you.
  7. Hi there This is a bit of a strange issue, well it is to me being a newbie lol. I'll start with my code: <? $num=3; $width=100/$num; $cnt=0; $items="<table border='0' cellpadding='0' cellspacing='0' align='center'><tr>"; $taa=0; if(mysql_num_rows($online_sql) > 0) { while ($online = mysql_fetch_array($online_sql)) { $taa++; if ($cnt==$num){ $items.="</tr><tr>"; $cnt=0; } $items.="<td style='padding-bottom:20px; padding-right:20px;'> <table class='border' bgcolor='#000000'> <tbody> <tr> <td style='height:190px;'><a href='".processLink($online["product_id"], $online["name"])."'><img alt='".$online["name"]."' border=0 src='makethumb.php?pic=product_images/".$online["filename"]."&w=122&sq=N' /></a><br /><div align='center'><a href='".processLink($online["product_id"], $online["name"])."'>".$online["name"]."</a> </td> </tr> </tbody> </table> </td>"; $cnt++; $items.="</tr></tbody></table>"; print $items; } } else { print "<center>We're sorry, but no one is online </center>"; } ?> <? if (!isset($_GET["id"])) $_GET["id"]=''; if ($_GET["id"]!=''){ require "profiles.php"; } else { $engine->load(); } ?> This code is contained in my index.php file. What it does is grab the data from the database to display pictures of people who are online. It also creates a link over the image, which once clicked loads up that persons profile. I think that the profile is loaded by this code: $engine->load(); which is shown in the above code. I think it calls a module and essentially includes a PHP file (which holds the profile for the person). The link to the profile is in this format: http://www.mysite.com/JONATHAN,217. I guess that its getting the user name and ID? The problem is that the profile is being loaded directly into the index.php file underneath all the images. What I need to do is try to clear the images first, and then load the profile, all within the index.php page, or on a separate page. It just looks a mess when the profile is loaded underneath the images. I tried to add some kind of page counter, but realised that wouldn't work. Could I not add the above code to the link that is processed using 'onclick' and call a separate file called user_profile.php? My problem is getting the data into a link format using PHP. Or maybe use the $engine->load(); within the link? Or does anyone have any better ideas? I'm sure there must be something else I can do, for example, is there no function to load a php file in the else statement, or redirect to another file? Any help would be great. kind regards Jonathan
  8. Hi there, I am trying to incorporate Advanced Login System into my site, but I keep getting errors such as: Notice: Undefined index: REMOTE_HOST in /my_root_path/htdocs/login.inc.php on line 229 Notice: Undefined index: rmbpw in /my_root_path/htdocs/login.inc.php on line 102 Notice: Undefined variable: _SESSION in /my_root_path/htdocs/login.inc.php on line 51 Notice: Undefined index: HTTP_REFERER in /my_root_path/htdocs/login.inc.php on line 56 There is no problem with the system if I place it straight onto the server "as is". The problems started when I tried to include the main content of the login file as an "inc.php" file. What I have done is taken the original index.php file of the system and placed <?php include ('login.inc.php'); ?> so that the login system is included as a separate file. This gives me the file login.php, which has the style of the original site with the login form included in it. I think that maybe some code is conflicting from the original system with the login code. Here is the code for login.php: <?php session_start(); error_reporting(E_ALL); include_once ("config/config.php"); include_once('libs/phemplate.class.inc'); include_once('libs/vilkmerge.class.inc'); include_once('libs/catalog.class.inc'); $engine = new vilkmerge(); $catalog = new Catalog(); $banners = new banners(); include('inc/tpl.inc'); // gathering top menus from database $sql="SELECT M.id, M.parent, N.name, M.hover_title, M.meta_description, N.lang, M.theorder FROM menu M INNER JOIN menu_names N ON M.id = N.menu_id AND N.lang = 'lithuanian' ORDER BY M.theorder ASC"; $get_header_menu=mysql_query($sql); $menu_number=mysql_num_rows($get_header_menu); $menu_width =round(100/$menu_number); $menu_contents=''; $menu_contents.='<table cellpadding="1" width="900px" cellspacing="1"><tbody><tr>'; while ($list_menu=mysql_fetch_array($get_header_menu)){ $menu_contents.='<td width="'.$menu_width.'%"><div align="center"> <a href="'.processLink2($list_menu["id"],$list_menu["name"]).'">'.$list_menu["name"].'</a></div></td>'; } $menu_contents.='</tr></tbody></table>'; // end of top menu gathering // random featured girls $random_girl=mysql_fetch_array(mysql_query("SELECT PI.product_id, P.name, PI.filename FROM product_images PI INNER JOIN products P ON PI.product_id=P.id WHERE P.featured=1 GROUP BY P.name ORDER BY RAND() LIMIT 1")); if ($random_girl){ $featured_girl='<table width="100%" border="0" cellpadding="0" cellspacing="0" class="border" bgcolor="#D83C85"><tr><td height="20" align="center"><strong>Featured Escort</strong></td></tr><tr><td align="center" style=" font-family:Verdana, Arial, Helvetica, sans-serif; font-size:11px; color:#FFFFFF;"> <a href="'.processLink($random_girl["product_id"], $random_girl["name"]).'"><img border=0 src="makethumb.php?pic=product_images/'.$random_girl["filename"].'&w=145&sq=N" /></a></td></tr><tr><td align="center" style=" padding-bottom:5px; padding-top:5px; color:#FFFFFF;"><strong>'.$random_girl["name"].'</strong></td></tr></table> <br>'; } else { $featured_girl=''; } // collecting left menu $query = mysql_query("SELECT * FROM catalog WHERE lang='lithuanian' ORDER BY `theorder` "); $left_menu=''; while ($row = mysql_fetch_array($query)) { if ($row["parent"]!='0'){ $left_menu.= "d.add(".$row["id"].",".$row["parent"].",'".$row["name"]."','".processLink1($row["id"], $row["name"])."'); \n"; }else { $left_menu.= "d.add(".$row["id"].",".$row["parent"].",'".$row["name"]."',''); \n"; } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <? $new_title=$setts['sitename']; if(isset($_GET["product"])){ $title=mysql_fetch_array(mysql_query("SELECT name, id FROM products WHERE id='".$_GET["product"]."'")); $details=mysql_query("SELECT CF.theorder, PD.field_id, PD.text, CF.name FROM product_details PD LEFT JOIN catalog_fields CF ON CF.id=PD.field_id WHERE PD.product_id='".$title["id"]."' GROUP BY CF.theorder"); $new_title=$setts['sitename']." ".$title["name"]; while ($list_title=mysql_fetch_array($details)){ $new_title.="-".$list_title["name"]."-".$list_title["text"]; } }?> <title> <?=$new_title;?> </title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="css/main.css" /> <script type="text/javascript" src="/js/stuff/site_stuff.js"></script> <script type='text/javascript' src='js/dtree.js'></script> <meta name="Keywords" content="" /> <meta name="Description" content="" /> <meta name="rating" content="general" /> <meta name="distribution" content="global" /> <meta name="robots" content="index, follow" /> <meta name="revisit-after" content="5 days" /> </head> <body lang="en" xml:lang="en"> <div id="header_container"> <div id="top_menu_container"> <ul id="top_menu_nav"> <li> <div class="header"> <?=$menu_contents;?> </div> </li> </ul> </div> <img src="images/header_top.jpg" width="900" height="190" /></div> <div id="main_container"> <div id="content_container"> <div id="left_container"> <div class="button"> <script type="text/javascript"> d = new dTree('d'); d.add(0,-1,'ALL ESCORTS GALLERY','index.php?id=all'); <?=$left_menu;?> document.write(d); </script> </div> <div class="button2"> <? include "newest.php";?> </div> </div> <div id="top_container_right"> <div class="text_box"> <div align="center"><a href="work.php">EMPLOYMENT</a></div> </div> <div class="bigTArea"> <p align="center"> <?=$featured_girl;?> </p> <p align="center"> </p> <form action="search_girls.php" method="post"> <table width="100%" border="0" cellpadding="0" cellspacing="0" class="search_box"> <tr > <td><div class="text_box" align="center">ADVANCED SEARCH</div></td> </tr> <tr> <td class="search_box" style="search_box"><?php $catalog->searchbox(); ?> <p align="center"> <input type="submit" name="make_filter" value="Search" /> <br /> <br /> </p></td> </tr> </table> </form> </p> </div> </div> <div id="middle"> <?php include ('login.inc.php'); ?> </div> </div> </div> <?php include('footer.php'); ?> </div> </body> </html> As you can see the login.inc.php is included in the file above. Now here is the code for login.inc.php: <?php /* DO NOT EDIT THIS FILE UNLESS YOU KNOW WHAT YOU ARE DOING! */ /* login.php */ //this function disables errors when header code is not on the 1st line of code. ob_start(); //include the configuration file. fatal error if file doesn't exist require ("config/config_log.php"); //checking of sql database $check_db = "SELECT * FROM ".$mysql_pretext."_users"; $check_db2 = "SELECT * FROM ".$mysql_pretext."_logins"; if (!mysql_query ($check_db) || !mysql_query ($check_db2)) { //if tables doesn't exist,then install the tables include ("install.php"); } else { //checking of install file if (file_exists ("install.php")) die ("<font color=\"red\">FATAL ERROR. INSTALL.PHP EXISTS! POSSIBLE SECURITY RISK! TERMINATING PROGRAM</font>"); } //session_start(); //begin to wipe datebase entries if ($development == TRUE) { //chance the time between 3 failed login attempts and another login attempt to 10 seconds only //for developmental user $timeframe = time() - 10; } else { $timeframe = time() - 15*60; } $command = "DELETE FROM ".$mysql_pretext."_logins WHERE lastattempt < '".$timeframe."'"; mysql_query ($command) or die(mysql_error()); //check if the use is logged in 1st. If not logged in,why bother logging them out? if (isset ($_SESSION['loggedin']) && isset ($_SESSION['time'])) { //destroys the login sessions unset ($_SESSION); session_destroy(); //set the last IP $command = "UPDATE ".$mysql_pretext."_users SET lastip='$_SERVER[REMOTE_ADDR]' WHERE username='$_SESSION[loggedin]'"; mysql_query ($command) or die (mysql_error()); print '<html><head><title>Logout</title></head><body>'; //get the link to return if ($_SERVER['HTTP_REFERER']) $link = $_SERVER['HTTP_REFERER']; else $link = $_SERVER['PHP_SELF']; print '<p align="center">You are logged out. Thank you for using Advanced Login System. A copy can be obtained from <a href="http://www.iqueststudios.com" target="_blank">www.iqueststudios.com</a></p><p align="center"><a href="'.$link.'">Continue</a></p>'; die(); } else if (isset($_POST['login'])) { //set the ip addr of the browser. combine the IP addr with the hostname and port number to reduce risks of two users with the same IP from different proxies from getting mixed up. //ipaddr is md5"ed" to prevent leakage of private information. $ipaddr = md5 ($_SERVER['REMOTE_ADDR'].$_SERVER['REMOTE_HOST'].$_SERVER['HTTP_USER_AGENT']); //get current timestamp //$time =date('U'); //check if there is already a log of the user in the database $mysql1 = "SELECT * FROM ".$mysql_pretext."_logins WHERE ipaddr='$ipaddr'"; $mysql2 = mysql_query ($mysql1) or die(mysql_error()); $mysql3 = mysql_fetch_array ($mysql2); //create a log of user if non existent if (!$mysql3) { $mysql2 = "INSERT INTO ".$mysql_pretext."_logins (ipaddr,tries,lastattempt,attuser,logexpire) VALUES ('$ipaddr',0,'0',0,0)"; mysql_query ($mysql2) or die (mysql_error()); //debug messages //print "You have been logged<br />"; //print $ipaddr.'<br />'; //print $time; } //if not, then create a log of the user else { $logged = 1; //debug messages //print "You were logged<br />"; //print $ipaddr.'<br />'; //print $time; } //link to stylesheet. change this to suit your own website print '<link rel="stylesheet" type="text/css" href="style.css" />'; //check if the anti hacking cookie is set or has reached its limit //$_COOKIE['tries'] = $mysql3['tries']; if (!isset ($myql3['tries']) || $mysql3['tries'] != '0') { //define all the vars in case the server don't support the use of global vars $username = strip_tags ($_POST['username']); $password = strip_tags ($_POST['password']); $rmbpw = $_POST['rmbpw']; //if there is need for image validation if ($display_bot_image_login) { $code = $_POST['code']; //$realcode = $_POST['realcode']; //?imgtxt=".base64_encode ($imgtxt)."\ //incorrect number $realcode = rawurldecode (base64_decode ($_SESSION['imgcode'])); $realcode = str_replace (' ' , '' ,$realcode); if (md5($code) != md5 ($realcode)) { //print $mysql3['lastattempt']; $expire = time()+(10); if ($mysql3['tries'] <= '3' && $mysql3['tries'] != 0) { //reduce the number of tries $tries = $mysql3['tries'] - 1; //print $tries; print '<p align="center">Invalid validation code.<b>'.$tries.'</b> tries left.</p><p align="center"><a href="'.$_SERVER['HTTP_REFERER'].'">Retry?</a></p>'; //setcookie ('tries', $tries, time()+900, '/', '', 0); $update1 = "UPDATE ".$mysql_pretext."_logins SET tries = '$tries',attuser='$username',lastattempt='".time()."',logexpire='$expire' WHERE ipaddr = '$ipaddr'"; $update2 = mysql_query ($update1) or die(mysql_error()); die(); } else// if ($mysql3['lastattempt'] == '0') { //set the cookie to hold the variable print '<p align="center">Invalid validation code.<b>3</b> tries left.</p><p align="center"><a href="'.$_SERVER['HTTP_REFERER'].'">Retry?</a></p>'; //setcookie ('tries', 3, time()+900, '/', '', 0); $update1 = "UPDATE ".$mysql_pretext."_logins SET tries = '3',attuser='$username',lastattempt='".time()."',logexpire='$expire' WHERE ipaddr = '$ipaddr'"; $update2 = mysql_query ($update1) or die(mysql_error()); die(); } /*else { print "ERROR CODE: 1"; die(); }*/ } //continue } //encode the password in the same encoding as that stored in the db $mpassword = md5($password); //search for the user. //check if there is need to validate the account and use suitable MySQL command if ($need_to_validate_acct == TRUE) { $search_login = "SELECT * FROM ".$mysql_pretext."_users WHERE username='$username' AND password='$mpassword' AND validated='1'"; } else { $search_login = "SELECT * FROM ".$mysql_pretext."_users WHERE username='$username' AND password='$mpassword'"; } $search_login2 = mysql_query ($search_login) or die (mysql_error()) ; $search_login3 = mysql_fetch_array ($search_login2); if ($search_login3) { //valid login! if (isset ($rmbpw)) { //set these cookie to remember the user next time he logs in. setcookie ('username', $username, time()+1209600, '/', '', 0); setcookie ('password', base64_encode ($password), time()+1209600, '/', '', 0); } //if don't wish to continue remembering username and password else if(empty ($rmbpw) && isset ($_COOKIE['username']) && isset ($_COOKIE['password'])) { //remove these cookie. setcookie ('username', '', time()-60, '/', '', 0); setcookie ('password', '', time()-60, '/', '', 0); } //start the sessions //the line is to be replaced on top line of page //session_start(); //remove the anti-hacking cookie-feature-redundant now //setcookie ('tries', '', time()-60, '/', '', 0); $_SESSION['loggedin'] = $_POST['username']; $_SESSION['time'] = time(); //header ('Location: '.$PHP_SELF); //exit; if ($development == TRUE) print "<meta http-equiv=\"Refresh\" content=\"5; url=".$PHP_SELF."\">"; else print "<meta http-equiv=\"Refresh\" content=\"0; url=".$PHP_SELF."\">"; } else { //invalid login! if ($mysql3['tries'] <= '3' && $mysql3['tries'] != 0) { //reduce the number of tries //$tries = $_COOKIE['tries'] - 1; $tries = $mysql3['tries'] - 1; print '<p align="center">Invalid username and password combination or non-activated account.<b>'.$tries.'</b> tries left.</p><p align="center"><a href="'.$_SERVER['HTTP_REFERER'].'">Retry?</a></p>'; //setcookie ('tries', $tries, time()+900, '/', '', 0); $update1 = "UPDATE ".$mysql_pretext."_logins SET tries = '$tries',attuser='$username',lastattempt='".time()."',logexpire='$expire' WHERE ipaddr = '$ipaddr'"; $update2 = mysql_query ($update1) or die(mysql_error()); die(); } else { //set the cookie to hold the variable print '<p align="center">Invalid username and password combination or non-activated account.<b>3</b> tries left.</p><p align="center"><a href="'.$_SERVER['HTTP_REFERER'].'">Retry?</a></p>'; //setcookie ('tries', 3, time()+900, '/', '', 0); $update1 = "UPDATE ".$mysql_pretext."_logins SET tries = '3',attuser='$username',lastattempt='".time()."',logexpire='$expire' WHERE ipaddr = '$ipaddr'"; $update2 = mysql_query ($update1) or die(mysql_error()); die(); } } } else { //block the computer from logging in print '<p align="center">You have entered invalid data for 3 times in a row. Please wait 15 minutes to try again.</p><p align="center"><a href="'.$_SERVER['HTTP_REFERER'].'">Retry?</a></p>'; } mysql_close(); } //if the user did not click login. else { //set the ip addr of the browser. combine the IP addr with the hostname and port number to reduce risks of two users with the same IP from different proxies from getting mixed up. //ipaddr is md5"ed" to prevent leakage of private information. $ipaddr = md5 ($_SERVER['REMOTE_ADDR'].$_SERVER['REMOTE_HOST'].$_SERVER['HTTP_USER_AGENT']); //get current timestamp $time =date('U'); //check if there is already a log of the user in the database $mysql1 = "SELECT * FROM ".$mysql_pretext."_logins WHERE ipaddr='$ipaddr'"; $mysql2 = mysql_query ($mysql1) or die(mysql_error()); $mysql3 = mysql_fetch_array ($mysql2); ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title></title> <!--<link rel="stylesheet" type="text/css" href="css/log_style.css" />--> <script type="text/javascript"> function popUp(URL) { day = new Date(); id = day.getTime(); eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=1,menubar=0,resizable=0,width=400,height=300,left = 337,top = 159');"); } </script> </head> <body> <center> </center> <table width="300" border="1" cellspacing="1px" cellpadding="5px" align="center" style="border-style:solid; border-width:2px; border-collapse:collapse;"> <tr bgcolor="#666666" height="25px"> <td><div class="log_heading">Login</div></td> </tr> <tr bgcolor="#410121" height="200"> <td valign="top"> <p>Welcome. Please login.</p> <p> </p> <form action="<?php //print $_SERVER['PHP_SELF']; ?>" method="post" name="login"> <p>Username: <input type="text" name="username" value="<?php if (isset ($_COOKIE['username'])){print $_COOKIE['username'];}?>" size="20" /> </p> <p><br /> Password: <input type="password" name="password" value="<?php if (isset ($_COOKIE['password'])){print base64_decode ($_COOKIE['password']);}?>" size="20" /> </p><br/> <?php if ($display_bot_image_login) { $img1 = rand (1,9); $img2 = rand (1,9); $img3 = rand (1,9); $img4 = rand (1,9); $imgtxt = $img1.'%20'.$img2.'%20'.$img3.'%20'.$img4; $_SESSION ['imgcode'] = base64_encode ($imgtxt); //print "<input type=\"hidden\" name=\"realcode\" value=\"".md5($imgtxt)."\" />"; print "Enter the number below: <input type=\"text\" name=\"code\" size=\"4\" maxlength=\"4\" /><br /><img src=\"makeimg.php\" /><br />"; print "<small>(<a href=\"#\" onClick=\"history.go()\">refresh</a> if you cannot see the number)</small><br />"; print "<br />"; } ?> Remember Pass? <input type="checkbox" name="rmbpw" <?php if (isset ($_COOKIE['password'])){print "checked=checked";} ?> /> <input type="submit" value="Login" name="login" <?php if ($mysql3['tries'] <= '0'&& $mysql3['lastattempt'] != 0 /* &&time() > $mysql3['logexpire']*/) {print 'disabled="disabled"'; } ?> /> </form> <? if ($allow_guest_to_register) { ?> <a href="#" onClick="popUp('register.php')">Register | </a> <? } ?> <a href="#" onClick="popUp('reset.php')">Forgot Password?</a> </td> </tr> </table> <hr align="center" width="400px" /> <div align="center">© iQuest Studios 2007</div> </body> </html> <?php } ob_end_flush(); ?> Sorry about the huge amount of code. Just a note, I have 2 config files. One for the login.php file and one for the login.inc.php file. Could this cause the errors? I have done a lot of research on google the errors given are usually corrected by fixing the (isset($_POST['login'])) to (isset($_GET['login'])). I tried this but it didnt work. If anyone can help I'd really appreciate this as its been driving me crazy at work for days now! Regards Jp
  9. Hey people! I have a PHP variable named flash, and within it I have the <object> element which creates the flash output. So whenever i call the variable i get the flash. Now the problem is that I am getting the "click to activate and use this control" box which I want to get rid of. So to do this I want to add the AC_RunActiveContent.js script to this variable. Is this possible? If so how do I write the code? This is the code I have already: $flash = "<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0\" width=\"157\" height=\"198\"> <param name=\"movie\" value=\"http://www.mysite.com/scroller.swf\"> <param name=\"quality\" value=\"high\"> <embed src=\"http://www.mysite.com/scroller.swf\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" width=\"157\" height=\"198\"></embed></object>"; Now here is the code I require to put in the $flash variable: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> <script language="javascript" type="text/javascript">AC_FL_RunContent = 0;</script> <script src="AC_RunActiveContent.js" language="javascript" type="text/javascript"></script> </head> <body> <script language="javascript" type="text/javascript"> if (AC_FL_RunContent == 0) { alert("This page requires AC_RunActiveContent.js. In Flash, run \"Apply Active Content Update\" in the Commands menu to copy AC_RunActiveContent.js to the HTML output folder."); } else { AC_FL_RunContent( 'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0', 'src', 'http://www.mysite.com/scroller', 'quality', 'high', 'pluginspage', 'https://www.macromedia.com/go/getflashplayer', 'play', 'true', 'loop', 'true', 'scale', 'showall', 'devicefont', 'false', 'bgcolor', '#ffffff', 'menu', 'true', 'allowScriptAccess','sameDomain', 'movie', 'http://www.mysite.com/scroller', 'class', '', 'salign', '' ); //end AC code } </script> <noscript> <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" class="Flash" title="team"> <param name="movie" value="http://www.mysite.com/scroller.swf" /> <param name="quality" value="high" /> <param name="wmode" value="opaque" /> <param name="allowScriptAccess" value="sameDomain" /> <embed src="http://www.mysite.com/scroller.swf" class="Flash" quality="high" wmode="opaque" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" allowScriptAccess="sameDomain"></embed> </object> </noscript> </body> </html> I'm not sure if I have to put all the <Html> tags etc in, but I do know that these 2 lines are required in the <head> tag: <script language="javascript" type="text/javascript">AC_FL_RunContent = 0;</script> <script src="AC_RunActiveContent.js" language="javascript" type="text/javascript"></script> Any help would be grrrrreeeeeeaaaaat!! Kind regards Jonathan :thumbsup:
  10. Hi everyone, I have a flash banner rotator that runs using PHP at the backend. The way in which the flash banner is called into the script is by using the following PHP: <? php include("http://www.mysite.com/banners"); ?> I have also used this in other ways such as: <?php $file = file_get_contents("http://www.mysite/banners"); ?> I am struggling to incorporate this into the <object> tag. Is there a way in which I can do this? Can I somehow get this to work in the <param name="movie"> tag? Or is there some other method that I can use? I should also mention that the file I am working with is a 'tpl' file. I do not think that these support PHP, but I may be wrong. Any help would be great as I am really struggling with this one. Kind regards, Jp
  11. ah ok cool, sorry for posting in the wrong thread !!
×
×
  • 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.