Jump to content

neverbegosu

Members
  • Posts

    16
  • Joined

  • Last visited

    Never

Everything posted by neverbegosu

  1. does anyone know what "page" is referencing. After doing some more research I think it is referincing something in the url index.php?page=xxxx does that seem right?
  2. Ok so Mahngiel, hope I spelt that right. I did some rethinking after reading what you have said, and did some research on functions and peramiters. I am currently reviewing a small tutorial, and although some if it is making sense, I was hoping you can disect it fore me. Or anyone for that matter, once I understand it, I will be able to use it. I have linked the tutorial incase you need to see the structure of things. http://www.zeronese.net/knowledge-base/articles/article-1029.html <?php if(isset($_REQUEST['page'])) { if($_REQUEST['page'] !="") if(file_exists("pages/".$_REQUEST['page'].".html")) $page_content = file_get_contents("pages/".$_REQUEST['page'].".html"); else if (file_exists($_REQUEST['page'].".html")) $page_content=file_get_contents($_REQUEST['page'].".html"); else echo "<center>Page: ".$_REQUEST['page']." does not exist! Please check the url and try again!</center>"; } else $page_content=file_get_contents("design/pages/main.html"); $page_content=str_replace("!!HEADER!!",file_get_contents("design/header.html"), $page_content); $page_content=str_replace("!!LEFT_COLUMN!!", file_get_contents("design/left_column.html"),$page_content); $page_content=str_replace("!!RIGHT_COLUMN!!",file_get_contents("design/right_column.html"),$page_content); $page_content=str_replace("!!FOOTER!!",file_get_contents("design/footer.html"),$page_content); echo $page_content; ?> on the first line of code if(isset($_REQUEST['page'])) if(file_exists("pages/.$_REQUEST['page'].".html")) I think it checks weather the "page" is not null. But where is it checking this at? I mean where would 'page' come from its the same for the second line as well. I know its going to check for the existence of a file in the pages subfolder, so right now the only one it can be is "main" but again, the 'page' where is that declared, or defined? Once I figure out where the 'page' is comeing from I think I will be able to understand how I can use this.
  3. do you know any good tutorials on how to better learn functions, and peramiteres, expecially when It comes to building a website. I am very new to this php, and am self learning through tutorials and what not online. I designed what I did, in order to create webpages without having to rebuild the entire page everytime, just change the content in the center div. I used to re write the entire script. So I created a function/templet that I call from each webpage.php so it puts all the content up without having to retype it. From there I was doing html content and storing it on a database, and linked that database to the sitebuild.php. I guess I will install php on my computer and use xxamp to see how there doing it, and try to figure some stuff out that way. Thanks for the help mate, and again sorry for the signature thing.
  4. LMAO IC sorry for the misunderstanding. But horrible signiture man, nubs like me dont realize that stuff.
  5. kk first off, I don't know why you posted that quote from someone in this thread, I am not wanting anyone to write the code for me. I don't want the code at all. I want the understanding, so if your going to post shit like that, then do so in your own thread. As for your answer for me, it does make sense. That leaves me with the problem of achieving what I want to achieve so not I have to look at other venues of doing so. Is it possible to call a function that has a varible in the name, so you can pull diffrent functions based of the variable. I have webpages main.php profile.php that have a variable of $title=main/profile exc... In my sitebuild.php I built a function that builds the website without the center content. I declared the variables global in this function in order to call them from the page php scripts. centercontent(); is used to call the function building the center. Can I do somehting like this in order to make it page selectable. centercontent.$title(); ??? that way the name of called function changes with each page I run?
  6. what about variables in a query, then I can make a function to call to create the varibles, is there a way to do what I am trying to other the php code in the database and pulling it as a query? I was assuming. when you pull information out of a database echo $queryrow['user']; would echo whatever is in the that datacell so TESTUSER1 would show on the screen. So is it not right to access the datacell can be used as a variable?
  7. have an issue I am trying to work out. php document example (I pull information from my db to build forms and what not. But I am wanting to add php code into but it always just post the code, and not executing it.): echo 'test'; echo 'test'; echo $getresultsquery; DATABASE EXAMPLE db test1 table test1 field1 label field2 header field3 post $_SESSION['user']; ---------------------------------- I have succesuffully been able to run the the queries and pull content, and execute html code. Even within an echo statement on the php with the html in the query. But I cant figure out how to do php code in the query. Almost like using the database as a function, in some sense. If anyone knows why this is can you please get back to me.
  8. Ok guys heres the deal. I have been struggling on this for about two weeks and am giving up. Because I'm giving up, I would like to throw this up to you guys to help me out. I am trying to build a login I tried learning sessions but they make no sense to me whatsoever on how the information passes from one to another. So i created my own sessions database, where im uploading the data i need to pass page to page to my db, and repulling it on the next page. In order to do this i needed to create a cookie so I can refrence that data on the next page, main.php. When I run main.php i get an the echo of. "THIS COOKIE AINT FUCKING WORKING". which to me means one of two things. One is either im not creating the cookie right, or two, im not accessing it correctly. But to widdle that down I created the testpoint on if cookie is created and it seems to work fine, cuase im not getting the die(). Im not an advance php programmer by any means, just been self learning for a few months, so bear with me and please break it down as much as possible. I feel that if i can just get a userid created on one page, put it into a cookie, send it, and retreive it when on the next page, i can do the rest from there. If you can see why that is happening then let me know. Thanks in advance. NEVERBEGOSU ---------------------------------- index.php ------------- <?php include ('srvdbcon.php'); include ('functions/sitebuild.php'); include ('functions/functions.php'); setcookie('user', 'mike'); login(); headcontent(); headermain(); leftcontent(); ?> <div id="content"> <div class="post"> <h1 class="title"><a href="#">Welcome to </a></h1><p class="byline">21 April 2011 by <a href="#"></a></p> <div class="entry"> <p><strong></strong> is a free, 100% Starcraft 2 Replay Center. Our goal is to provide the ability to UPLOAD replays with detailed data, as well as to DOWNLOAD those replays. Our Replay Search function is one of a kind, designed by hand to help you find replays that you are looking for.</p> <p class="links"><a href="#" class="more">About Us</a></p> </div> </div> <div class="post"> <h2 class="title"><a href="#">Latest News</a></h2> <p class="byline">Working hard to get the site up and running. <a href="#"></a></p> <div class="entry"> <h3>Looking for late May Release:</h3> <blockquote> <p>Im working really hard guys. Forgive me for the pushback.</p> </blockquote> <h3>In Production:</h3> <ul> <li>Working on a new template for the site.</li> <li>Continuing developing the search function for replays.</li> <li>In the middle of moving in RL so working hard when I can.</li> <li>Working hard on the member login/registration pages.</li> <li>Started working on the forums</li> </ul> <h3>Finished:</h3> <ul> <li>Got the Upload Page working.</li> <li>Completed the Download style for the site.</li> <li>Finished a few other smaller aspects.</li> </ul> <p class="links"><a href="#" class="more">Read More</a></p> </div> </div> <div class="post"> <h2 class="title"><a href="#">LOOKING FOR HELP </a></h2> <p class="byline"><small>Posted on 22 Aprl 2011 by <a href="#">SCG.Admin</a></small></p> <div class="entry"> <p> is looking for a few people, if willig, to help design the site. The following positions are needed. </p> <ul> <li>Graphics Designer</li> <li>PHP/MYSQL Programmer</li> </ul> <p>If anyone is intrested please contact me at .</p> <p class="links"><a href="#" class="more">Read More</a></p> </div> </div> </div> <?php rightcontent1(); echo "<center><h2>Login</h2></center> "; echo "<form name='log' method='POST' action='" . $PHP_SELF . "'>"; echo "Username:"; echo "<p><input type='text' name='username'>"; echo "<p>Password:"; echo "<p><input type='password' name='password'>"; echo "<p><input type='submit' id='log' name='log' value='Login'>"; echo "<br>"; echo "<h2> Not a Member </h2>"; echo "<p><a href='register.php'>Register</a></p>"; echo "</center>"; rightcontent2(); footerdiv(); ?> ------------------------------------------------------------------------------------------- main.php --------- <?php include ('srvdbcon.php'); include ('functions/sitebuild.php'); if(!isset($_COOKIE['userid'])); { die ('CANT GET THE FUKCING COOKIE TO WORK'); } headcontent(); headermain(); leftcontent(); ?> <div id="content"> <div class="post"> <h1 class="title"><a href="#">Welcome to </a></h1><p class="byline">21 April 2011 by <a href="#">SCG.Admin</a></p> <div class="entry"> <p><strong></strong> is a free, 100% Starcraft 2 Replay Center. Our goal is to provide the ability to UPLOAD replays with detailed data, as well as to DOWNLOAD those replays. Our Replay Search function is one of a kind, designed by hand to help you find replays that you are looking for.</p> <p class="links"><a href="#" class="more">About Us</a></p> </div> </div> <div class="post"> <h2 class="title"><a href="#">Latest News</a></h2> <p class="byline">Working hard to get the site up and running. <a href="#">SCG.Admin</a></p> <div class="entry"> <h3>Looking for late May Release:</h3> <blockquote> <p>Im working really hard guys. Forgive me for the pushback.</p> </blockquote> <h3>In Production:</h3> <ul> <li>Working on a new template for the site.</li> <li>Continuing developing the search function for replays.</li> <li>In the middle of moving in RL so working hard when I can.</li> <li>Working hard on the member login/registration pages.</li> <li>Started working on the forums</li> </ul> <h3>Finished:</h3> <ul> <li>Got the Upload Page working.</li> <li>Completed the Download style for the site.</li> <li>Finished a few other smaller aspects.</li> </ul> <p class="links"><a href="#" class="more">Read More</a></p> </div> </div> <div class="post"> <h2 class="title"><a href="#">LOOKING FOR HELP </a></h2> <p class="byline"><small>Posted on 22 Aprl 2011 by <a href="#">SCG.Admin</a></small></p> <div class="entry"> <p>SCG.O is looking for a few people, if willig, to help design the site. The following positions are needed. </p> <ul> <li>Graphics Designer</li> <li>PHP/MYSQL Programmer</li> </ul> <p>If anyone is intrested please contact me at </p> <p class="links"><a href="#" class="more">Read More</a></p> </div> </div> </div> <?php rightcontent1(); rightcontent2(); footerdiv(); ?> ---------------- functions.php <?php function verifylogin() { } function login() { $Login=$_POST['log']; if ($Login) { $username=$_POST['username']; $password=($_POST['password']); $verlogin="SELECT * FROM user WHERE user='$username' AND password='$password'"; $verloginq=mysql_query($verlogin); if(mysql_num_rows($verloginq)!='0') { setcookie('userid' , 'mike'); if (setcookie) { $ip = getenv("REMOTE_ADDR"); $time=time(); $loginquery="INSERT INTO login (id,user,date,ip) VALUES ('','$username','$time','$ip')"; $loginqueryr=mysql_query($loginquery); if ($loginqueryr) { header("location:testmain.php"); } else { die('There was a problem sending info to database: LOGIN.'); } } else { die ('Cookie wont set for some damn reason.');} } else {die ('username/password error');} } else { } } function logout() { } function logcook() { } function logsess() { } ?> MOD EDIT: . . . BBCode tags added.
  9. <?php include(''); $leaguepass=strip_tags($_POST['league']); $type = strip_tags($_POST['type']); $race = strip_tags($_POST['race']); $vsrace = strip_tags($_POST['vsrace']); $player1 = strip_tags($_POST['player1']); $player2 = strip_tags($_POST['player2']); $map = strip_tags($_POST['map']); $and= " AND "; //////////////////////////////////////// //////////////////////////////////////// //////////////////////////////////////// if (($leaguepass == "Select One") && ($type == "Select One")) { $leaguepass = ""; } else if ($leaguepass == "Select One") { $leaguepass = " "; } else if (($leaguepass != "Select One")&&($type != "Select One")) { $leaguepass = "league='" . strip_tags($_POST['league']) . "' " . $and; } else { $leaguepass = "league='" . strip_tags($_POST['league']) . "' "; } /////////////////////////////////////// /////////////////////////////////////// /////////////////////////////////////// if (($type == "Select One") && ($race == "Select One")) { $type = ""; } else if ($type == "Select One") { $type = " "; } else if (($type != "Select One")&&($race != "Select One")) { $type = "type='" . strip_tags($_POST['type']) . "' " . $and; } else { $type = "type='" . strip_tags($_POST['type']) . "' "; } ////////////////////////////////////// ////////////////////////////////////// ////////////////////////////////////// if (($race == "Select One") && ($vsrace == "Select One")) { $race = ""; } else if ($race == "Select One") { $race = " " ; } else if (($race != "Select One")&&($vsrace != "Select One")) { $race = "race='" . strip_tags($_POST['race']) . "' " . $and; } else { $race = "race='" . strip_tags($_POST['race']) . "' "; } ////////////////////////////////////// if (($vsrace == "Select One") && ($player1 == "")) { $vsrace = ""; } else if ($vsrace == "Select One") { $vsrace = " "; } else if (($vsrace != "Select One")&&($player1 != "")) { $vsrace = "vsrace='" . strip_tags($_POST['vsrace']) . "' " . $and; } else { $vsrace = "vsrace='" . strip_tags($_POST['vsrace']) . "' "; } ////////////////////////////////////////// if (($player1 == "") && ($player2 == "")) { $player1 = ""; } else if (($player1 == "") && ($player2 != "")) { $player1 = " " . $and ; } else if (($player1 != "")&&($player2 != "")) { $player1 = "player1='" . strip_tags($_POST['player1']) . "' " . $and; } else { $player1 = "player1='" . strip_tags($_POST['player1']) . "' "; } ////////////////////////////////////////// if (($player2 == "") && ($map == "Select One")) { $player2 = ""; } else if (($player2 == "") && ($map != "")) { $player2 = " " . $and ; } else if (($player2 != "Select One")&&($map != "Select One")) { $player2 = "player2='" . strip_tags($_POST['player2']) . "' " . $and; } else { $player2 = "player2='" . strip_tags($_POST['player2']) . "' "; } /////////////////////////////////////// if ($map == "Select One") { $map = ""; } else { $map = "map='" . strip_tags($_POST['map']) . "'"; } //////////////////////////////////////////////////////// ?> <html> <head><title></title> <link rel="STYLESHEET" type="text/css" href=""> </head> <body> <div id="header"> <center><a href="index.html"><img src="images/.jpg" width="90%" height="200" border="0"></a></center> </div> <div class="colmask threecol"> <div class="colmid"> <div class="colleft"> <div class="col1"> <!-- CENTER COLUMN CONTENT --> <center> <h2> Your query has produced the fallowing Replays</h2> <p>Please click links below to download.</p> <?php $dlquery = "Select * FROM replays WHERE " . $leaguepass . $type . $race . $vsrace . $player1 . $player2 . $map; $dlres = mysql_query($dlquery); if ($dlres) { while($row=mysql_fetch_array($dlres, MYSQL_BOTH)) { echo "<p><a href=http://www./upload/"; echo ".SC2Replay>" . "File: " . $row['code'] ." " . "Name: " . $row['name'] . "</a></p>"; echo "<p>" . $row['des'] . "</p>"; echo "<br />"; } } else { echo "<p>This shit isnt querying</p>"; echo $dlquery; } ?> <br /> <br /> <h3>Uploads</h3> <p> If you would like to upload more replays then please do so <a href="upload.php">Here</a></p> <br /> <h3> Downloads</h3> <p> To browse/search for replays please do so <a href="download.php">Here. </a></p> </center> <!-- CENTER COLUMN CONTENT END --> </div> <div class="col2"> <!-- LEFT COLUMN START --> <center><h2>Quicklinks</h2> <p>Use these to navigate site. <p><a href="index.php">Home</a></p> <p><a href="download.php">Download</a></p> <p><a href="upload.php">Upload</a></p> <h2>HOT ITEMS</h2> <p>The 5 best training Replays</p> </center> <!--LEFT COLUMN END --> </div> <div class="col3"> <!-- RIGHT COLUMN START --> <center><h2>UNUSED SPACE</h2> <h3>___________________</h3> <h3>___________________</h3> </center> <!-- RIGHT COLUMN END --> </div> </div> </div> </div> <div id="footer"> <center><p>This page was created by using stricktly html and css code. Banner was not originally designed by the site. Thank you for visiting </a>.</p></center> </div> </body> </html> ---------------------------------------------------------- code exactly as it is on website, with full function only thing i took out was url information of course.
  10. Honestly that is the same result as saying this.. $dlquery="SELECT * FROM whatever In both cases you will get everything as there is essentially no search restrictions. "Where field = ANYTHING" is the same thing as "Give me all fields" but its not the same, one would pull all the data from all fields, and the other would only include the data from "field" Or is there something im not seeing. Not to mention one will keep me from having restrictions being pulled from the other 9 queries. clquery= "SELECT * FROM table WHERE field1="*", field2="*", Field3="4", field4="whatevertheytypedin" through field9; Think you get my drift
  11. Im replying from a phone so bear with me. so if what your saying works then i should be able to do something like the fallowing. <?php include srvdbcon // i know bad syntax $field1=$_POST('field1'); $field2=$_POST('field2'); $field3=$_POST('field3'); // field two was only item seletected for query, meaning lets say he wants "5" to be in field2 but wants to include all the data in fields1/3 if ((field1="Select One") || (field1="")) {$field1=""} else {$field1="$field1"} if ((field2="Select One") || (field2="")) {$field2=""} else {$field2="$field2"} if ((field3="Select One") || (field3="")) {$field3=""} else {$field3="$field3"} dlquery= "SELECT * FROM table" . $field1 . $field2 . $field3" -------------------------------------------------------- problem is in the code i have, i have to write like 300 if statements to create the individual cases of haveing one field as "" or nul to not have it in the dlquery. so the ifstatements make $field1-10= "" if theres no input in text or "Select One" is left as default on dropdown. But theres still the either "." or the "," thats has to be delt with so i had to right more and more if'statements to make up for each possible combination of select one / null query entries. My code is like 500 lines. I'm trying to figure out a way that could make the code like 5 lines. $dlquery="SELECT * FROM table1 WHERE field1='$field1', field2='$field2', field3='$field3'"; the only other code that would have to be done up is as fallows if ($field1 == "SELECT ONE") {$field1 = "*";} else {$field1 = $_POST('field1');} the problem is when im usign the $variables in the $dlquery, they need to all be there or else i have to deal with removing or adding "," or "and" depending on box selections. so if they all can have a value, even if that value says (all) then it would shorten code by about 300 lines. Thanks for helping guys, i know im new to this im just really into the logic and am hopeing theres something like: $field1="*", that is legal syntax. so when i move it to dlquery string it produces field1="*" and allows all data into query under that field. SO ALL IN ALL THE QUESTION IS. IS THERE A WAY.... WITHIN THE "SELECT * FROM table WHERE field1=" something to make it select all". thats what im needing, is it possible, inside of select our outside as a variable.
  12. i see the logic behind your change but when 1 is set for $test1 doesnt that just put a 1 in the quary bassically making the query read $dlquery="SELECT * FROM whatever WHERE 1 and test2='$test2'"; cuase if so that creates an illegal search wouldnt it?
  13. kk here is the real script ------------------------------ <?php include('srvdbcon.php'); $leaguepass = strip_tags($_POST['league']); $type = strip_tags($_POST['type']); $race = strip_tags($_POST['race']); $vsrace = strip_tags($_POST['vsrace']); $player1 = strip_tags($_POST['player1']); $player2 = strip_tags($_POST['player2']); $map = strip_tags($_POST['map']); if ($leaguepass == "Select One") { $leaguepass = "1"; $dlquery = "SELECT * FROM replays WHERE league='$leaguepass' AND type='$type' AND race='$race' AND vsrace='$vsrace' AND player1='$player1' AND player2='$player2' AND map='$map'"; $dlqueryresult = mysql_query($dlquery); if ($dlqueryresult) { while($dlqueryrow = mysql_fetch_array($dlqueryresult)) { echo '<p><a href="http://www.mydomain.org/upload/' . $dlqueryrow['code'] . '.SC2Replay"' . ' >' . $dlqueryrow['name'] . '</a></p>'; } } else { echo "This shit isnt querying"; } } ?> ----------------------------------------------------- currently the qeury works fine if all fields have an option selected. But when a field is left on "Select One" which is default option, the query only pulle data from field where "Select One" is in the field. So im trying to make it to where if Select One is selected it pulls includes all the data from that field in the quary. So i was trying to get a * peramiter or all entries valid kinda thing going. I tried to exchange the 1 but it didnt work. THanks man.
  14. the code i provided for my posting to db works fine, I tested it on other script. Post fine to db. I just cant figure out where the error is before that. The code provided doesnt even reach the point of posting to sql. Its erroring at the confirmation email and password check, and I cant figure out why.
  15. Wow I know its the holidays but... someone has to have a few seconds to look over the code. Or did I miss something? Friends told me this is the place to go.
  16. Hey fellas, and ladies, and all you other php wize's. Names mike and I'm new to php and mysql. Ive done alot of self study but have no formal training at all. I am pretty much just winging my code from w3 schools and other php online codeing helps. I am currently making a registration script for my site, and have hit a bit of a snag. Her is the current code for my regpass.php. <?php include('srvdbcon.php'); $NewUserNameTest=$_POST['NewUserName']; if(!ereg('[^A-Za-z0-9]',$NewUserNameTest)) { $query="SELECT * FROM user WHERE user ='$_POST(NewUserName)'"; $result=mysql_query($query); $num=mysql_num_rows($result); if($num == 0) { $query2="SELECT * FROM user WHERE email ='$_POST(NewUserEmail)'"; $result2=mysql_query($query2); $num2=mysql_num_rows($result2); if ($num2 == 0) { if(($_POST[NewUserPw]==$_POST[NewUserPwCon])&&($_POST[NewUserEmail]==$_POST[NewUserEmailCon])) { //Create a random code $confirm_code=md5(uniqid(rand())); //HACK PREVENTION $name=strip_tags($_POST['NewUserName']); $email=strip_tags($_POST['NewUserEmail']); $pw=strip_tags($_POST['NewUserPw']); //Insert Information Into Temp Code $sql="INSERT INTO temp SET code='$confirm_code',user='$name', email='$email', password='$pw'"; $result=mysql_query($sql); if($result) { $message="SCG.O Confirmation \r\n"; $message="Enter this confirmation code into confirmation page.\r\n"; $message="Enter code into confirmation: $confirm_code"; $sentmail=mail("$email",'Registration Confirmation',"$message",'From: SCGAdmin@uprisetechnology.com'); header("Location:index.php"); } else { die ("Something went wrong."); } } else { die("Password And / Or Email does not match the confirmation entry"); } } else { die("Email Already in Use"); } } else { die("Username already in use"); } } else { die("Username includes Bad Characters."); } ?> ---------------------------------------------------------------------------- The problem I am having is the code executes up to Confirming email and password with the confirming. I have checked, and double checked, the names of the variables $NewUserEmail $NewUserEmailCon $NewUserPw $NewUserPwCon When I click the register button it runs the regpass.php but I am getting the Die results for Error with matching confirmations. Any help would be appreciated. I know it is not the neatest codeing, nor is it probably logical to more vast programmers, but I am learning, and programming accourding to my own logic so I can understand it. Thanks. The code does not post anything to the mysql db but everything else is set up properly. The DB works, I have created this kind of script before with help from others, but this one is using my logic so I can understand the code. Thanks again. NeverBeGosu
×
×
  • 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.