[PHP-DB] Re: please help!
Also try using the exec command with an array and that will provide the result for you so you can verify if the command was successful using php... Check here: http://www.php.net/manual/en/function.exec.php BigDog "Josh Evans" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Database: sites > > I have to columns: "id" and "site". I will have approx 800 entries in the db > when I am finished and what I want it to do and start with 1st entry and > ping the site and display in a table on the screen if it was able to ping > site or not. > > This is what I have so far. My problem is I am not sure how to make it > select a entry, perform the ping, record the results, and then continue to > the next entry. > > $db = mysql_connect("localhost","","") or die("Problem connecting"); > mysql_select_db("josh") or die("Problem selecting database"); > $query = "SELECT * FROM josh.sites"; > $result = mysql_query($query) or die ("Query failed"); > $numofrows = mysql_num_rows($result); > for($i = 0; $i < $numofrows; $i++) { > $row = mysql_fetch_array($result); > if($i % 2) { //this means if there is a remainder > > $site = ".row['site']."; < its not pulling a site from the > database? > > > $host1 = `ping -n 4 $site`; > > if (eregi("reply", $host1)) { > echo "$site is up!"; > } else { > echo ("$site is down!"); > } > > echo (""); > ?> > > Please Help! > > Josh Evans > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: php-db Digest 23 Apr 2002 18:14:40 -0000 Issue 1168
Achilles, Do mean that a particular user should only be able to view certain records in the database? Or just that person must log in with a valid user name and password before they have access to the database, after they login they have access to the whole thing? The second case is simple and can be solved as another poster described (do a lookup and save a session variable). Fir the first case you could have your user table with the name and password (perhaps additional information associated with the user) and then your data table which has a user id field that contains the ID of the user who is able to view and perhaps edit that record. If you wish to allow several people to edit or view a record you would need a third table, which contains user ID, record ID and perhaps a level of permission (one user can edit and view another user might only have permission to view). Your PHP code would only select from a join which includes these tables. For example: Your tables: UserData Access - -- id id data_id namecol_1 user_id passwd col_2 level This would return all the records you were entitled to see - you could further restrict it by adding more WHERE clauses. SELECT col_1, col_2 FROM User, Data, Access WHERE User.id = Access.user_id AND Data.id = Access.data_id AND User.name = $name AND User.passwd = $passwd AND Access.level >= 1/* we'll say 1 is read, 2 is read write */ /* 0 or no record is no access */ Notice a record that you have no permission to view does not show up. You would have to save the $name (users name) and $passwd (password) in a session variable or look them up once and save the user.id in a session variable. You could send the name and password back to the user as hidden fields (not as good since these are visible to evil people) and DO NOT do this with user.id since someone could easily change their hidden id and see someone else's records. If you added Access.level to the select list: SELECT Access.level, col_1, col_2 You would know if they had read only or read/write permission and if so could display the information in an editable form. If you do allow editing you'll want to include the Data.id too (as a hidden field) to make your UPDATE statement easier but even there include the WHERE User.id = Access.user_id AND Data.id = Access.data_id AND User.name = $name AND User.passwd = $passwd AND Access.level = 2 To ensure the security or your data. Hope this helps, Good Luck On 4/23/02 11:14 AM, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > > From: "Achilles Maroulis" <[EMAIL PROTECTED]> > Date: Sat, 8 Dec 2001 10:10:14 +0200 > To: "PHP mailing list" <[EMAIL PROTECTED]> > Subject: Passwords > > Hi folks. > > I have a quetion for you which maybe a little silly as I'm still new here.. > I want to build a database in which access will have only registered memebers, > so I need to protect it. The database will have over 10 records and > hopefully over 1000 users-visitors. Everyone of them is going to have his own > password. I suppose I will have to build a table with usernames and encrypted > passwords but what I don't know is how to protect the pages not to be seen > without authorization. At first I thought about the .htaccess and .htpasswd > files but I'm not sure yet... > Can anyone suggest the best way to protect my database? If it is to > complicated to be explained in an email please suggest just the functions > names and I'll try to find the way... > > Thanx > Achilles -- Frank Flynn Poet, Artist & Mystic -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] User getting superuser access. ack!
Well, that looks like a problem within the findLoginType() call. Since it's not been included, it's hard to help you. :) 'Luck -Szii - Original Message - From: "J. Wharton" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, April 23, 2002 11:09 AM Subject: [PHP-DB] User getting superuser access. ack! > I am having a problem where from certain browsers, a user gets the superuser > access, but from mine, she gets normal access. Help! > > Here is a snippet of my code: > > //findLoginType returns a single character code stored in the user table for > each user. > //variable $username=$REMOTE_USER as previously defined. > > $hm=findLoginType($username); > if ($hm=='s') > {echo "";} > > else > { //do normal user stuff} > > > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: [PHP-WIN] Update 4.1.2 > 4.2 : MSSQL Error S1000 (Parallel Requests)
I am having problems too. My ADOdb regression tests for msaccess/odbc and vfp/odbc fail every time. No data is being retrieved :-( Uggh. "Christoph Grottolo" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]... > > "Lars Schwarz" <[EMAIL PROTECTED]> schrieb im Newsbeitrag > news:[EMAIL PROTECTED]... > | this has nothing to do with the odbc driver i think, because i already > tried > | different mdac versions, without success. it's simply like this: > | switching between the two php version (without touching the mdac, odbc, > | sqlsrv32.dll or anything) 4.1.2 works, 4.2 doesnt, so it must be the odbc > | implementation within php 4.2 > > I also think so. I'm getting some strange odbc errors (missing resultsets > etc.) with 4.2.0, same query is working perfectly in 4.1.2. Some queries > work perfectly as before, some don't. Until now i didn't find any pattern. > > I'll try to set up some test scripts, but i don't have any experience in > doing that, so, if somebody could help me i wouldn't refuse. > > Christoph > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] User getting superuser access. ack!
I am having a problem where from certain browsers, a user gets the superuser access, but from mine, she gets normal access. Help! Here is a snippet of my code: //findLoginType returns a single character code stored in the user table for each user. //variable $username=$REMOTE_USER as previously defined. $hm=findLoginType($username); if ($hm=='s') {echo "";} else { //do normal user stuff} -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] auto-increment question
Hello!! ALTER TABLE table1 AUTO_INCREMENT = 1000; That should do it... You can use that anytime.. Dan On Tuesday, April 23, 2002, at 12:21 AM, [EMAIL PROTECTED] wrote: > Hi all, > > I'm wondering if there is a way to start an auto-increment field at a > number > other than 1. I'm working on a table meant to store large amounts of > users, > each with their own unique ID, but my employer wants the UIDs to be a > four- > digit number, rather than starting at 1 -- but they still need to auto- > increment. Can this be done, or do I need to find a workaround (and if > so, > can anyone suggest anything?) > > Thanks in advance, > > Dan > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] please help!
You're not evaluating the variable correctly... Instead of... $site = ".row['site']."; It should be... $site = $row["site"]; Or $site = "$row['site']" I'm not sure why you have leading and trailing periods, either. Looks like you were trying to do string appends, but they're not being used correctly 'Luck -Szii - Original Message - From: "Evans, Josh" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, April 23, 2002 11:26 AM Subject: [PHP-DB] please help! > Database: sites > > I have to columns: "id" and "site". I will have approx 800 entries in the db > when I am finished and what I want it to do and start with 1st entry and > ping the site and display in a table on the screen if it was able to ping > site or not. > > This is what I have so far. My problem is I am not sure how to make it > select a entry, perform the ping, record the results, and then continue to > the next entry. > > $db = mysql_connect("localhost","","") or die("Problem connecting"); > mysql_select_db("josh") or die("Problem selecting database"); > $query = "SELECT * FROM josh.sites"; > $result = mysql_query($query) or die ("Query failed"); > $numofrows = mysql_num_rows($result); > for($i = 0; $i < $numofrows; $i++) { > $row = mysql_fetch_array($result); > if($i % 2) { //this means if there is a remainder > > $site = ".row['site']."; < its not pulling a site from the > database? > > > $host1 = `ping -n 4 $site`; > > if (eregi("reply", $host1)) { > echo "$site is up!"; > } else { > echo ("$site is down!"); > } > > echo (""); > ?> > > Please Help! > > Josh Evans > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] please help!
Database: sites I have to columns: "id" and "site". I will have approx 800 entries in the db when I am finished and what I want it to do and start with 1st entry and ping the site and display in a table on the screen if it was able to ping site or not. This is what I have so far. My problem is I am not sure how to make it select a entry, perform the ping, record the results, and then continue to the next entry. "); ?> Please Help! Josh Evans -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] auto-increment question
This is more of a MySQL question, but you can set the column default for the auto_increment column to something other than 1. Look up the "SET DEFAULT" clause of the table create / alter table calls. -Szii - Original Message - From: "Dan Swensen" <[EMAIL PROTECTED]> To: "php" <[EMAIL PROTECTED]> Sent: Monday, April 22, 2002 10:21 PM Subject: [PHP-DB] auto-increment question > Hi all, > > I'm wondering if there is a way to start an auto-increment field at a number > other than 1. I'm working on a table meant to store large amounts of users, > each with their own unique ID, but my employer wants the UIDs to be a four- > digit number, rather than starting at 1 -- but they still need to auto- > increment. Can this be done, or do I need to find a workaround (and if so, > can anyone suggest anything?) > > Thanks in advance, > > Dan > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] auto-increment question
Hi all, I'm wondering if there is a way to start an auto-increment field at a number other than 1. I'm working on a table meant to store large amounts of users, each with their own unique ID, but my employer wants the UIDs to be a four- digit number, rather than starting at 1 -- but they still need to auto- increment. Can this be done, or do I need to find a workaround (and if so, can anyone suggest anything?) Thanks in advance, Dan -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Problem
well sorry 2 say but it was just an incompability between php and mysql php 4.1.2 fixed it :) "David Robley" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] > (Thomas \"Omega\" Henning) says... > > no everything i try to do same old story sql error > > "Richard Emery" <[EMAIL PROTECTED]> wrote in message > > 004e01c1ea1b$b3dff4e0$0200a8c0@C1525232">news:004e01c1ea1b$b3dff4e0$0200a8c0@C1525232... > > > mysql permissions? > > > > > > you gave us no info...we can give you no answer > > > - Original Message - > > > From: Thomas "omega" Henning <[EMAIL PROTECTED]> > > > To: <[EMAIL PROTECTED]> > > > Sent: Monday, April 22, 2002 11:25 AM > > > Subject: [PHP-DB] Problem > > > > > > > > > Ok i have a problem big one. I'm using php 4.0.6 and mysql 3.23 both win. > > > And i use PhpMyAdmin to fill my database but MySQL reject every query i > > post > > > to it any idea why? > > > > > > Thanks > > > > > > Thomas "omega" Henning > > Well, the exact error and circumstances in which it occurs might be > useful. > > -- > David Robley > Temporary Kiwi! > > Quod subigo farinam -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: Mail Again
Got it at Last Thank you -- Alex Francis Cameron Design 35, Drumillan Hill Greenock PA16 0XD Tel 01475 798106 [EMAIL PROTECTED] http://www.camerondesign.co.uk This message is sent in confidence for the addressee only. It may contain legally privileged information. Unauthorised recipients are requested to preserve this confidentiality and to advise the sender immediately of any error in transmission. Lisi <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > You can also add the following line to your code: > $header = "From: Your Name <[EMAIL PROTECTED]>\n"; > > and write your mail statement like this: > mail($email, $title, $comments, $header); > > You can just stick the variable $emailaddress into whichever variable is > relevant - what was that for if not the from address? > > -Lisi > > > > >There is an item in your php.ini > >sendmail_from string > >Which "From:" mail address should be used in mail sent from PHP under > >Windows. > > > >If you look at the docs for mail(), you'll see that there are > >also examples of using the fourth argument to mail() for extra headers, > >including the From: header. I am not sure whether using From: under > >Windows works in lieu of the php.ini entry. > > > >-- > >David Robley > >Temporary Kiwi! > > > >Quod subigo farinam > > > >-- > >PHP Database Mailing List (http://www.php.net/) > >To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Passwords
Basically you need first to authorise the user. Check the username and password against an entry in a user table in the database. If you are using sessions set a variable that makes the session authorised, you are not using sessions then you need some sort of session management. (I have the code, contact me off list if you want it ) if(login ok) $authorised = 1; At the beginning of any page you want protected if(!$authorised) die ('you are not authorised to view this page etc etc'); will do the trick regards Peter --- Excellence in internet and open source software --- Sunmaia www.sunmaia.net [EMAIL PROTECTED] tel. 0121-242-1473 --- > -Original Message- > From: Achilles Maroulis [mailto:[EMAIL PROTECTED]] > Sent: 08 December 2001 08:10 > To: PHP mailing list > Subject: [PHP-DB] Passwords > > > Hi folks. > > I have a quetion for you which maybe a little silly as I'm still > new here.. > I want to build a database in which access will have only > registered memebers, so I need to protect it. The database will > have over 10 records and hopefully over 1000 users-visitors. > Everyone of them is going to have his own password. I suppose I > will have to build a table with usernames and encrypted passwords > but what I don't know is how to protect the pages not to be seen > without authorization. At first I thought about the .htaccess and > .htpasswd files but I'm not sure yet... > Can anyone suggest the best way to protect my database? If it is > to complicated to be explained in an email please suggest just > the functions names and I'll try to find the way... > > Thanx > Achilles > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: Mail Again
You can also add the following line to your code: $header = "From: Your Name <[EMAIL PROTECTED]>\n"; and write your mail statement like this: mail($email, $title, $comments, $header); You can just stick the variable $emailaddress into whichever variable is relevant - what was that for if not the from address? -Lisi >There is an item in your php.ini >sendmail_from string >Which "From:" mail address should be used in mail sent from PHP under >Windows. > >If you look at the docs for mail(), you'll see that there are >also examples of using the fourth argument to mail() for extra headers, >including the From: header. I am not sure whether using From: under >Windows works in lieu of the php.ini entry. > >-- >David Robley >Temporary Kiwi! > >Quod subigo farinam > >-- >PHP Database Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: Mail Again
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] says... > Problem is!!! PHP.INI is at my ISP. Is there a way to make it think it > has been changed. > > -- > Alex Francis > Cameron Design > 35, Drumillan Hill > Greenock PA16 0XD > > Tel 01475 798106 > [EMAIL PROTECTED] > http://www.camerondesign.co.uk > David Robley <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > In article <[EMAIL PROTECTED]>, > > [EMAIL PROTECTED] says... > > > Got almost everything to work. Thank you all for your input. Code as > > > follows: > > > > > > > > > > > > > > // setup SQL statement to retrieve link > > > > > > $SQL = " SELECT * FROM $tablename1 "; > > > $SQL = $SQL . " WHERE id = $id "; > > > > > > // execute SQL statement > > > $ret = mysql_db_query($dbname,$SQL,$link); > > > > > > if (!$ret) { echo("ERROR: " . mysql_error() . "\n$SQL\n"); } > > > > > > echo (" Email Sent\n"); > > > > > > // retrieve values > > > $row = mysql_fetch_array($ret); > > > $email = $row["email"]; > > > $title = $row["title"]; > > > $comments = $row["comments"]; > > > $title = $row["title"]; > > > > > > mail($email, $title, $comments, $emailaddress); > > > > > > Try using the fourth parameter, as above. Also, look at the configuration section of the manual for the Apache directives, some of which can be used in .htaccess files. Finally, ini_set may be an option. -- David Robley Temporary Kiwi! Quod subigo farinam -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Passwords
Thanx guys!! -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: PHP with DB2 and Oracle
Yes, you create two independant connections to db2 (using odbc) and another using oci8. Regards, John "Luis Silva" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hi all > > I am a beginner with PHP, so sorry if my question is to much basic for you. > > > Is possible to use PHP with support at same time for DB2 and Oracle ? > > I mean can I use PHP to open two connections to different database > servers (Oracle and DB2) at same time ? > > Tanks on advance. > > > Luis Silva > IBM Data Management Solutions - Portugal > Tel: +351 217915398 > External e-mail: [EMAIL PROTECTED] > Web site: http://www.ibm.com/software/data/informix > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: Mail Again
Problem is!!! PHP.INI is at my ISP. Is there a way to make it think it has been changed. -- Alex Francis Cameron Design 35, Drumillan Hill Greenock PA16 0XD Tel 01475 798106 [EMAIL PROTECTED] http://www.camerondesign.co.uk This message is sent in confidence for the addressee only. It may contain legally privileged information. Unauthorised recipients are requested to preserve this confidentiality and to advise the sender immediately of any error in transmission. David Robley <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > In article <[EMAIL PROTECTED]>, > [EMAIL PROTECTED] says... > > Got almost everything to work. Thank you all for your input. Code as > > follows: > > > > > > > > > // setup SQL statement to retrieve link > > > > $SQL = " SELECT * FROM $tablename1 "; > > $SQL = $SQL . " WHERE id = $id "; > > > > // execute SQL statement > > $ret = mysql_db_query($dbname,$SQL,$link); > > > > if (!$ret) { echo("ERROR: " . mysql_error() . "\n$SQL\n"); } > > > > echo (" Email Sent\n"); > > > > // retrieve values > > $row = mysql_fetch_array($ret); > > $email = $row["email"]; > > $title = $row["title"]; > > $comments = $row["comments"]; > > $title = $row["title"]; > > > > mail($email, $title, $comments, $emailaddress); > > > > > > mysql_close($link); > > > > ?> > > > > $emailaddress is set in the config.inc.php file and comes in alright as a > > header in the note. > > > > However, the mail is sent from the following: > > nobody [[EMAIL PROTECTED]] > > > > Is there a way to tell the PHP Server where the mail is coming from. > > There is an item in your php.ini > sendmail_from string > Which "From:" mail address should be used in mail sent from PHP under > Windows. > > If you look at the docs for mail(), you'll see that there are > also examples of using the fourth argument to mail() for extra headers, > including the From: header. I am not sure whether using From: under > Windows works in lieu of the php.ini entry. > > -- > David Robley > Temporary Kiwi! > > Quod subigo farinam -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php