[PHP-DB] session confusion| can anyone help?
here is the code for accesscontrol.php which control the access to protected page, the server gives an error as of Notice: Undefined index: uid in E:\www\signup\accesscontrol.php on line 7 Notice: Undefined index: pwd in E:\www\signup\accesscontrol.php on line 8 I tried input username and password and it will give the error as: Access Denied Your user ID or password is incorrect, or you are not a registered user on this site. To try logging in again, click here. To register for instant access, click here. code // ?php // accesscontrol.php include_once 'common.php'; include_once 'db.php'; session_start(); $suid = isset($_POST['suid']) ? $_POST['suid'] : $_SESSION['suid']; //line 7 $spwd = isset($_POST['spwd']) ? $_POST['spwd'] : $_SESSION['spwd']; //line 8 if(!isset($suid)) { ? !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 Please Log In for Access /title meta http-equiv=Content-Type content=text/html; charset=iso-8859-1 / /head body h1 Login Required /h1 pYou must log in to access this area of the site. If you are not a registered user, a href=signup.phpclick here/a to sign up for instant access!/p pform method=post action=?=$_SERVER['PHP_SELF']? User ID: input type=text name=suid size=8 /br / Password: input type=password name=spwd SIZE=8 /br / input type=submit value=Log in / /form/p /body /html ?php exit; } $_SESSION['suid'] = $suid; $_SESSION['spwd'] = $spwd; dbConnect(cartoon); $sql = SELECT * FROM userinfo WHERE uid = '$suid' AND pwd = PASSWORD('$spwd'); $result = mysql_query($sql); if (!$result) { error('A database error occurred while checking your '. 'login details.\\nIf this error persists, please '. 'contact [EMAIL PROTECTED]'); } if (mysql_num_rows($result) == 0) { unset($_SESSION['suid']); unset($_SESSION['spwd']); ? !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 Access Denied /title meta http-equiv=Content-Type content=text/html; charset=iso-8859-1 / /head body h1 Access Denied /h1 pYour user ID or password is incorrect, or you are not a registered user on this site. To try logging in again, click a href=?=$_SERVER['PHP_SELF']?here/a. To register for instant access, click a href=signup.phphere/a./p /body /html ?php exit; } $username = mysql_result($result,0,'unick'); echo $username; ? // Thanks. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] ping
Hi, This is not exactly fall in the category of php and mysql, but hopefully that you can shed a light for me. My question is how can we write a php ping script to ping some website and output the ip address of the website automatically on webpage? It's the same idea that ping www.google.com in cmd prompt(@win2k)but output the result in a webpage. Any feedbacks and info will be appreciated. Thanks. Bo -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] question regard uploading music files[2]
Hi, following my previous question, I'm thinking that instead of inserting the music file as a blob into the database, can I just copy it into one of the directories on the web server while I upload it? if so, how can I achieve it and how do I show it as an http link then? Thank you. Bo -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] need an idea...
Hi, I'm wondering how can I write some php script to scan a couple of(or more) websites to find out the lowest price of a particular item? what is the idea behind this kind of programing? Also, I am always wondering how does the pricewatch website works? (I don't think that they did page by page html, right? How do they grab the data from other websites?) Thank you and your ideas and info will be much appreciated... Bo -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] ping
Hi, This is not exactly fall in the category of php and mysql, but hopefully that you can shed a light for me. My question is how can we write a php ping script to ping some website and output the ip address of the website automatically on webpage? It's the same idea that ping www.google.com in cmd prompt(win2k)but output the result in a webpage. Any feedbacks and info will be appreciated. Thanks. Bo -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] ping2
I just figured out how to retrieve ip but instantly thought of something more, how do I make it as an href link once I got the ip? Thanks, Bo -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] how to format the output of the text info that user uploaded?
I have a field in a form which allows user to upload thier biographys.Once they upload a bunch of texts,the script I wrote automatically show it on a webpage, however, the contents are all scrambled toghther without line break and formatting.. How am I able to show the formatted outputs? I tried to use pre /pre, but it didn't work well. Any suggestions? Thank you! Bo -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] how to insert radiobutton value into mysql database?
here is a block of code inside a form tdfont color=#FFCC00 input type=radio name=Seeking value=Seeking_record_contract checked Record Contract/font/td tdfont color=#FFCC00 input type=radio name=Seeking value=Seeking_pub_contract /font/td tdfont color=#FFCC00Pub Contract/font/td tdfont color=#FFCC00 input type=radio name=Seeking value=Seeking_live_gigs /font/td tdfont color=#FFCC00Live Gigs/font/td three radio button with the same name but different value, my question is how to insert the value that user clicked when processing the form? I tried to write one, but it didnt' seem to work: $insertQuery = INSERT INTO tablename VALUES ( \{$Seeking}\, . ); (and in the future how do I retrieve those from mySQL and output to the webpage?) Thank you and any help or info will be much appreciated. Bo -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] How to upload images to mysql database?
Question as title, any info will be appreciated. Thanks. Bo -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] undefined variable? how could it be?
basically this a code for uploading images and text info into a mysql database, however, when I execute this code, an error occured as: Undefined variable: action in \phpmySQL\add.php on line 2 what will be the problem? ?php if ($action == upload) { // ok, let's get the uploaded data and insert it into the db now include open_db.inc; if (isset($binFile) $binFile != none) { $data = addslashes(fread(fopen($binFile, r), filesize($binFile))); $strDescription = addslashes(nl2br($txtDescription)); $sql = INSERT INTO tbl_Files ; $sql .= (description, bin_data, filename, filesize, filetype) ; $sql .= VALUES ('$strDescription', '$data', ; $sql .= '$binFile_name', '$binFile_size', '$binFile_type'); $result = mysql_query($sql, $db); mysql_free_result($result); // it's always nice to clean up! echo Thank you. The new file was successfully added to our database.brbr; echo a href='main.php'Continue/a; } mysql_close(); } else { ? HTML BODY FORM METHOD=post ACTION=add.php ENCTYPE=multipart/form-data INPUT TYPE=hidden NAME=MAX_FILE_SIZE VALUE=100 INPUT TYPE=hidden NAME=action VALUE=upload TABLE BORDER=1 TR TDDescription: /TD TDTEXTAREA NAME=txtDescription ROWS=10 COLS=50/TEXTAREA/TD /TR TR TDFile: /TD TDINPUT TYPE=file NAME=binFile/TD /TR TR TD COLSPAN=2INPUT TYPE=submit VALUE=Upload/TD /TR /TABLE /FORM /BODY /HTML ?php } ? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] php and javascript?
Hi, Here is what I wanted to achieve, I want to get a confirmation box pop up when user click on the delete link of the webpage(displays the contents got from mysql database). I know we can do it in javascript easily, but my question is: 1st, a common javascript confirmation will be like this: SCRIPT language=JavaScript !-- function go_there() { var where_to= confirm(Do you really want to go to this page??); if (where_to== true) { window.location=http://detination;; } else { window.location=http://original;; } } //-- /SCRIPT A HREF=javascript:go_there()New Page/A my question is how to integrate the javascript with php, the sample delete link will be something like: http://localhost/index.php?id=1 ,and the id number(in this case:1) is from database: (a href=delete.php?.$row[id].) 2nd is there a better way to write pure php code to get a confirm window pop up once i clicked on delete link? Thanks and Good day. Bo -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] the space in php
To Php Gurus: I'm writing some code like this: echo(tda href=javascript:popUp('bios/bio_.$row[scoutname]..html').$row[scoutbi o]./a/td); but the scoutname is something like Mike Johnson, which has a space in bettwen Mike and Johnson, how do I chop this space off, so I can name the corresponding html file as bio_MikeJohnson ? Thanks and any feedback will be appreciated! Good Day. Bo -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] the space in php (2)
Indeed, it's better that if I can just stop when I encouter a space before Johnson, and take the first name(Mike) off. So, the file name will be bio_Mike.html Thanks Bo -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: the space in php
test Bo [EMAIL PROTECTED] дÈëÏûÏ¢ÐÂÎÅ :[EMAIL PROTECTED] To Php Gurus: I'm writing some code like this: echo(tda href=javascript:popUp('bios/bio_.$row[scoutname]..html').$row[scoutbi o]./a/td); but the scoutname is something like Mike Johnson, which has a space in bettwen Mike and Johnson, how do I chop this space off, so I can name the corresponding html file as bio_MikeJohnson ? Thanks and any feedback will be appreciated! Good Day. Bo -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] string
Hi, for any email end with @companyemail.com such as [EMAIL PROTECTED] how do I strip only the portion(in this case:bo) before the common ending:@companyemail.com ? Thanks a bunch! PHP: the solution to the web problem Best Regards to PHP Community Bo -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: To Bo
Hi, Adam Thank you, indeed right after I post my question, I was able to use strpos and substr functions to solve my problem. Thanks a lot. Sincerely Bo Adam Royle [EMAIL PROTECTED] ??:001901c2311d$f5ea97c0$[EMAIL PROTECTED] Study these two parts in the manual, and you will know how to do everything you've mentioned (and more). http://www.php.net/manual/en/ref.strings.php http://www.php.net/manual/en/ref.array.php Adam -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] string
Hi, .: B i g D o g :. Thank you, indeed right after I post my question, I was able to use strpos and substr functions to solve my problem. But yours is even simpler with only one function, cheers. Thanks a lot. Sincerely Bo Ray Hunter [EMAIL PROTECTED] ??:01a901c23108$8a881a30$[EMAIL PROTECTED] list( name, rest ) = explode( '@', $email ); name = everything before the @ rest = everything after @ .: B i g D o g :. - Original Message - From: bo [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, July 21, 2002 4:42 PM Subject: [PHP-DB] string Hi, for any email end with @companyemail.com such as [EMAIL PROTECTED] how do I strip only the portion(in this case:bo) before the common ending:@companyemail.com ? Thanks a bunch! PHP: the solution to the web problem Best Regards to PHP Community Bo -- 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