Jump to content

zbrahead

New Members
  • Posts

    8
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

zbrahead's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Undefined index means that there isnnt any POST data going to the page, should you put the ACTION of the form to PHP self you should be rockin'
  2. For example: [code] $randomvariable = "<?php header("location:Http:somesite.com");exit;?>" echo($randomvariable); #fails print($randomvariable); #fails [/code] how do i get the string contents parsed?!?!?!
  3. I have produced this script after a few days on it and i managed to debug it to the query, now the query function provides an error message ( a custom or die() one) and i have tinkered with it for along time and cannot fix this. Any help would be GRAVELY appretiated , im at breaking point here is my script: (there is html below but u dont need to see that [img src=\"style_emoticons/[#EMO_DIR#]/wink.gif\" style=\"vertical-align:middle\" emoid=\":wink:\" border=\"0\" alt=\"wink.gif\" /] and passwords in mysql_connect function covered with asterisks for security purposes) [code] #get page datafrom url $page = $_GET['page']; #Detect which page called and handle variables et $rs = @mysql_connect("localhost","******","******")         or die("ERR:CONN");     $rs = @mysql_select_db("pages")         or die("ERR:DB");       $sqlhead1 = 'SELECT * FROM $page WHERE variable like \'head1\' LIMIT 0, 30 ';       $sqlmsg1 = 'SELECT * FROM $page WHERE variable like \'head1\' LIMIT 0, 30 ';       $sqlhead2 = 'SELECT * FROM $page WHERE variable like \'head1\' LIMIT 0, 30 ';       $sqlmsg2 = 'SELECT * FROM $page WHERE variable like \'head1\' LIMIT 0, 30 ';                $rs = mysql_query($sqlhead1)         or die(queryhead1);            $head1 = Mysql_fetch_array($rs);     $rs = mysql_query($sqlmsg1,$conn) or die(queryhead1);            $msg1 = Mysql_fetch_array($rs);     $rs = mysql_query($sqlhead2,$conn)or die(querymsg1);      $head2 = Mysql_fetch_array($rs)or die(queryhead2);     $rs = mysql_query($sqlmsg2,$conn)or die(querymsg2);              $msg2 = Mysql_fetch_array($rs); [/code] im getting queryhead1 error message.
  4. [code=php:0]<?php Function detectpagecalled($page) {if($page == home) {callpagedatahome();} else if($page == about) {callpagedataabout();} else if($page == contact) {callpagedatacontact();} else if($page == NULL) {header("location:index.php?page=home");exit();} else if($page != NULL) {header("location:index.php?page=home");exit();} } function callpagedatahome() { $conn = mysql_connect("localhost","******","*******") or die("ERR:CONN"); $rs = mysql_select_db("pages",$conn) or die("ERR:DB"); $sqlhead1 = 'SELECT * FROM `home` WHERE `variable` like `head1` '; $sqlmsg1 = 'SELECT * FROM `home` WHERE `variable` like `msg1` '; $sqlhead2 = 'SELECT * FROM `home` WHERE `variable` like `head2` '; $sqlmsg2 = 'SELECT * FROM `home` WHERE `variable` like `msg2` '; $rs = mysql_query($sqlhead1,$conn) ; $head1 = Mysql_fetch_array($rs); $rs = mysql_query($sqlmsg1,$conn) ; $msg1 = Mysql_fetch_array($rs); $rs = mysql_query($sqlhead2,$conn) ; $head2 = Mysql_fetch_array($rs); $rs = mysql_query($sqlmsg2,$conn) ; $msg2 = Mysql_fetch_array($rs); } function callpagedataabout() { $conn = mysql_connect("localhost","******","*******") or die("ERR:CONN"); $rs = mysql_select_db("pages",$conn) or die("ERR:DB"); $sqlhead1 = 'SELECT * FROM `about` WHERE `variable` like `head1` '; $sqlmsg1 = 'SELECT * FROM `about` WHERE `variable` like `msg1` '; $sqlhead2 = 'SELECT * FROM `about` WHERE `variable` like `head2` '; $sqlmsg2 = 'SELECT * FROM `about` WHERE `variable` like `msg2` '; $rs = mysql_query($sqlhead1,$conn) ; $head1 = Mysql_fetch_array($rs); $rs = mysql_query($sqlmsg1,$conn) ; $msg1 = Mysql_fetch_array($rs); $rs = mysql_query($sqlhead2,$conn) ; $head2 = Mysql_fetch_array($rs); $rs = mysql_query($sqlmsg2,$conn) ; $msg2 = Mysql_fetch_array($rs); } function callpagedatacontact() { $conn = mysql_connect("localhost","******","*******") or die("ERR:CONN"); $rs = mysql_select_db("pages",$conn) or die("ERR:DB"); $sqlhead1 = 'SELECT * FROM `contact` WHERE `variable` like `head1` '; $sqlmsg1 = 'SELECT * FROM `contact` WHERE `variable` like `msg1` '; $sqlhead2 = 'SELECT * FROM `contact` WHERE `variable` like `head2` '; $sqlmsg2 = 'SELECT * FROM `contact` WHERE `variable` like `msg2` '; $rs = mysql_query($sqlhead1,$conn) ; $head1 = Mysql_fetch_array($rs); $rs = mysql_query($sqlmsg1,$conn) ; $msg1 = Mysql_fetch_array($rs); $rs = mysql_query($sqlhead2,$conn) ; $head2 = Mysql_fetch_array($rs); $rs = mysql_query($sqlmsg2,$conn) ; $msg2 = Mysql_fetch_array($rs); } #Testing to see if it works without include $page = $_GET['page']; detectpagecalled($page); Echo($head1); echo($head1['content']);[/code] The test at the end was designed to see if the script works, the script is to be included into my index.php file Any help would be GREATLY appreciated, i bhave debugged etc. and everything is fine 'n' dandy so i am at a loss to see what is wrong.The content of my mysql table at the moment is as follows: my column titles are: COLUMNS->variable,content and as records i have: RECORD->head1,Testing head text RECORD->msg1,testing msg text
  5. [code]<?php #Set Variables to content for tables depending on $page variable. if($page = home )     {$headid1 = "Welcome to our home-page This is your gateway to the rest of the site";     $msgid1 = "Welcome to Era-Games Homepage, we hope you find many things to do here,our demos our currently locked down because of the people exploiting this generous service";     $headid2 = "An Apology";     $msgid2 = "We apologize for the adverts on this screen and as soon as possible we are working to remove these.";     $headbelow1 = "";     $msgbelow1 = "";     $headbelow2 = "";     $msgbelow2 = "";} else if($page = about )     {$headid1 = "Welcome to the about us page";     $msgid1 = "";     $headid2 = "";     $headbelow1 = "";     $msgbelow1 = "";     $headbelow2 = "";     $msgbelow2 = "";} else if( $page = forum )     { header( "location:http://eragames2.byethost7.com/forum/"); exit();     } else if( $page = news )     { header( "location:http://eragames2.byethost7.com/news/"); exit();     } else if( $page = contact )     {$headid1 = "Welcome to the Contact Us page";     $msgid1 = "";     $msgid2 = ""     $headid2 = "";     $headbelow1 = "";     $msgbelow1 = "";     $headbelow2 = "";     $msgbelow2 = "";} ?> [/code] $page is ascertained by an extensionj onto the url in ?page=home etc. please help!!!!
  6. Thanks For replying to my horrible post so now i have more tiome i would like to say please and thankyou and that there was no error
  7. i enclose my dataputfm.html and dataputcon.php and if you can make this work i will ermm.... worship you?!? :) the account details are in the php script and dont try loging into the cPanel as the password is dofferent thankyou. Dataputfm.html: [code]<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body bgcolor="#000000" text="#CCCCCC"> <p>&nbsp;</p><form name="form1" method="post" action="dataputcon.php">   <p>Link (to comply with IMPACT Games standards MUST end in .swf):     <input name="link" type="text" id="link">   </p>   <p>name:     <input name="name" type="text" id="name">   </p>   <p>comments :     <input name="comments" type="text" id="comments3">   </p>   <p> <input type="submit" name="Submit" value="Lock 'n' load game">        </p>   <p>&nbsp;</p> </form> </body> </html> [/code] Dataputcon.php: [code]<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body bgcolor="#000000"> <?php $link = $_POST['link'] $name = $_POST['name'] $comm = $_POST['comments'] #mySQL connection $conn = mysql_connect( "localhost" , "ricfo0i1_ricfon" , "polionum" )               or die( "no mysql" ) # Database connection $rs = mysql_select_db( "gamelist" , $conn )         or die( "no DB" ); #Form query #$sql = "insert into list ( "name" , "comments" ) values ( "$a" , "$comm" ) "; $sql = 'INSERT INTO `list` (`id`, `name`, `comments`) VALUES (\'\', \'<a href="$link" target="_top">$name</a>\', \'$comm\')'; #run query $rs = mysql_query( $sql , $conn )     or die( "query error" );      echo( "putted succesfully" ) ?> </body> </html> [/code]
×
×
  • 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.