Jump to content

XxDeadmanxX

Members
  • Posts

    26
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

XxDeadmanxX's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. No i mean when its "box" on database it makes new row number 1 instead i want after box i want it to keep on going box,box,box
  2. Ok so i made this script that if the position1 it makes it 2 and if its 6 it makes it box . But if its box it repeats to 1 for some reason. $result = mysql_query("SELECT * FROM pokemons where username='".$Valid_User."' order by position desc limit 1") or die(mysql_error()); $row = mysql_fetch_array( $result ); $positioncheck = $row['position']; if(!isset($positioncheck) OR $positioncheck=="" OR $positioncheck=="0"){ $positioncheck=1; }else{ $positioncheck = ($positioncheck+1); } if($positioncheck>6){ $positioncheck="box"; }
  3. i have the session start on the main page. I include the page from the index page. And the error im geting is the one at bottom. } else { echo "ERROR!"; }
  4. This gives me a error. And other guys still doesnt work . Heres the full code. <?php $pokemon= Bulbasaur; $Valid_User= $_SESSION['valid_user']; $result = mysql_query("SELECT * FROM dbUsers where username='$Valid_User'") or die(mysql_error()); $row = mysql_fetch_array($result); $username= $_POST['username']; if ($result = mysql_query("SELECT * FROM pokemons where username='$Valid_User'")) { if (mysql_num_rows($result)) { while ($row = mysql_fetch_array($result)) { if ($row['position']=="") { $positioncheck = 1; } else { $positioncheck = $row['position']+1; } } } else { echo "No results found"; } } else { die(mysql_error()); } if ($positioncheck > 6) { $positioncheck = "box"; } if($row['promo']=="Yes") { echo "Sorry, $Valid_User you already have the pokemon."; exit; } if ($row['promo']=="No") { echo "Congrats, you got the promo."; mysql_query("INSERT INTO pokemons (username, pokemon, position) VALUES('$Valid_User', '$pokemon','$positioncheck')") or die(mysql_error()); mysql_query("UPDATE dbUsers SET promo='Yes' WHERE username='$Valid_User'"); } else { echo "ERROR!"; } ?>
  5. Ok im making a script it checks if its position 1 it makes it 2 . But this script isnt working ,can someone tell me wat i did wrong? $result = mysql_query("SELECT * FROM pokemons where username='$Valid_User'"); while($row = mysql_fetch_array($result)) if ($row['position']==""){ $positioncheck= 1; } else{ $positioncheck=($row['position']+1); if($positioncheck>6){$positioncheck="box";} }
  6. Ok im making a promo script that gives the user the special promo but it seems not to work can someone help me . <?php $result = mysql_query("SELECT * FROM dbUsers where username= '". $_SESSION['valid_user']."'") or die(mysql_error()); $row = mysql_fetch_array($result); if($row['promo']=="Yes") { echo "<br />Sorry, trainer ".$_POST['username']." you already have the pokemon.<br /><br />"; exit; } if ($row['promo']=="No") { echo "YOU GOT THE PROMO!!!!"; mysql_query("INSERT INTO pokemons (username, pokemon) VALUES('. $_SESSION["valid_user"].', 'BALBA' ) ") or die(mysql_error()); mysql_query("UPDATE dbUsers SET promo='Yes' WHERE username='. $_SESSION["valid_user"].' "); } else { echo "You already took the PROMO!."; } ?>
  7. I have image uploader. But i want  it to resize and rename if its possible. Here is the code im using [code]<?php echo('NOTE: This may take few seconds. <br> Upload images: <FORM ENCTYPE="multipart/form-data" ACTION="upload.php" METHOD="POST"> The file: <INPUT TYPE="file" NAME="userfile"> <INPUT TYPE="submit" VALUE="Upload"> </FORM>'); $path = "uploads/"; $max_size = 200000000; if (!isset($HTTP_POST_FILES['userfile'])) exit; if (is_uploaded_file($HTTP_POST_FILES['userfile']['tmp_name'])) { if ($HTTP_POST_FILES['userfile']['size']>$max_size) { echo "The file is too big<br>n"; exit; } if (($HTTP_POST_FILES['userfile']['type']=="image/gif") || ($HTTP_POST_FILES['userfile']['type']=="image/pjpeg") || ($HTTP_POST_FILES['userfile']['type']=="image/jpeg") || ($HTTP_POST_FILES['userfile']['type']=="image/png") || ($HTTP_POST_FILES['userfile']['type']=="image/bmp")|| ($HTTP_POST_FILES['userfile']['type']=="image/gif")) { if (file_exists($path . $HTTP_POST_FILES['userfile']['name'])) { echo "The file already exists<br>n"; exit; } $res = copy($HTTP_POST_FILES['userfile']['tmp_name'], $path . $HTTP_POST_FILES['userfile']['name']); if (!$res) { echo "upload failed!<br>n"; exit; } else { echo "upload sucessful<br>n"; } echo "File Name: ".$HTTP_POST_FILES['userfile']['name']."<br>n"; echo "File Size: ".$HTTP_POST_FILES['userfile']['size']." bytes<br>n"; echo "File Type: ".$HTTP_POST_FILES['userfile']['type']."<br>n"; } else { echo "Wrong file type<br>n"; exit; } } $my_file = $HTTP_POST_FILES['userfile']['name']; ?> [/code]
  8. [quote author=steviez link=topic=123414.msg510025#msg510025 date=1169418431] Hi, I have a site ([url=http://www.music4play.com]http://www.music4play.com[/url]) yes i know its a youtube clone!  ::) I need to impliment the upload and use of profile pics on the signup and profile pages, then the profile pic needs to be used to replace the video thumb on the index page (featured artists) the reason for this is that i have converted the script in to a music upload site and i want the profile pic of the user to be visible instead of the video thumb. The script can be downloaded here: [url=http://www.music4play.com/script.rar]http://www.music4play.com/script.rar[/url] Any help would be great! Thanks P.S. I am a newbie! [/quote] So your saying you want music upload script??
  9. Im try make simple forum but the message if its to big it makes the table bigger. http://afrosf.af.funpic.org/1/view_topic.php?id=1 And here i the script: [code]<?php $host="localhost"; // Host name $username="xxxxxxxx"; // Mysql username $password="xxxxxx"; // Mysql password $db_name="xxxxxxxxxxxx"; // Database name $tbl_name="xxxxxxxxxxxxxxxx"; // Table name // Connect to server and select databse. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); // get value of id that sent from address bar $id=$_GET['id']; $sql="SELECT * FROM $tbl_name WHERE id='$id'"; $result=mysql_query($sql); $rows=mysql_fetch_array($result); ?> <table width="400" border="1" align="center" bordercolor="gray" cellpadding="1" cellspacing="1" bgcolor="#CCCCCC"> <tr> <td> <table width="400" border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#CCCCCC"> <tr> <td><table width="100%" border="1" cellpadding="3" cellspacing="1" bordercolor="1" bgcolor="#FFFFFF"> <tr> <th bgcolor="#F8F7F1"><strong><? echo $rows['topic']; ?></strong></th> </tr> </table></td> </tr> </table> <table width="400" border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#CCCCCC"> <tr> <td><table width="100%" border="1" cellpadding="3" cellspacing="1" bordercolor="1" bgcolor="#FFFFFF"> <tr><th bgcolor="#F8F7F1" width="100">Author</th><th bgcolor="#F8F7F1">Message</th></tr> <tr> <td bgcolor="#F8F7F1" width="100"><? echo $rows['name']; ?> <br> <strong>Date/time : </strong><? echo $rows['datetime']; ?></td><td bgcolor="#F8F7F1"> <? echo $rows['detail']; ?></td> </tr> </table></td> </tr> </table> <?php $tbl_name2="forum_answer"; // Switch to table "forum_answer" $sql2="SELECT * FROM $tbl_name2 WHERE question_id='$id'"; $result2=mysql_query($sql2); while($rows=mysql_fetch_array($result2)){ ?> <table width="400" border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#CCCCCC"> <tr> <td><table width="100%" border="1" cellpadding="3" cellspacing="1" bordercolor="1" bgcolor="#FFFFFF"> <tr><th bgcolor="#F8F7F1" width="100">Author</th><th bgcolor="#F8F7F1">Message</th></tr> <tr> <td bgcolor="#F8F7F1" width="100"><? echo $rows['a_name']; ?></td><td bgcolor="#F8F7F1"><? echo $rows['a_answer']; ?></td> </tr> </table></td> </tr> </table> </td> </tr> </table> <br> <? } $sql3="SELECT view FROM $tbl_name WHERE id='$id'"; $result3=mysql_query($sql3); $rows=mysql_fetch_array($result3); $view=$rows['view']; // if have no counter value set counter = 1 if(empty($view)){ $view=1; $sql4="INSERT INTO $tbl_name(view) VALUES('$view') WHERE id='$id'"; $result4=mysql_query($sql4); } // count more value $addview=$view+1; $sql5="update $tbl_name set view='$addview' WHERE id='$id'"; $result5=mysql_query($sql5); mysql_close(); ?> <BR> <table width="400" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC"> <tr> <form name="form1" method="post" action="add_answer.php"> <td> <table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF"> <tr> <td width="18%"><strong>Name</strong></td> <td width="3%">:</td> <td width="79%"><input name="a_name" type="text" id="a_name" size="45"></td> </tr> <tr> <td><strong>Email</strong></td> <td>:</td> <td><input name="a_email" type="text" id="a_email" size="45"></td> </tr> <tr> <td valign="top"><strong>Answer</strong></td> <td valign="top">:</td> <td><textarea name="a_answer" cols="45" rows="3" id="a_answer"></textarea></td> </tr> <tr> <td>&nbsp;</td> <td><input name="id" type="hidden" value="<? echo $id; ?>"></td> <td><input type="submit" name="Submit" value="Submit"> <input type="reset" name="Submit2" value="Reset"></td> </tr> </table> </td> </form> </tr> </table> [/code]
  10. Does anyone know any tutorial that i can read to help me make my own.
  11. [quote author=grimpirate link=topic=114061.msg463892#msg463892 date=1162846933] This is some code I wrote up for a simple forum. Abilities: Login Logout Registration Uses file read and write operations rather than database support Post new topics Automatic locking of topics based on a time limit Automatic removal of usernames based on a time limit Simple style sheets Limitations: Cannot yet post replies Administrative functions not yet supported Style sheets need work Better code documentation I made it very simple on purpose as I wanted the forum to be purely text, and to not contain any superfluous information. [/quote] Ok , can you  upload it so we can see how it looks like??
  12. [quote author=XxDeadmanxX link=topic=113283.msg461436#msg461436 date=1162423341] [quote author=Demonic link=topic=113283.msg460256#msg460256 date=1162249988] try this: if($upload){ $filename = $fileuploaded; $newname = $logged[username]+$filename; rename($filename,$newname); } source: http://www.phpfreaks.com/phpref/157.php [/quote] ok can i do that with any script? [/quote] Where does that go in the script??? [code]<?php $reqlevel = 1; include("membersonly.inc.php"); //print_r($_POST); if($_POST["action"] == "Upload Image") { unset($imagename); if(!isset($_FILES) && isset($HTTP_POST_FILES)) $_FILES = $HTTP_POST_FILES; if(!isset($_FILES['image_file'])) $error["image_file"] = "An image was not found."; $imagename = basename($_FILES['image_file']['name']); //echo $imagename; if(empty($imagename)) $error["imagename"] = "The name of the image was not found."; if(empty($error)) { $newimage = "images/" . $imagename; //echo $newimage; $result = @move_uploaded_file($_FILES['image_file']['tmp_name'], $newimage); if(empty($result)) $error["result"] = "There was an error moving the uploaded file."; } $query = "INSERT INTO Img (username, file) VALUES ('$user_currently_loged','$imagename')";  $result = mysql_query($query); } include("upload_form.php"); if(is_array($error)) { while(list($key, $val) = each($error)) { echo $val; echo "<br>n"; } } include("list_images.php"); ?>[/code]
  13. [quote author=Demonic link=topic=113283.msg460256#msg460256 date=1162249988] try this: if($upload){ $filename = $fileuploaded; $newname = $logged[username]+$filename; rename($filename,$newname); } source: http://www.phpfreaks.com/phpref/157.php [/quote] ok can i do that with any script?
  14. Ok im making script to upload images but i want the script to rename the file to the user upload it and the file name . Example the user who upload it is deadman and file is haha.gif i want it to be deadmanhaha.gif .
×
×
  • 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.