Jump to content

Search the Community

Showing results for tags 'php script'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 4 results

  1. Hi There I am trying to create a login screen within a framed site that when you log in it takes you to a new page for the portal. When I enter the login credentials the frame I am working in goes blank and does not take me to the portal. Can someone please help me out with the coding I have. The coding itself has 2 parts... 1) login and 2) if already logged in gives you a button to open to portal. <? if(isset($_POST['submit'])){ //protect the posted value then store them to variables $Username = protect($_POST['Username']); $Password = protect(sha1($_POST['Password'])); //Check if the username or password boxes were not filled in if(!$Username || !$Password){ //if not display an error message echo "<center>Please enter your <b>Username</b> and <b>Password</b>!</center>"; }else{ //if the were continue checking //select all rows from the table where the username matches the one entered by the user $res = mysql_query("SELECT * FROM `eusers` WHERE `Username` = '".$Username."'"); $num = mysql_num_rows($res); //check if there was not a match if($num == 0){ //if not display an error message echo "<center>The <b>Username</b> or <b>Password</b> you supplied is incorrect!</center>"; }else{ //if there was a match continue checking //select all rows where the username and password match the ones submitted by the user $res = mysql_query("SELECT * FROM `eusers` WHERE `Username` = '".$Username."' AND `Password` = '".$Password."'"); $num = mysql_num_rows($res); //check if there was not a match if($num == 0){ //if not display error message echo "<center>The <b>Username</b> or <b>Password</b> you supplied is incorrect!</center>"; }else{ //if there was continue checking //split all fields fom the correct row into an associative array $row = mysql_fetch_assoc($res); //check to see if the user has not activated their account yet if($row['Active'] != 1){ //if not display error message echo "<center>Your login has been <b>deactivated</b>, Please contact Website Administrator for assistance.</center>"; }else{ //if they have log them in //set the login session storing there id - we use this to see if they are logged in or not $_SESSION['uid'] = $row['id']; //show message echo "<center>You have successfully logged in!</center>"; //update the online field to 50 seconds into the future $time = date('U')+50; mysql_query("UPDATE `eusers` SET `Online` = '".$time."' WHERE `id` = '".$_SESSION['uid']."'"); //redirect them to the usersonline page echo"<a target=\'_blank\" href='portal/index2.php'></a>";?> <?php if(isset($_POST['submit2'])){ //update the online field to 50 seconds into the future $time = date('U')+50; mysql_query("UPDATE `eusers` SET `Online` = '".$time."' WHERE `id` = '".$_SESSION['uid']."'"); //redirect them to the usersonline page echo"<script type='text/javascript' language='Javascript'>window.open('portal/index2.php');</script>";}}}}}}?> <?php include "portal/edb.php"; //if the login session does not exist therefore meaning the user is not logged in if(strcmp($_SESSION['uid'],"") == 0){ //display and error message echo "<form name='main.php' method='post' action=''> <table bgcolor='#FFFFFF' width='320' border='0' align='center' cellpadding='0' cellspacing='0'> <tr> <td ><table border='0' align='center' cellpadding='2' cellspacing='0' class='page-border'> <tr><td colspan='2' class='text_heading_center'>Portal</td> </tr> <tr> <td width='100' class='text_standard_right'>Username:</td> <td width='150' class='text_standard_right'><input name='Username' type='text' class='text_standard_left' /></td> </tr> <tr> <td class='text_standard_right'>Password:</td> <td class='text_standard_right'><input name='Password' type='password' class='text_standard_left' /></td> </tr> <tr> <td height='29' colspan='2' align='right'><input type='submit' name='submit' value='Login' /></td> </tr> </table>"; }else{ $time = date('U')+50; $update = mysql_query("UPDATE `eusers` SET `Online` = '".$time."' WHERE `id` = '".$_SESSION['uid']."'"); $id =$_REQUEST['id']; $result=mysql_query("SELECT * FROM `eusers` WHERE id='".$_SESSION['uid']."'"); print"<form name='main.php' method='post' action=''>"; print"<br/>"; print"You are already logged into the Portal"; print"<br/>"; print"Click here to return the the Portal"; print"<br/>"; print"<input name='submit2' type='button' value='Return to Portal' />"; print"</form>"; }?>
  2. Hi guys, What I'm trying to accomplish sounds like fairly easy task but due to my poor knowledge of php this turned to be quite a challenge. What I'm trying to do is to make a php script that will search the keywords on the multiple websites. Websites that I will search are all web shops, selling spare part for home appliances and keywords used are usually original spare part codes. When searching, script is searching these websites using their own search functions and not Google or other search engines. Input for this script should be a CSV file containing list of keywords and URLs of the web shops that needs to be search for all these keywords. Here is the example: http://prntscr.com/4ebhxh Script should perform like this: It picks up the 1st keyword, browse to the URL1, uses its search, searches for the product, if it finds it, copy its price and write it back to original input CSV. If it doesn't find match (search results appear empty) it should write "no match found" and continue to URL2, URL3 and so on... When all URLs from the list are checked for the 1st keyword, scripts picks up 2nd keyword and continues on through all these keywords are not checked. This would be a resulting CSV file after the 1st keyword is checked: http://prntscr.com/4ebj52 After all data from the input CSV file are processed, script should prompt a msg and create a download link for that CSV file to be downloaded. If there are multiple matches, in other words if for one keyword some of the website searches find 2 or more products, something like "More then one match" should be written in the file. Example: http://prntscr.com/4ebkcx Please note that non of the website is using SSL and non of them requires login in order to display the prizes. This fact should make this script easier to build. Its not important for this script to run fast (its better I think to run it with some timeouts because of the server glitches and bottlenecks). What is more important is to make it automatic so one can start it over the night, over the weekends. Number of the URLs would be around 10, and list of keywords from few tens, to a few hundred. If I can provide some additional clarification and info I'm available. Of course I would be willing to pay someone to help me accomplish this task. Cheers Dean
  3. Hello, So I have a script which is basically a quizish thing. I have an admin panel where I introduce questions and I select the correct answers. Also, I am able to select multiple correct answers if that is needed. Now what is the problem. I have a question with 4 choices and I want to make 2 choices correct. The choices are A, B, C, D. If I set B,C as correct, it's ok, after I save the question those are set to be the correct choices. If I set B, D it's ok again, after saving the question, the correct choices are saved. Now, if I want to set A, B as the correct choices, after saving it's saved only B. However, if I set A,D or A,C, the choices are saved. It seems like there is a conflict between setting correct choices A, B. After saving only B is there. Here is a demo of the script, of the admin panel: http://stilbarbatesc.ro/ap/admin user: demo pass: demo After entering please go to "Intrebari" and after that choose "PROF.LEG.RUT - INSTRUCTORI AUTO" (it's at the end of the first list) After choosing "PROF.LEG.RUT - INSTRUCTORI AUTO" you will see bellow the questions of this test. Just go on whatever question you want and try setting the correct choices (Varianta corecta) A and B. Save that and go back to the question, you will see that only B got saved. Here is also a snippet of the code, maybe will help. <?php $target = "../files/img_intrebari/"; if(empty($_GET['pagina'])) {$_GET['pagina'] = 'adauga-intrebare';} if(empty($_GET['id'])) { $teste = mysql_query("SELECT * FROM teste where test_tip='parinte' order by test_nume limit 1"); } else { $teste = mysql_query("SELECT * FROM teste where test_id='$_GET[id]'"); } while($row = mysql_fetch_assoc($teste)) { $_GET['id'] = $row['test_id']; if($row['test_numar_variante'] == 'Doar o varianta') { $test_numar_variante = 'radio'; $test_numar_variante_a = 'int_var_cor_a'; $test_numar_variante_b = 'int_var_cor_a'; $test_numar_variante_c = 'int_var_cor_a'; $test_numar_variante_d = 'int_var_cor_a'; $test_numar_variante_e = 'int_var_cor_a'; $test_numar_variante_n = 'int_var_cor_a'; } elseif($row['test_numar_variante'] == 'Toate variantele') { $test_numar_variante = 'checkbox'; $test_numar_variante_a = 'int_var_cor_a'; $test_numar_variante_b = 'int_var_cor_b'; $test_numar_variante_c = 'int_var_cor_c'; $test_numar_variante_d = 'int_var_cor_d'; $test_numar_variante_e = 'int_var_cor_e'; $test_numar_variante_n = 'int_var_cor_n'; } } if(isset($_POST['adauga']) or isset($_POST['salveaza'])) { $intrebare = mysql_real_escape_string($_POST['intrebare']); $intrebare_var_a = mysql_real_escape_string($_POST['intrebare_var_a']); $intrebare_var_b = mysql_real_escape_string($_POST['intrebare_var_b']); $intrebare_var_c = mysql_real_escape_string($_POST['intrebare_var_c']); $intrebare_var_d = mysql_real_escape_string($_POST['intrebare_var_d']); $intrebare_var_e = mysql_real_escape_string($_POST['intrebare_var_e']); $variante = ''; if(!empty($_POST['int_var_cor_a'])) {$variante = $variante.$_POST['int_var_cor_a'].',';} if(!empty($_POST['int_var_cor_b'])) {$variante = $variante.$_POST['int_var_cor_b'].',';} if(!empty($_POST['int_var_cor_c'])) {$variante = $variante.$_POST['int_var_cor_c'].',';} if(!empty($_POST['int_var_cor_d'])) {$variante = $variante.$_POST['int_var_cor_d'].',';} if(!empty($_POST['int_var_cor_e'])) {$variante = $variante.$_POST['int_var_cor_e'].',';} if(!empty($_POST['int_var_cor_n'])) {$variante = $variante.$_POST['int_var_cor_n'].',';} $intrebare_var_cor = substr($variante,0,-1); $intrebare_test_id = $_GET['id']; if(empty($intrebare)) { $_SESSION['mesaj-e'] = 'Intrebarea contine prea putine caractere !'; redirect(); } if(empty($intrebare_var_a) and empty($intrebare_var_b) and empty($intrebare_var_c) and empty($intrebare_var_d) and empty($intrebare_var_e)) { $_SESSION['mesaj-e'] = 'Variantele de raspuns nu contin caractere ! Este necesara cel pul o varianta de raspuns !'; redirect(); } if(empty($intrebare_var_cor)) { $_SESSION['mesaj-e'] = 'Nu a fost selectata nici o varianta corecta !'; redirect(); } if(isset($_POST['adauga'])) { $insert = mysql_query("INSERT INTO `intrebari` (intrebare,intrebare_var_a,intrebare_var_b,intrebare_var_c,intrebare_var_d,intrebare_var_e,intrebare_var_cor,intrebare_test_id) values ('$intrebare','$intrebare_var_a','$intrebare_var_b','$intrebare_var_c','$intrebare_var_d','$intrebare_var_e','$intrebare_var_cor','$intrebare_test_id')"); } elseif(isset($_POST['salveaza'])) { $insert = mysql_query("UPDATE `intrebari` SET intrebare='$intrebare',intrebare_var_a='$intrebare_var_a',intrebare_var_b='$intrebare_var_b',intrebare_var_c='$intrebare_var_c',intrebare_var_d='$intrebare_var_d',intrebare_var_e='$intrebare_var_e',intrebare_var_cor='$intrebare_var_cor',intrebare_test_id='$intrebare_test_id' where intrebare_id='$_GET[pagina]'"); } if($insert) { if(isset($_POST['adauga'])) { $verificare = mysql_query("SELECT * FROM `intrebari` order by `intrebare_id` DESC LIMIT 1"); while( $row = mysql_fetch_assoc($verificare) ) {$_POST['intrebare_id'] = $row['intrebare_id'];} } elseif(isset($_POST['salveaza'])) { $_POST['intrebare_id'] = $_GET['pagina']; } $imagine = $target.str_replace(basename($_FILES['imagine']['name']),$_POST['intrebare_id'].'.png',basename($_FILES['imagine']['name'])); move_uploaded_file($_FILES['imagine']['tmp_name'], $imagine); if(isset($_POST['adauga'])) { $_SESSION['mesaj-s'] = 'Intrebarea a fost adaugata !'; } elseif(isset($_POST['salveaza'])) { $_SESSION['mesaj-s'] = 'Datele intrebarii s-au salvat !'; } } else {die(mysql_error()); $_SESSION['mesaj-e'] = 'A avut loc o eroare !';} redirect(); } if(!empty($_GET['sterge'])) { if(unlink($_GET['sterge'])) { $_SESSION['mesaj-s'] = 'Imaginea a fost stearsa !'; } else { $_SESSION['mesaj-e'] = 'A avut loc o eroare !'; } redirect_action(); } if(isset($_POST['sterge'])){ $_GET['actiune'] = 'sterge-intrebare'; } if(!empty($_GET['confirm']) and $_GET['confirm'] == 'da') { $delete = mysql_query("DELETE FROM `intrebari` where intrebare_id='$_GET[pagina]'"); if($delete) { unlink($target.$_GET['pagina'].'.png'); $_SESSION['mesaj-s'] = 'Intrebarea a fost stearsa !'; } else { $_SESSION['mesaj-e'] = 'A avut loc o eroare !'; } redirect_page(); } ?>
  4. I need a little help for a script theat makes a import in to a table from 2 xml files . The probles is theat i could do the insert from the first xml file but when i try to import data from the second xml ( the update script) does not work.
×
×
  • 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.