Jump to content

Mr_J

Members
  • Posts

    188
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Mr_J's Achievements

Regular Member

Regular Member (3/5)

0

Reputation

  1. Hi, When I login to my database, after I added an extra field on table, I get this warning: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/pharmacz/public_html/ads/inlogger.php on line 28 So I had another look at my code and I can't see anything wrong. So I searched google and the best article I could get is http://www.php.net/manual/en/function.mysql-num-rows.php Then I see it is a FUNCTION and I do not use my statement like the example shows This is line 28: $count=mysql_num_rows($result); //Must be 1 row this is all of the code: <?php $host="localhost"; $username="my_username"; $password="my_password"; $db_name="db_name"; $tbl_name="table_name"; mysql_connect("$host", "$username", "$password")or die("cannot connect to Server"); mysql_select_db("$db_name")or die("cannot select DATABASE"); $usr=$_POST['usr']; $pw=md5($_POST['pw']); $phname=$_POST['phname'];// To protect MySQL injection $type=$_POST['type']; $usr = stripslashes($usr); $pw = stripslashes($pw); $phname = stripslashes($phname); $type = stripslashes($type); $usr = mysql_real_escape_string($usr); $pw = mysql_real_escape_string($pw); $phname = mysql_real_escape_string($phname); $type = mysql_real_escape_string($type); $sql="SELECT * FROM $tbl_name WHERE username='$usr' and password='$pw' and phname='$phname' and type='$type'"; $result=mysql_query($sql); $count=mysql_num_rows($result); //must be 1 row if($count==1){ // Register $myusername, $mypassword and redirect to file session_register("usr"); session_register("pw"); session_register("phname"); session_register("type"); header("location:secure.php"); //else //echo 'Wrong Username or Password<br/><a href="javascript:history.go(-1)"><input type="button" value="Back">'; } ?>
  2. OK! Sorry about the POST above... I spoke to my senior and he gave me more insight of what they want EXACTLY... AND It all makes sense... I will simply use a Database with a couple of tables defining the different services and as the end user login, he/she will get the data as he/she registered... Hope I can help someone else like this... Jaco AKA Mr_J
  3. Hi all, ********* ONLINE ACCOUNTING ********* I need to do a project but not to sure what (function/global/.../...) to use just to get off the ground. Any input will be appreciated... I have a Register & Login (using MySQL & Sessions) system that work and can login and view specific pages as user-rights apply. Now I need 2 get input from the user on what data he/she require: e.g. User input will be "Account Balance" data will display (print/echo) to .html from a (authorized) file on Server. a Second instance could be that the user need data from a certain Date range i.e. Transaction Detail (recorded Transaction no. etc.). I haven't started yet as I'm unsure what/where to start. I would use the $_REQUEST PreVar but not sure if it will work in the setup I'm planning Any input please Regards, Jaco
  4. Mr_J

    Validation W3.org

    After reading a bit, I see the way NOT to go is <marquee> I will rather change it into a style...
  5. I have corrected a couple of missing alt attributes but I have a marquee and some counters that return invalid... http://validator.w3.org/check?uri=http%3A%2F%2Fwww.turboautoclinic.co.za%2F&charset=%28detect+automatically%29&doctype=Inline&group=0&user-agent=W3C_Validator%2F1.2 Any input on the marquee would be great
  6. After some Google-ing I found lots of articles. I managed to change my .htaccess file to: Options +ExecCGI -Indexes DirectoryIndex index.php index.html index.htm ### DEFAULTS ### ServerSignature Off AddType video/x-flv .flv AddType application/x-shockwave-flash .swf AddType image/x-icon .ico AddDefaultCharset UTF-8 DefaultLanguage en-US SetEnv TZ SouthAfrica/Klerksdorp SetEnv SERVER_ADMIN jcjbrt@gmail.com ### FAST-CGI ### AddHandler fastcgi-script fcgi AddHandler php-cgi .php Action php-cgi /cgi-bin/php5-wrapper.fcgi # MONTH <FilesMatch "\.(flv|gif|jpg|jpeg|png|ico|swf)$"> Header set Cache-Control "max-age=2592000" </FilesMatch> # WEEK <FilesMatch "\.(js|css|pdf|txt)$"> Header set Cache-Control "max-age=604800" </FilesMatch> # DAY <FilesMatch "\.(html|htm)$"> Header set Cache-Control "max-age=43200" </FilesMatch> Options +FollowSymLinks RewriteEngine On RewriteBase / RewriteCond %{HTTP_REFERER} !^$ RewriteCond %{HTTP_REFERER} !^http://(www\.)?pharmacy.za.org/.*$ [NC] Source: http://www.evolt.org/ultimate_htaccess_examples Very interesting for me as webmaster who, by no doubt, need to learn much more than just html/php coding... Cheers Jaco
  7. Hi all, I was hacked and found after a week that the .htaccess file shows to Scl.html as start page. I have changed it to: Options all DirectoryIndex index.html AddType text/plain .php AddHandler server-parsed .php AddType text/plain .html When I enter the address in my browser, it shows my html code instead of the actual webpage. Any idea how to get it to show my web page? Regards,
  8. I did run it through the validator but it only returned the ALT tag as not there in the images... So I googled for buttons and I'm now using it as: <button type="button"...>Button Text</button> Only problem, I can't test it... but will ask my client to see if it works! Thanks everyone!!
  9. Hi all, www.turboautoclinic.co.za On my product page, I have categories/products in buttons. The button is a hyperlink. When using IE6, when I click the link, nothing happens. So I installed IE8 with the same result. Any special programing necessary for IE and Linking Buttons? I have Win7 installed and running IE9/Firefox. Everything is fine when I test it... <a href="page.html"><input type="button" value="Button 1"></a> Regards, EDIT All pages is .php as I use the date function but the site is HTML based
  10. Guess there is some info available but from my own experience, I usually summarize what I need e.g. Site functionality. If you know what your requirements are, you can work according to that. Like a cart, I will use a cart folder, same with a gallery, if I use a Gallery viewer, I will use a Gallery folder and even more, I have an Images folder and a sub-folder for my index pics etc. It makes it easy for me when I change the site... Enjoy
  11. Hi all, I have a small script I found somewhere but after I changed hosting, it just stop to work. I just want to record the user IP and Referrer etc. in a .txt file using fopen. It helps to see what users searched for in search engine etc. The headers are there but no data... Please help?? session_start(); if($session["logged"] != "yes") { $agent = $_SERVER['HTTP_USER_AGENT']; $uri = $_SERVER['REUEST_URI']; $ip = $_SERVER['REMOTE_ADDR']; $ref = $_SERVER['HTTP_REFERER']; $visitTime = date("r"); $logLine = "$visitTime - IP: $ip || User Agent: $agent || Page: $uri || Refererrer: $ref\n\n"; $fp = fopen("indexLog.txt", "a"); fputs($fp, $logLine); fclose($fp); $_SESSION["logged"] = "yes"; } ?> Thanx in advance Jaco
  12. Hi all, My client have legal issues and I need to protect a directory so that only allowed user(s) can ALTER/WRITE to the directory. The problem is that it must display the .html / .php content to the public. Path = domain.com/sub-domain.com/directory2protect I have set file attributes to 744 but the main account can still access the directory and in browser view it is Forbidden. This is a contact form in html where I display an iframe So I have contact.html <iframe src='contact/form.php' > I need to protect the directory with a password and/or user before you can replace any document/file Will .htaccess work in a case like this? or do I need to use Apache? I have tried using the cPanel to protect the directory but again, the main user still have access... Any ideas? Regards
  13. can you add a link? will help to actually see... I'm newish to php as well and started using sessions just a while ago so its all still fresh in my mind
  14. The rand function will generate unique no's. You can use mt_rand as well. To make sure you always start from a different place in sequence, you have to seed the random number generator by calling the srand function - mt_srand
×
×
  • 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.