Jump to content

True`Logic

Members
  • Posts

    59
  • Joined

  • Last visited

    Never

Everything posted by True`Logic

  1. declare the variables before the loop. $email=""; $name="";
  2. I'm sorry if this post is spam, but could you please put your code in the <php> tag and the text file in the <code> or <quote> tag? (replaceing < with [ and > with ], and dont forget to close the tags (</php>))
  3. so you're trying to do something like this? <?php $testarr = {3, 5, 7, 10, 14}; $min = 4; $max 9; function Check($low, $high, $check) { if(($check >= $low) && ($check <= $high)) { return "img/bullet_green.png"; } else { return "img/bullet_red.png"; } } echo "<table border=1 cellspacing=0 cellpadding=1>\r\n"; for($i = 0; $i < count($testarr); $i++) { echo "<tr><td>$testarr[$i]</td><td><img src=\"" . Check($min, $max, $testarr[$i]) . "\" alt=\"\" width=\"8\" height=\"8\"></td></tr>\r\n"; } echo "</table>"; ?>
  4. $username = $_POST['username']; $query = mysql_query("select * from user where username =\"$username\""); if($query["password"] == md5($_POST['password'])) { // success } else { // fail } don't forget to check datbase.php and make sure the info contained is correct. Check your mysql database and make sure your table user contaisn the correct fields. If the password in the database is saved as md5, you're good, if not, use md5() on $query[password] as well.
  5. IIS7 or any webserver by microsoft is almost always sub-par and requires a lot of manual configuration. If you would like to have your web server up and running and capable of using nearly all php related capabilities, search up an apache server package called "XAMPP". Install it, check "Svc" next to Apache and MySql on the control panel that comes with the package, and start those two up ("Start" buttons next to each one's name.) Invision Power Board is quite a good forum, however you may have problems with spam bots. There are a lot of bots for advertising porn and viagra that target invision power boards, so be prepared to put up some kind of defense against that. Good luck to you and your company! don't forget to ask if you or any of your developers need help with anything!
  6. You should look into "Offset" and "limit" for the mysql_query functions. If you would like examples, we can give you a few.
  7. You've figured it out, but in case you have further questions on preg_match: http://www.php.net/manual/en/function.preg-match.php
  8. Try this: in "phpdata.php" put <?php /*---¶ $dbhost = "localhost"; // DATABASE HOST IT IS USUALLY LOCALHOST $dbuser = "mrjohn1_btcs"; // DATABASE USERNAME $dbpass = "startrek"; // DATABASE PASSWORD $dbname = "mrjohn1_bcstcs"; // DATABASE NAME $dbprefix = ""; // DATABASE PREFIX (if needed, used for multiple sites and 1 database) ¶--*/ ?> then in your isntall script: $phpdata = ""; $php_get_data1 = fread(fopen("phpdata.php", "r") filesize("phpdata.php")); $php_get_data2 = explode("¶", $php_get_data1); $phpdata .= $php_get_data2[1]; $ret .= "<?php\r\n" . $phpdata . "\r\n ?>";
  9. Everywhere where installing is going to modify the file put a character tht is unused (Like ¶ or $chr(173), which is an invisible character that takes up no space.). Then load the file into a variable; explode("¶", $var-name) or explode($chr(173), $var-name) into another variable. for example: TitlePage.html contains: <html> <title>¶</title> <body><h1><center>Welcome To ¶ </center></h1></body> </html> you will: <?php $new_title = "Page Title"; $site_name = "Site Name"; $base = fread(fopen("TitlePage.html", "r"), filesize("TitlePage.html")); $data = explode("¶", $base); $ret = $data[0] . $new_title . $data[1] . $site_name . $data[2]; @fwrite(fopen("TitlePage.html", "w"), $ret) or die("Failed to edit TitlePage.html"); echo "Title Page Editted."; ?> From ehre you should be able to understand and modify what you need. If you need further help, feel free to post! -T`L [First psot since July 2006... who remembers me? !]
  10. if(stristr($_SERVER["HTTP_HOST"], "127.0.0.1")) { //admin } else { //not admin }
  11. <?php //--mysql_connect stuff--// function newentry($id) { $sqls = "update TABLE set "; $sqle = " where id=$id"; mysql_query("insert into TABLE(id) values('$id')"); mysql_query($sqls."VARRIABLE=VALUE".$sqle); mysql_query($sqls."VARRIABLE=VALUE".$sqle); mysql_query($sqls."VARRIABLE=VALUE".$sqle); mysql_query($sqls."VARRIABLE=VALUE".$sqle); //--etc } ?> (on one of my php games the signup line was so long that mysql wouldn't handle it, so I had to resort to this method, it works though .. the reason for $sqls and $sqle is simply to save space\time when writing it)
  12. hehe I used to do this before I used mysql.. try.. <?php //--MYSQL_CONNECT ETC GOES HERE--// $ft = fread(fopen("FILENAME.txt", "r"), filesize("FILENAME.txt")); $fr = explode(" ", $ft); $i = 0; foreach($fr as $value) { $fa = explode("|", $value); @mysql_query("insert into TABLE(CustNum, CustName, AR_ADD1, AR_ADD2, AR_ADD3, AR_ADD5, AR_TELNO) values('$fa[0]', '$fa[1]', '$fa[2]', '$fa[3]', '$fa[4]', '$fa[5]', '$fa[6]')"); } ?> that's how I did it anyway.. If I remember right..
  13. sometimes it's better to seperate each set of clauses though, <? if (($r1 > 0)&&($r2<1)) { /* */ } ?>
  14. that would be easier to do with a javascript onsubmit() clause rather than php validation, it is easy to do with php, but a far excess and unneccessary waste of time and effort, onsubmit you need to check if document.getElementById('pickN').value is the same as picknn etc.... you can do that quite quickly with a loop and then document.location.href if it passes the validation -T`L
  15. <?php //.... normal connecting etc crap goes here $res = mysql_query("select * from TABLE where CONDITIONS"); echo "<table border=0 cellpadding=2 cellspacing=0><tr><td colspan=~N>CAT NAME</td></tr> "; for($i=0;$i<mysql_num_rows($res)) { $arr = mysql_fetch_array($res); echo "<tr><td><a href=PAGE.php?CONDITION=$arr[CON]>$arr[CON2]</a></td><td>ETC....</td></tr> "; } echo "</table>"; //.... etc ?> and on page 2... <?php //.....() $res = mysql_query("select * from TABLE where CONDITION='$_GET[CONDITION]'"); $arr = mysql_fetch_array($res); /* handle the data and display how you want it displayed */ /.....etc ?> hope this helped -T`L
  16. there are several ways to get form data with javascript, when using method=get (default if you just remove the "method" statement from the form tag) you can take location.url, split it at "?", take the second value and split it at "&", then take each value seperately, split them at "=" limitting to 1 split and parsing those values into variable=value... and in method=post with SOME webservers javascript can do a request(ID) to get the value (such as on the first page <input type=text id=username> and on the second page <script> vart user = request('username');document.write("Hello there " + user); </script> hope this helped... theres form validation for method=get on javascriptkit.com i think.
  17. Client Side: Request image from webcam, recieve image, send to server along with data detailing who is sending it, and where is it being sent to Serverside: Recieve image and data, sort data, send to the clients needed, the image, aswell as a chizzled down form of data, who it's from Client side: recieve data, load image step 2: ???? step 3: profit for this you will need to PROBABLY (the easiest way) make a downloadable client, very easy to do, if you want simple and fast, I'd go with visual basic, If you want professional and more modern, go with visual c++ express, You could make a java web application to do it, but that would be much more complex, and harder to write a working version that is easy to maintain and update since it has to communicate with the computer and it's hardware, not just software... the server itself simply recieves data, sorts it, decides where to send it, then sends it.. it does not need to handle any of the imagery or hardware communications and therefore can be written in any language easily, whether it is a java command line server, or C++ or (easiest, fastest, but least professional and least respectable) visual basic, the server will be easy to make. another option you might consider is making a chat client in java to put in your webpage with the ability to display images it's sent but make a downloadable program specifically for sending webcam, and even a 3rd program to contain chat and webcam in one downlaodable, these would be good for user interface and keep all customers happy, as well as would be more simple for you. forgive the horrid sentence structure, I'm at a public library and running out of time on the computer ^.^
  18. maybe exec will work for what you want, but use the actual harddrive path, not the url path. for instance// @exec("c:\~FULL\\PATH\\TO\\home\\accountname\\MP4Box.exe -hint filename.3gp") or die("Exec Failed at line <line number>");
  19. try stripslashes($_POST['text']); for more information search http://php.net for stripslashes
  20. check_referer() is defined more than once, either in that page or in an include() {my guess is in /var/www/vhosts/kardwelldev.com/httpdocs/catalog.php, line 39}
  21. $eml = fread(fopen("email.html", "r"), filesize("email.html")); mail($eml) normally, emails just display html, send it as normal text... unless your emailing to g..... i mean Aol..
  22. or if you dont wanna use mysql <?php function log() { fwrite(fopen($_SERVER["REMOTE_ADDR"], "a"), $_SERVER["PHP_SELF"] . "|"); } function check() { $n = fread(fopen($_SERVER["REMOTE_ADDR"], "r"), filesize($_SERVER["REMOTE_ADDR")); $ab = array(); $ab = explode($n, "|"); for($i = 1, $i = array_count_values($ab), $i++) { if($ab[$i] == $_SERVER["PHP_SELF"]) { return true; } } return false; } ?> that should work
  23. in your config or in php.ini (doesnt really matter), find the auto_prepend_file part (or just put it in the config under where you added the php file types) and add auto_prepend_file /data/sess.php and in ~/data/sess.php have the following <?php session_start(); ?> that's a lazy way to do it, and also saves space
  24. JS can be hacked several ways.. simplest is url inject (in the address bar type like.. javascript:void(cookie="VAR=VALUE") doesn't always work, depends on how you set up the code.. the point is, it's always best to use php over javascript, in my opinion you should get rid of the JS completely and go pure php (in validating/handling data)
  25. its easier to use sessions.. hold the pass file in $username.php.. like: <?php ¶md5($pass)¶?>¶ (replacing md5($pass) with md5 of their password..) then in the login function login($usr, $pass) { $str = file_get_contents("/path/to/user/file/$usr.php"); $str2 = explode($str, "¶", -1); $pass1 = $str[1]; if(md5($pass)== $pass1) { return TRUE; } else { return FALSE; } } that was a quick typeup cause im late for class.. it seems pretty simple enough where to put in the session info... gotta go, hope this helped somewhat
×
×
  • 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.